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

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

Re: does customizing a hook "add-to" the hook?


From: gottlieb
Subject: Re: does customizing a hook "add-to" the hook?
Date: Tue, 16 Jul 2013 10:06:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

On Mon, Jul 15 2013, Michael Heerdegen wrote:

> gottlieb@nyu.edu writes:
>
>> Is it guaranteed or suggested that hook are by default empty?
>
> No, it's not a convention AFAICT.  And there are examples in the sources
> where this is not the case, although they are a minority.
>
> There are probably also cases where a user indeed wants to replace an
> element of a hook variable with another one or "delete" elements, so it
> makes some sense that hooks are not always declared empty.
>
> You have to be a bit careful.  There is no absolute guarantee
> that your customization will work in future Emacsen.  If you want a more
> finegrained control, use Lisp.  But also what you do in Lisp can be
> wrong in future Emacsen.
>
> I agree that there is a bit a disparity between the manual
> ((emacs) Hooks):
>
> |    You can set a hook variable with ‘setq’ like any other Lisp
> | variable, but the recommended way to add a function to a hook (either
> | normal or abnormal) is to use ‘add-hook’, as shown by the following
> | examples.  *Note (elisp)Hooks::, for details.
>
> and how Customize works (setting the hook variable instead of adding).

Indeed.  That disparity is exactly what triggered my question.
Thank you for clarifying.

allan



reply via email to

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