Subject: Re: bug#75170: add-to-alist: new function

From: Thierry Volpiatto <[email-masked]>
Date: Mon, 20 Jan 2025 07:32:17 +0000

Roland Winkler <[email-masked]> writes:

> On Sun, Jan 19 2025, Thierry Volpiatto wrote:
>> While you are at it why not implementing a add-to-(a)list function that
>> add/remove an elemnt at INDEX in list?
>> It is what I am providing for my users in Helm.
>>
>> (setq example '((a . 1) (b . 6) (c . 3) (d . 4)))
>>
>> (helm-add-to-list 'example '(b . 2) 1 'replace)
>>
>> =>((a . 1) (b . 2) (c . 3) (d . 4))
>
> I am just curious: when can this be useful?  Off my head, I cannot think
> of any alists (alists that users my want to modify in their init file)
> where order matters.

Here mainly for helm actions, but I guess there is other use cases.
It is not very hard to implement, so it is a nice extra feature to have IMHO.

-- 
Thierry