emacs-devel
[Top][All Lists]
Advanced

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

Re: unload-feature questions and thoughts


From: Juanma Barranquero
Subject: Re: unload-feature questions and thoughts
Date: Wed, 10 Oct 2007 13:04:23 +0200

On 2/5/07, Juanma Barranquero <address@hidden> wrote:

> I misread the code (I was much more centered in the part about undoing
> defun, provide, etc. and didn't take a closer look to the beginning of
> the function), but I think this piece of docstring is a bit confusing
>
>   This function tries to undo modifications made by the package to
>   hooks.  Packages may define a hook FEATURE-unload-hook that is called
>   instead of the normal heuristics for doing this.  Such a hook should
>   undo all the relevant global state changes that may have been made by
>   loading the package or executing functions in it.
>
> because if you miss the "to hooks" (two words), as I did in several
> readings, it seems like it is saying that either you define
> FEATURE-unload-hook, or else it uses "the normal heuristics".

Eight months later, I had forgotten this thread and I *again* misread
both the code and the docstring. :(

So, could someone with good English skills please reword
unload-feature's docstring to clarify what it does and what purpose
FEATURE-unload-hook does serve?

Related to this: I'm still unsatisfied with FEATURE-unload-hook. It is
not useful enough when you want do undo other kind of changes. For
example, currently follow.el can not be correctly unloaded because it
uses tons of advices. It is possible to define a follow-unload-hook to
undo the advices, but then it has to take care of removing functions
from hooks, too.

Some packages with a global effect, like server.el or msb.el, run
(MODE -1) in the FEATURE-unload-hook to disable the hooks, and then do
the additional cleanup; but this is less practical for non-global
modes like follow-mode.

All in all, I think it'd be useful to have a FEATURE-unload-function
which would return t or nil to signal whether it has done everything,
or would like for unload-feature to continue with its normal
processing.

             Juanma




reply via email to

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