From: Michael Heerdegen <michael_heerdegen@web.de>
To: Filipp Gunbin <fgunbin@fastmail.fm>
Cc: 51620@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#51620: add-hook repeatedly adds same function into hook--depth-alist
Date: Sat, 06 Nov 2021 01:13:02 +0100 [thread overview]
Message-ID: <87r1buf8fl.fsf@web.de> (raw)
In-Reply-To: <m2wnlmi3pz.fsf@fastmail.fm> (Filipp Gunbin's message of "Sat, 06 Nov 2021 02:26:32 +0300")
Filipp Gunbin <fgunbin@fastmail.fm> writes:
> diff --git a/lisp/subr.el b/lisp/subr.el
> index 8ff403e113..2b8b6deeb0 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -1868,7 +1868,7 @@ add-hook
> (when (or (get hook 'hook--depth-alist) (not (zerop depth)))
> ;; Note: The main purpose of the above `when' test is to avoid running
> ;; this `setf' before `gv' is loaded during bootstrap.
> - (push (cons function depth) (get hook 'hook--depth-alist)))
> + (setf (alist-get function (get hook 'hook--depth-alist) 0) depth))
> (setq hook-value
> (if (< 0 depth)
> (append hook-value (list function))
So the function would still be compared using `eq' but we would avoid to
add dups of equal conses? Looks reasonable to me -- Stefan?
TIA,
Michael.
next prev parent reply other threads:[~2021-11-06 0:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 23:26 bug#51620: add-hook repeatedly adds same function into hook--depth-alist Filipp Gunbin
2021-11-06 0:13 ` Michael Heerdegen [this message]
2021-11-06 20:31 ` Filipp Gunbin
2021-11-11 16:55 ` bug#51620: control message for bug #51620 Filipp Gunbin
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=87r1buf8fl.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=51620@debbugs.gnu.org \
--cc=fgunbin@fastmail.fm \
--cc=monnier@iro.umontreal.ca \
/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).