[Top][All Lists]

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

Re: the ...-unload-hook convention doesn't work

From: Dave Love
Subject: Re: the ...-unload-hook convention doesn't work
Date: Tue, 06 Jan 2004 14:33:04 +0000
User-agent: Gnus/5.1005 (Gnus v5.10.5) Emacs/21.2 (gnu/linux)

Luc Teirlinck <address@hidden> writes:

> It now is supposed to be a normal hook.  From (elisp)Unloading:
>      If `FEATURE-unload-hook' is defined, it is run as a normal hook
>      before restoring the previous definitions, _instead of_ the usual
>      hook-removing actions.

I can't check the history now, but if it's been changed it hasn't been
done properly.  All the examples in Emacs are simple defuns.

(I suspect various files which need the hook are missing it.  I've
previously updated them when I've noticed, but apparently not tested
the results properly.)

Granted, the naming `-hook' when it isn't a normal hook was wrong, but
the idea was to only need to define a function, not a function plus a
variable.  I think such usage should be supported in addition to a
normal hook.

> But how could this have broken things?  `run-hooks' is supposed to be
> able to handle a single function instead of a list, so there should be
> no problems with compatibility in as far as line 143 is concerned.

I think you misunderstand.

  (defun foo-func ()
    (setq foo 'run))
  (let ((foo 'not-run))
    (run-hooks 'foo-func)
  => not-run

> Are there concrete examples of problems arising from either defining
> FEATURE-unload-hook as a function (even though, according to the Elisp
> manual, this is now considered obsolete) or defining it as a normal
> hook?

Yes -- as I said, the mechanism doesn't work.  You can end up with an
unusable Emacs if you unload some things.

reply via email to

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