GNU bug report logs - #47992
27; 28; Phase out use of `equal` in `add-hook`, `remove-hook`

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sat, 24 Apr 2021 12:12:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Daniel Mendler <mail <at> daniel-mendler.de>, "jakanakaevangeli <at> chiru.no" <jakanakaevangeli <at> chiru.no>, "47992 <at> debbugs.gnu.org" <47992 <at> debbugs.gnu.org>
Subject: bug#47992: [External] : bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook`
Date: Sat, 24 Apr 2021 18:30:05 -0400
> So instead of just advising users not to use lambda forms
> (which makes sense), you'd make it no longer work at all
> for interpreted lambda forms (except rare cases where
> they might actually be `eq' - e.g., same list structure)?

It would still work for lambda forms, just differently (arguably, in
a way that's more often right than the current way).

> Perhaps `equal' can be fixed to do something better with closures?

There's no magic: `equal` has to check the structural equality, so it
has to recurse through the whole structure, including all the
closed-over variables to which it refers.

> E.g., if the `eq' test in `equal' fails for a
> closure arg then return nil?  (I'm not proposing that.)

That's what using `eq` would do, so you seem to agree with
Daniel's proposal here.

> And Stefan says, there:
>
> "IOW I think the better fix is to change
> `minibuffer-with-setup-hook` to use an indirection
> via a symbol."

That was written in the context of a fix that needs to work *now*,
whereas changing `add/remove-hook` to use `eq` tests can at best be
a longer term goal.


        Stefan





This bug report was last modified 3 years and 323 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.