unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36035: 26.2; doc string of `add-to-list'
@ 2019-05-31 20:46 Drew Adams
  2019-05-31 20:51 ` npostavs
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2019-05-31 20:46 UTC (permalink / raw)
  To: 36035

The doc in (elisp) `List Variables' is OK.  The doc string is not.

The doc string says this:

  Add ELEMENT to the value of LIST-VAR if it isn't there yet.

That doesn't say what it does it ELEMENT _is_ already there (and it
should).

But one might easily get the impression that it does NOT add ELEMENT if
it is already present.  And that's just plain wrong.

(setq foo '((a . "aaa") (b . "bbb"))) ; => ((a . "aaa") (b . "bbb"))

(add-to-list 'foo '(a . "@@@@")) ; => ((a . "@@@@") (a . "aaa") (b . "bbb"))

In GNU Emacs 26.2 (build 1, x86_64-w64-mingw32)
 of 2019-04-13
Repository revision: fd1b34bfba8f3f6298df47c8e10b61530426f749
Windowing system distributor `Microsoft Corp.', version 10.0.17134
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#36035: 26.2; doc string of `add-to-list'
  2019-05-31 20:46 bug#36035: 26.2; doc string of `add-to-list' Drew Adams
@ 2019-05-31 20:51 ` npostavs
  2019-05-31 21:02   ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: npostavs @ 2019-05-31 20:51 UTC (permalink / raw)
  To: Drew Adams; +Cc: 36035

Drew Adams <drew.adams@oracle.com> writes:

> But one might easily get the impression that it does NOT add ELEMENT if
> it is already present.  And that's just plain wrong.
>
> (setq foo '((a . "aaa") (b . "bbb"))) ; => ((a . "aaa") (b . "bbb"))
>
> (add-to-list 'foo '(a . "@@@@")) ; => ((a . "@@@@") (a . "aaa") (b . "bbb"))

Have you mixed up add-to-list with some hypothetical add-to-alist?

(setq foo '((a . "aaa") (b . "bbb"))) ; => ((a . "aaa") (b . "bbb"))

(add-to-list 'foo '(a . "aaa")) ; => ((a . "aaa") (b . "bbb"))





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#36035: 26.2; doc string of `add-to-list'
  2019-05-31 20:51 ` npostavs
@ 2019-05-31 21:02   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2019-05-31 21:02 UTC (permalink / raw)
  To: npostavs; +Cc: 36035

> Have you mixed up add-to-list with some hypothetical add-to-alist?
> 
> (setq foo '((a . "aaa") (b . "bbb"))) ; => ((a . "aaa") (b . "bbb"))
> (add-to-list 'foo '(a . "aaa")) ; => ((a . "aaa") (b . "bbb"))

Duh. ;-)  Need more coffee, for sure.
Sorry about that.  I'll close it.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-31 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 20:46 bug#36035: 26.2; doc string of `add-to-list' Drew Adams
2019-05-31 20:51 ` npostavs
2019-05-31 21:02   ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).