[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34708: Thanks
From: |
Michael Heerdegen |
Subject: |
bug#34708: Thanks |
Date: |
Fri, 19 Apr 2019 06:18:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
"Miguel V. S. Frasson" <mvsfrasson@gmail.com> writes:
> I learned a from this discussion, specially about how to use
> alist-get. The only missing lesson was how to remove association of a
> key from alist using setf and alist-get.
>
> Could someone give a quick example?
The modified docstring of alist-get has now an example. It says:
[...]
When using it to set a value, optional argument REMOVE non-nil
means to remove KEY from ALIST if the new value is `eql' to
DEFAULT (more precisely the first found association will be
deleted from the alist).
Example:
(setq foo '((a . 1) (b . 2)))
(setf (alist-get 'b foo nil 'remove) nil)
foo => ((a . 1))
Does this suffice?
BTW, it doesn't say you have to use this feature. If you find it
confusing, use delq+assoc+setq, or alternatively, what map.el provides.
Regards,
Michael.
- bug#34708: Thanks, Miguel V. S. Frasson, 2019/04/18
- bug#34708: Thanks,
Michael Heerdegen <=