GNU bug report logs -
#21440
25.0.50; Manual: FEATURE-unload-hook in (info "(elisp) Coding Conventions")
Previous Next
Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Wed, 9 Sep 2015 11:44:02 UTC
Severity: minor
Found in version 25.0.50
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
Stefan Kangas <stefan <at> marxist.se> writes:
Hi,
>> In (info "(elisp) Coding Conventions"):
>>
>> • If loading the file adds functions to hooks, define a function
>> ‘FEATURE-unload-hook’, where FEATURE is the name of the feature the
>> package provides, and make it undo any such changes. Using
>> ‘unload-feature’ to unload the file will run this function. *Note
>> Unloading.
>>
>> A problematic tip:
>>
>> - it is unnecessary for that reason. AFAIK FEATURE's functions are
>> removed automatically from hooks by `unload-feature'.
>>
>> - When you follow the advice, `unload-feature' will skip removing
>> entries from `auto-mode-alist', so you would have to do that yourself.
>>
>> - Isn't `FEATURE-unload-function' the preferred thing to use today?
>> The doc string of `unload-feature' doesn't even mention
>> FEATURE-unload-hook variables. Seems it is discouraged to be used.
>
> The above analysis seems correct to me. There should be no need to use
> `FEATURE-load-hook', in fact from reading `unload-feature' it seems
> worse. But I don't know too much about this, so I'm not sure if there's
> some fundamental aspect I'm overlooking.
>
> If the above is indeed true, we should probably just remove the advice
> from coding conventions. And it should be announced in NEWS, probably
> together with some warnings emitted by `unload-feature' if there is such
> a `FEATURE-unload-hook' defined.
>
> Is there anyone else who could provide some insight here?
As a test, I've renamed `tramp-unload-hook' and all
`tramp-FEATURE-unload-hook' variables to `tramp-unload-function' and
`tramp-FEATURE-unload-function', respectively. The related test,
`tramp-test45-unload', fails now. I haven't debugged further, but
throwing a warning when `FEATURE-unload-hook' is used, looks premature
to me.
> Best regards,
> Stefan Kangas
Best regards, Michael.
This bug report was last modified 3 years and 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.