[Top][All Lists]

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

bug#5293: 23.1; unload-feature on buffer-local hooks

From: Štěpán Němec
Subject: bug#5293: 23.1; unload-feature on buffer-local hooks
Date: Mon, 06 Apr 2020 23:27:55 +0200
User-agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu)

On Mon, 06 Apr 2020 22:39:50 +0200
Juanma Barranquero wrote:

> On Mon, Apr 6, 2020 at 7:24 PM Štěpán Němec <stepnem@gmail.com> wrote:
>> Actually, I wonder if ignoring even the global hooks (as opined by
>> Juanma) and enforcing more widespread usage of FEATURE-unload-function
>> wouldn't be better;
> Anything automatically done in the unload-hook is just an ad hoc fix
> for things the module author knows how to do better than us.

One common scenario where this doesn't quite hold IIUC is minor modes
which users are supposed to put on various hooks themselves: the library
author has no way of dealing with that, short of doing something like
`unload-feature' does, although checking for just a few known symbols
from an unload function instead of the brute-force approach of the
latter would arguably be more effective.

> FEATURE-unload-function has already been there for a few years. I
> don't remember right now whether we suggest in the mode-creation
> documentation to use it,

We do (lispref/tips.texi). Unfortunately, most elisp libraries in the
wild seem to be written by people who either haven't read it, or have
remained resistent to most of its edificatory influence.

> but certainly that's something module authors should do, and the
> automatic unloading is just a last-resort feature for those old
> modules that don't.

Actually, IME the older, the better behaved. I can't remember last time
I saw a newish package with an unload function (while I do remember
those without one which left my Emacs broken when I tried unloading

> There's no point IMHO to make the hands off approach work better.

I don't know what you mean by "hands off" here, but in any case, while I
used to argue for handling as much as possible in `unload-feature',
these days I don't feel strongly about it. So even though this
particular issue (local hooks) does seem solvable (thanks again to
Stefan!) without making anything much worse or uglier than it already
is, I remain of two minds on whether it is the best thing to do or not.


reply via email to

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