all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62366: 30.0.50; Doc: add-to-list: destructive?
@ 2023-03-22  3:19 Michael Heerdegen
  0 siblings, 0 replies; only message in thread
From: Michael Heerdegen @ 2023-03-22  3:19 UTC (permalink / raw)
  To: 62366


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)





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-22  3:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22  3:19 bug#62366: 30.0.50; Doc: add-to-list: destructive? Michael Heerdegen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.