summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/assoc.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2012-03-25 16:37:21 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2012-03-25 16:37:21 -0400
commit699c782b7668c44d0fa4446331b0590a6d5dac82 (patch)
tree5dcce364741d0761920a3d274b0fc8aba4103d45 /lisp/emacs-lisp/assoc.el
parent98fb480ee31bf74cf554044f60f21df16566dd7f (diff)
parente99a9b8bdccadded1f6fae88ee7a2a93dfd4eacf (diff)
downloademacs-699c782b7668c44d0fa4446331b0590a6d5dac82.tar.gz
emacs-699c782b7668c44d0fa4446331b0590a6d5dac82.tar.bz2
emacs-699c782b7668c44d0fa4446331b0590a6d5dac82.zip
Merge from trunk
Diffstat (limited to 'lisp/emacs-lisp/assoc.el')
-rw-r--r--lisp/emacs-lisp/assoc.el9
1 files changed, 4 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/assoc.el b/lisp/emacs-lisp/assoc.el
index 31be851f2dd..264374ed721 100644
--- a/lisp/emacs-lisp/assoc.el
+++ b/lisp/emacs-lisp/assoc.el
@@ -1,6 +1,6 @@
;;; assoc.el --- insert/delete functions on association lists
-;; Copyright (C) 1996, 2001-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2012 Free Software Foundation, Inc.
;; Author: Barry A. Warsaw <bwarsaw@cen.com>
;; Keywords: extensions
@@ -61,10 +61,9 @@ pair is not at the head of alist. ALIST is not altered."
(defun aput (alist-symbol key &optional value)
- "Inserts a key-value pair into an alist.
+ "Insert a key-value pair into an alist.
The alist is referenced by ALIST-SYMBOL. The key-value pair is made
-from KEY and optionally, VALUE. Returns the altered alist or nil if
-ALIST is nil.
+from KEY and optionally, VALUE. Returns the altered alist.
If the key-value pair referenced by KEY can be found in the alist, and
VALUE is supplied non-nil, then the value of KEY will be set to VALUE.
@@ -78,7 +77,7 @@ of the alist (with value nil if VALUE is nil or not supplied)."
(setq alist (symbol-value alist-symbol))
(cond ((null alist) (set alist-symbol elem))
((anot-head-p alist key) (set alist-symbol (nconc elem alist)))
- (value (setcar alist (car elem)))
+ (value (setcar alist (car elem)) alist)
(t alist))))