From: Richard M. Stallman Date: Thu, 13 Oct 1994 06:34:09 +0000 (+0000) Subject: (add-to-list): New function. X-Git-Tag: emacs-19.34~6344 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6e3af6305a07eda134fde4c61cd59e0b6f41c96d;p=emacs.git (add-to-list): New function. --- diff --git a/lisp/subr.el b/lisp/subr.el index 3c4308bf8c2..7c0ae0cb914 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -710,6 +710,11 @@ To make a hook variable buffer-local, always use (if (equal hook-value function) (setq hook-value nil))) (set-default hook hook-value))))) + +(defun add-to-list (list-var element) + "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet." + (or (member element (symbol-value list-var)) + (set list-var (cons element (symbol-value list-var))))) ;;;; Specifying things to do after certain files are loaded.