GNU bug report logs - #75170
add-to-alist: new function

Previous Next

Package: emacs;

Reported by: Roland Winkler <winkler <at> gnu.org>

Date: Sun, 29 Dec 2024 05:35:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Roland Winkler <winkler <at> gnu.org>
Cc: 75170 <at> debbugs.gnu.org
Subject: bug#75170: add-to-alist: new function
Date: Tue, 21 Jan 2025 18:08:07 -0500
I don't have much to add to this discussion except:

- I personally dislike `add-to-list` because I think that conflating
  symbols with variables is a bad practice (e.g. because it is
  incompatible with lexical scoping).

- Yet, it works OK for configuration, which always involves
  global/dynamic variables anyway, and where `push` is not great and
  `cl-pushnew` often requires `:test #'equal`.

- I think we should try and provide better support (in general) for
  unloading packages, and this means improving support for undoing
  top-level operations.  We currently support `defalias` and friends
  fairly well, `defvar` and friends tolerably, but we fail miserably for
  most other things.  So maybe something like an `add-to-alist` dedicated
  to top-level operations, which records the change somewhere
  (e.g. `load-history`) so we can undo it when unloading, would be
  an improvement.  Of course it would make a lot of sense to do it
  together with similar operations to add an element to a list, to add
  a property to a symbol, to add an advice, to add a function on a hook,
  ... so it's probably worth thinking of a more general way to provide
  those operations than doing it one at a time.


- Stefan





This bug report was last modified 142 days ago.

Previous Next


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