[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34686: 26.1; unload-feature doesn't remove functions locally from ho
From: |
Robert Pluim |
Subject: |
bug#34686: 26.1; unload-feature doesn't remove functions locally from hooks |
Date: |
Thu, 28 Feb 2019 20:03:44 +0100 |
Eli Zaretskii <eliz@gnu.org> writes:
>> Expectation: Emacs starts up with no error.
>> (`unload-feature' should remove `test-function' from `test-hook' as
>> documented, so `(run-hooks 'test-hook)' should be a no-op.)
>
> Where do you see it documented that the hook should be removed? All I
> see is this:
>
> Standard unloading activities include restoring old autoloads for
> functions defined by the library, undoing any additions that the
> library has made to hook variables or to ‘auto-mode-alist’[...]
>
> This says that hooks are removed if they were added by the library
> being unloaded. But in your example, the hook was not added by
> test-unload.el, it was added by test.el, a different library.
In "(elisp) Unloading" it says:
Before restoring the previous definitions, ‘unload-feature’ runs
‘remove-hook’ to remove functions in the library from certain
hooks. These hooks include variables whose names end in ‘-hook’
(or the deprecated suffix ‘-hooks’), plus those listed in
‘unload-feature-special-hooks’, as well as ‘auto-mode-alist’. This
is to prevent Emacs from ceasing to function because important
hooks refer to functions that are no longer defined.
and a quick look at the code confirms that it at least *tries* to do
that.
Robert