]> git.eshelyaron.com Git - emacs.git/commitdiff
(add-to-list): New function.
authorRichard M. Stallman <rms@gnu.org>
Thu, 13 Oct 1994 06:34:09 +0000 (06:34 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 13 Oct 1994 06:34:09 +0000 (06:34 +0000)
lisp/subr.el

index 3c4308bf8c29b8b4f96da6c9306f51ea41c69051..7c0ae0cb9144048f9b68ad65c164f0038dfcf211 100644 (file)
@@ -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)))))
 \f
 ;;;; Specifying things to do after certain files are loaded.