GNU bug report logs - #25581
25.1; Incorrect statement in (elisp) `Hooks'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Mon, 30 Jan 2017 16:52:02 UTC

Severity: minor

Tags: fixed

Found in version 25.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mark Oteiza <mvoteiza <at> udel.edu>
To: npostavs <at> users.sourceforge.net
Cc: 25581 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: bug#25581: 25.1; Incorrect statement in (elisp) `Hooks'
Date: Mon, 30 Jan 2017 22:36:51 -0500
npostavs <at> users.sourceforge.net writes:

> Drew Adams <drew.adams <at> oracle.com> 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
> -@code{add-function} 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.




This bug report was last modified 4 years and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.