Subject: bug#46407: 27.1; Hooks with permanent-local-hook are not cleared of lambdas

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 25 May 2021 21:10:04 +0200

<[email-masked]> writes:

> On the other hand, this side effect is so undocumented and
> undiscoverable (and most probably not really of any use as well), that I
> highly doubt there is even a single instance of anyone relying in it
> deliberately. I may be wrong though.

Yeah, that's the problem -- it's hard to say whether anybody relies on
this weird behaviour.

There are no in-tree usages of permanent-local-hook at all as far as I
can see, so I wondered whether is was used at all:

https://github.com/search?q=permanent-local-hook+extension%3A.el&type=Code&ref=advsearch&l=&l=

And the answer is yes.  (But that doesn't tell us if anybody relies on
the non-symbol behaviour, though.)

> I'm personally in favour of fixing the `kill-all-local-variables'
> inconsistency (patch follows).
>
> If not, then yes, we should document it in add-hook and fix the info
> node I mentioned. Though that would leave virtually every local addition
> of a lambda to a hook invalid and a possible bug (a quick grep reveals
> that there are at least three such usages in Emacs itself).

I'm leaning towards applying your patch (i.e., changing the behaviour as
you suggest), because it's somewhat difficult to imagine anybody relying
on the current, odd behaviour.

Does anybody object?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no