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

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

bug#25581: 25.1; Incorrect statement in (elisp) `Hooks'


From: Mark Oteiza
Subject: bug#25581: 25.1; Incorrect statement in (elisp) `Hooks'
Date: Mon, 30 Jan 2017 22:36:51 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

address@hidden writes:

> Drew Adams <address@hidden> writes:
>
>> The second sentence here is incorrect:
>>
>>  If the variable’s name ends in ‘-function’, then its value is just a
>>  single function, not a list of functions.  ‘add-hook’ cannot be used to
>>  modify such a _single function hook_, and you have to use ‘add-function’
>>  instead (*note Advising Functions::).
>>
>> You CAN use `add-hook' to modify such a single-function hook.
>> Nothing prevents you from doing so.  And nothing even suggests
>> that you should not.  And you have always been able to do so.
>>
>> And this is the case whether or not the "single function hook"
>> is intended to always be single-function (which intention
>> AFAIK, is not enforced anywhere) or it is intended to have
>> any number (including zero and one) of functions.
>
> So something like this?
>
> --- i/doc/lispref/modes.texi
> +++ w/doc/lispref/modes.texi
> @@ -74,9 +74,10 @@ Hooks
>  
>  @cindex single-function hook
>  If the variable's name ends in @samp{-function}, then its value is
> -just a single function, not a list of functions.  @code{add-hook} cannot be
> -used to modify such a @emph{single function hook}, and you have to use
> address@hidden instead (@pxref{Advising Functions}).
> +just a single function, not a list of functions.  @code{add-hook}
> +should not be used to modify such a @emph{single function hook}
> +because it would turn the value into a list.  Use @code{add-function}
> +instead (@pxref{Advising Functions}).

Better, but the typical practice of setq'ing to another named
function should be mentioned before advice.





reply via email to

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