From: Eli Zaretskii <eliz@gnu.org>
To: Roland Winkler <winkler@gnu.org>,
Stefan Kangas <stefankangas@gmail.com>,
Andrea Corallo <acorallo@gnu.org>
Cc: 75170@debbugs.gnu.org
Subject: bug#75170: add-to-alist: new function
Date: Sun, 05 Jan 2025 17:21:00 +0200 [thread overview]
Message-ID: <86wmf970df.fsf@gnu.org> (raw)
In-Reply-To: <87zfkelf11.fsf@gnu.org> (message from Roland Winkler on Sun, 29 Dec 2024 08:50:18 -0600)
> From: Roland Winkler <winkler@gnu.org>
> Cc: 75170@debbugs.gnu.org
> Date: Sun, 29 Dec 2024 08:50:18 -0600
>
> On Sun, Dec 29 2024, Eli Zaretskii wrote:
> > What is the advantage of adding this function, given that add-to-list
> > can be used with alists, and given that alist-get can nowadays be used
> > as a generalize variable?
>
> The advantage I see for also having the function add-to-alist is the
> following:
>
> add-to-list checks for the presence of an element in a list. In the
> case of alists, this means it checks for the presence of associations.
> You cannot easily modify an existing association with add-to-list. If
> you have an alist with association (foo . bar) and you call add-to-list
> with an element (foo . baz), add-to-list will not remove the association
> (foo . bar), but the alist will then contain both associations.
>
> add-to-alist checks for the presence of keys and it makes sure that each
> key appears only once in an alist. By default, it replaces the value of
> an existing key. This makes it easy to modify an existing association.
> Only with the optional arg NO-REPLACE non-nil, it will preserve an
> existing association.
>
> Say, I want in my .emacs file a more complicated association for a key,
> and I do not get initially what I want. I can call add-to-alist
> multiple times, till I get what I want.
>
> Is there a simple way to accomplish this in other ways (a way that we
> recommend for users in their init file if they do not want to use
> customize like me)?
>
> Would it make sense to give this functions a different name if more
> often it may be used to modify existing associations in an alist instead
> of adding new ones?
Let's hear the other co-maintainers.
Stefan and Andrea, WDYT about this? Should we add this function?
next prev parent reply other threads:[~2025-01-05 15:21 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-29 5:33 bug#75170: add-to-alist: new function Roland Winkler
2024-12-29 6:34 ` Roland Winkler
2024-12-29 7:54 ` Juri Linkov
2024-12-29 14:54 ` Roland Winkler
2024-12-29 7:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-29 7:50 ` Eli Zaretskii
2024-12-29 14:50 ` Roland Winkler
2025-01-05 15:21 ` Eli Zaretskii [this message]
2025-01-18 9:33 ` Eli Zaretskii
[not found] ` <87ed0xd8t5.fsf@gmail.com>
2025-01-20 19:12 ` Roland Winkler
2025-01-20 20:41 ` Stefan Kangas
2025-01-20 21:03 ` Roland Winkler
2025-01-20 21:40 ` Stefan Kangas
2025-01-21 8:22 ` Robert Pluim
2025-01-21 9:06 ` Alfred M. Szmidt
2025-01-21 9:12 ` Stefan Kangas
2025-01-21 9:35 ` Robert Pluim
2025-01-21 10:33 ` Alfred M. Szmidt
2025-01-21 10:53 ` Robert Pluim
2025-01-21 11:34 ` Alfred M. Szmidt
2025-01-21 10:33 ` Alfred M. Szmidt
2025-01-21 10:57 ` Robert Pluim
2025-01-21 13:09 ` Alfred M. Szmidt
2025-01-21 13:09 ` Alfred M. Szmidt
2025-01-21 18:50 ` Stefan Kangas
2025-01-22 8:30 ` Robert Pluim
2025-01-22 12:38 ` Arash Esbati
2025-01-22 15:06 ` Eli Zaretskii
2025-01-22 15:50 ` Roland Winkler
2025-01-22 16:08 ` Alfred M. Szmidt
2025-01-22 21:56 ` Arash Esbati
2025-01-23 5:51 ` Alfred M. Szmidt
2025-01-21 18:47 ` Stefan Kangas
2025-01-21 19:15 ` Eli Zaretskii
2025-01-21 19:21 ` Roland Winkler
2025-01-21 19:35 ` Eli Zaretskii
2025-01-22 5:09 ` Roland Winkler
2025-01-21 19:41 ` Stefan Kangas
2025-01-21 20:30 ` Eli Zaretskii
2025-01-21 20:34 ` Stefan Kangas
2025-01-21 20:34 ` Stefan Kangas
2025-01-22 14:05 ` Eli Zaretskii
2025-01-21 20:57 ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-19 11:23 ` Stefan Kangas
2025-01-19 15:14 ` Thierry Volpiatto
2025-01-19 21:21 ` Roland Winkler
2025-01-20 0:29 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-20 0:53 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-19 2:20 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-19 6:17 ` Roland Winkler
2025-01-19 14:34 ` Roland Winkler
2025-01-19 19:35 ` Juri Linkov
2025-01-19 21:17 ` Roland Winkler
2025-01-20 0:47 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-20 1:06 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-20 3:41 ` Roland Winkler
[not found] ` <871pwxha95.fsf@web.de>
2025-01-20 19:08 ` Roland Winkler
2025-01-20 20:53 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-21 21:11 ` Stephen Gildea
2025-01-21 22:53 ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-21 23:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-22 5:09 ` Roland Winkler
2025-01-22 3:57 ` Stephen Gildea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86wmf970df.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=75170@debbugs.gnu.org \
--cc=acorallo@gnu.org \
--cc=stefankangas@gmail.com \
--cc=winkler@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).