[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] gv.el: minor change, cleaning up
From: |
Stefan Monnier |
Subject: |
Re: [PATCH] gv.el: minor change, cleaning up |
Date: |
Wed, 16 Jun 2021 09:03:01 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> Evaluate `(macroexpand-all `(setf (alist-get key alist) value))` and
> it returns the following:
>
> (let* () ;; /* bindings omitted */
> (progn
> (if p
> (setcdr p v)
> (setq alist
> (cons (setq p
> (cons key v))
> alist)))
> v))
>
> It seems to me that `(setq p ..)` is unnecessary,
It's unnecessary for `setf` (and `push`, and `cl-pushnew`, and
`cl-rotatef`, and `cl-callf` ;-) but it can be necessary for more
complex settings. I can't remember what was the setting where I found
that I needed it, sadly. Clearly it must be one where we use the getter
(or the setter) after having used the setter.
Stefan