diff options
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))) |