summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-10-13 06:34:09 +0000
committerRichard M. Stallman <rms@gnu.org>1994-10-13 06:34:09 +0000
commit82f68f6074cdb649151ec4a65ca1660b25d2532a (patch)
tree5e3cfc61d15efed12fe0cea2979b6991526da09c /lisp/subr.el
parentc3cf433b8a8bb8589662b3429da2a202b883cc48 (diff)
downloademacs-82f68f6074cdb649151ec4a65ca1660b25d2532a.tar.gz
(add-to-list): New function.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el5
1 files changed, 5 insertions, 0 deletions
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.