GNU bug report logs -
#34708
alist-get has unclear documentation
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#34708: alist-get has unclear documentation
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 34708 <at> debbugs.gnu.org.
--
34708: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34708
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
> Patch installed (master). Can we close this report?
>
> I left the manual section about alist-get as is. It is not perfect, but
> what I really would like to have instead in the long run is a chapter
> about map.el functions. This is not subject of this report, however,
> and I'm not sure if map.el is mature enough to do that now.
Ok, closing. Thanks everyone for the discussion.
Michael.
[Message part 3 (message/rfc822, inline)]
Hi
In most recent subr.el (git repository, lisp folder), this is the
definition of alist-get:
(defun alist-get (key alist &optional default remove testfn)
"Return the value associated with KEY in ALIST.
If KEY is not found in ALIST, return DEFAULT.
Use TESTFN to lookup in the alist if non-nil. Otherwise, use `assq'.
This is a generalized variable suitable for use with `setf'.
When using it to set a value, optional argument REMOVE non-nil
means to remove KEY from ALIST if the new value is `eql' to DEFAULT."
(ignore remove) ;;Silence byte-compiler.
(let ((x (if (not testfn)
(assq key alist)
(assoc key alist testfn))))
(if x (cdr x) default)))
* Last paragraph starts with `This'. What is `this'? ALIST? TESTFN?
alist-get itself? Since this doc-string is there for a long time, it
may be the case it makes sense and I didn't understand it, but again
in this case, others will not understand as well, unclear doc-string.
* How do I use `this' or `it' to set a value? Function is alist-*get*
but somehow I can set values. A simple example on doc-string and/or
info node would explain everything.
* Action of REMOVE is described, but it doesn't correspond to code.
REMOVE is ignored.
* Probably Elisp info follows misleading doc-string.
Miguel
--
Miguel Vinicius Santini Frasson
mvsfrasson <at> gmail.com
This bug report was last modified 6 years and 32 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.