GNU bug report logs - #62366
30.0.50; Doc: add-to-list: destructive?

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Wed, 22 Mar 2023 03:20:02 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 62366 AT debbugs.gnu.org.

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#62366; Package emacs. (Wed, 22 Mar 2023 03:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 22 Mar 2023 03:20:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Doc: add-to-list: destructive?
Date: Wed, 22 Mar 2023 04:19:38 +0100
Hello,

An example to demonstrate what I want to suggest: I use the following
piece of code in my personal customization of Calc:

#+begin_src emacs-lisp
(when (eq calc-language 'latex)
  (add-to-list 'math-expr-opers (list "\\cdot" '* 191 190))))
#+end_src

It is important that this code does not modify the list in
`math-expr-opers' destructively because this list shares a sublist that
is the value of a different variable I must avoid to change by side
effect.

AFAIK `add-to-list' is safe in that regard unless you specify the APPEND
argument (where it suggests itself that the operation is destructive).

So, can we add this simple detail to the docstring of `add-to-list':
that this function doesn't modify the list that the LIST-VAR is bound to
unless APPEND is non-nil?  It would be strange if this would not be the
case, still, I think it would be good to speak this out.

TIA,

Michael.


In GNU Emacs 30.0.50 (build 27, x86_64-pc-linux-gnu, cairo version
 1.16.0) of 2023-03-20 built on drachen
Repository revision: aa54a24570e526b5438264caacf405a2370ba9d3
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)




This bug report was last modified 1 year and 30 days ago.

Previous Next


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