Subject: Re: 27.1; Hooks with permanent-local-hook are not cleared of lambdas

From: jakanakaevangeli <[email-masked]>
Date: Tue, 09 Feb 2021 22:38:49 +0100

Also one more thing:

    (defvar some-hook nil)
    (add-hook 'some-hook #'some-fun nil t)
    (put 'some-fun 'permanent-local-hook t)

If we mark a function as permanent-local-hook only after adding it to a
hook, the hook symbol will not have its permanent-local property set to
'permanent-local-hook, so some-fun will not be kept on removal of local
variables.

This can be a real non-theoretical problem when adding an autoloaded
function to a hook.