diff options
| author | Glenn Morris | 2016-06-07 19:59:37 -0400 |
|---|---|---|
| committer | Glenn Morris | 2016-06-07 19:59:37 -0400 |
| commit | 1f85b7ca034ee4f96d796d95ec86bc4fa0ba8aa3 (patch) | |
| tree | 601774c89a6ccbc6686c3a15c35dfaa92d539381 /lisp | |
| parent | ba3f206239349b725a970c7015f7f4ee8631ef6d (diff) | |
| download | emacs-1f85b7ca034ee4f96d796d95ec86bc4fa0ba8aa3.tar.gz emacs-1f85b7ca034ee4f96d796d95ec86bc4fa0ba8aa3.zip | |
Doc fixes re alist-get. (Bug#23548)
* lisp/subr.el (alist-get): Doc fix.
* doc/lispref/lists.texi (Association Lists): Improve alist-get.
; * etc/NEWS: Related edit.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/subr.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 81570d484b9..ed2166a0ee2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -598,10 +598,12 @@ Elements of ALIST that are not conses are ignored." | |||
| 598 | alist) | 598 | alist) |
| 599 | 599 | ||
| 600 | (defun alist-get (key alist &optional default remove) | 600 | (defun alist-get (key alist &optional default remove) |
| 601 | "Get the value associated to KEY in ALIST. | 601 | "Return the value associated with KEY in ALIST, using `assq'. |
| 602 | DEFAULT is the value to return if KEY is not found in ALIST. | 602 | If KEY is not found in ALIST, return DEFAULT. |
| 603 | REMOVE, if non-nil, means that when setting this element, we should | 603 | |
| 604 | remove the entry if the new value is `eql' to DEFAULT." | 604 | This is a generalized variable suitable for use with `setf'. |
| 605 | When using it to set a value, optional argument REMOVE non-nil | ||
| 606 | means to remove KEY from ALIST if the new value is `eql' to DEFAULT." | ||
| 605 | (ignore remove) ;;Silence byte-compiler. | 607 | (ignore remove) ;;Silence byte-compiler. |
| 606 | (let ((x (assq key alist))) | 608 | (let ((x (assq key alist))) |
| 607 | (if x (cdr x) default))) | 609 | (if x (cdr x) default))) |