GNU bug report logs - #36035
26.2; doc string of `add-to-list'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Fri, 31 May 2019 20:47:02 UTC

Severity: minor

Found in version 26.2

Done: Drew Adams <drew.adams <at> oracle.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36035 in the body.
You can then email your comments to 36035 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36035; Package emacs. (Fri, 31 May 2019 20:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 31 May 2019 20:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.2; doc string of `add-to-list'
Date: Fri, 31 May 2019 13:46:16 -0700 (PDT)
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''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36035; Package emacs. (Fri, 31 May 2019 20:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 36035 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> gmail.com
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 36035 <at> debbugs.gnu.org
Subject: Re: bug#36035: 26.2; doc string of `add-to-list'
Date: Fri, 31 May 2019 16:51:02 -0400
Drew Adams <drew.adams <at> 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"))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36035; Package emacs. (Fri, 31 May 2019 21:03:01 GMT) Full text and rfc822 format available.

Message #11 received at 36035 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: npostavs <at> gmail.com
Cc: 36035 <at> debbugs.gnu.org
Subject: RE: bug#36035: 26.2; doc string of `add-to-list'
Date: Fri, 31 May 2019 14:02:38 -0700 (PDT)
> 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.




bug closed, send any further explanations to 36035 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Drew Adams <drew.adams <at> oracle.com> to control <at> debbugs.gnu.org. (Fri, 31 May 2019 21:05:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 29 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 354 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.