bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Daniel Mendler
Subject: bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook`
Date: Sat, 24 Apr 2021 14:11:48 +0200

(Follow-up to bug#46326 as suggested by Stefan Monnier)

The functions `add/remove-hook` make use of `equal` to test equality of hooks. Using `equal` can lead to excessive memory allocations (bug#46326) or hangups (see comment in `set-transient-map`), when large closures or cyclic closures are used as hooks.

Right now there are at least three places which have to work around the use of `equal` in `add/remove-hook` using a symbol indirection:

* `set-transient-map`
* `minibuffer-with-setup-hook`
* `eval-after-load`

It would be good to change `add/remove-hook` such that it only relies on `eq` to test hook equality. Then the symbol indirection workarounds can be avoided.

However making such a change directly can lead to subtle breakage. Perhaps one could introduce some deprecation behavior first, before making the final change to `eq`. If a hook is added/removed and the added/removed object is not found via `eq` but found via `equal`, show a deprecation warning?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]