bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Juanma Barranquero
Subject: bug#5293: 23.1; unload-feature on buffer-local hooks
Date: Tue, 7 Apr 2020 01:01:55 +0200


On Mon, Apr 6, 2020 at 11:27 PM Štěpán Němec <stepnem@gmail.com> wrote:

> 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.

Some minor modes are designed to be put in a few hooks, so these can be
checked by the package itself. But you're right that there are occasions where
the automatic mechanisms are necessary.

> 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.

In these cases, I would consider any problem unloading the library as a
reportable bug. One good thing of FEATURE-unload-function is that it is
totally backwards-compatible. Any library can define such a function and
does not need to worry about being run in older Emacsen.

> 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
> them).

Well, I think what happens is that many package developers just don't
think at all about the package being unloaded. Truth be told, I'm not sure
unload-feature is used that often. I spent some effort in making it work
with the libraries included in the Emacs distribution, but I think I've used
unload-feature myself perhaps a couple of times, other than when testing it.

> I don't know what you mean by "hands off" here,

I meant the case where the package maintainer isn't willing to make the
effort to add FEATURE-unload-function.

> 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.

Well, I'm not against making unload-feature work better, if at all possible.
It's just that I see as an imperfect solution because the knowledge to
unload a package is, mostly, in the package author's hands. It's
somewhat of a waste to have to second-guess them.


reply via email to

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