Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode

From: Juanma Barranquero <[email-masked]>
Date: Sun, 3 Jan 2010 01:24:58 +0100

On Sun, Jan 3, 2010 at 00:58, Kevin Ryde <[email-masked]> wrote:

> It seems unlikely a minor mode can do anything much good when its
> functions have been unloaded.  Some "static" effects might be ok,

That is the point. The writer of the mode knows better. I'm not saying
that you're not right in this, only that there could be downsides.

>> FOO-unload-hook is
>
> ... a flexible way for unrelated libraries, macros or bits of code to
> undo things they know about, even different conditionalized parts of one
> .el like in tramp-util.el.

Yeah, well, that and also, it never really worked. You seem to think
that FOO-unload-hook is a hook run while executing `unload-feature'.
In fact, is a hook run *instead* of some other code. The very act of
defining FOO-unload-hook has unexpected consequences: `unlead-feature'
won't remove FOO functions from hooks, nor from `auto-mode-alist'. And
it was always so; that's why I pushed for introducing
FOO-unload-function.

> A kind of inverse to eval-after-load,
> difficult to arrange on a monolithic unload func.

In general, a package is the place where the knowledge about its
unloading should be concentrated, IMO. If you want to piggyback onto
it, there are several ways, like advising FOO-unload-function, if it
is defined, or `unload-feature', etc. There's nothing "difficult to
arrange".

If you want to have an inverse to eval-after-load, I'd suggest you
propose a new hook, unload-feature-functions (not FOO-specific).

    Juanma