GNU bug report logs -
#25581
25.1; Incorrect statement in (elisp) `Hooks'
Previous Next
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
Lars Ingebrigtsen <larsi <at> gnus.org> 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.
I'm not sure the above makes sense. Doesn't it usually work like:
(setq foo-function 'message)
(add-hook 'foo-function 'error) ; should work?
(funcall foo-function) ; => Lisp error: (invalid-function (error message))
> Well, the name -function suggests that you shouldn't.
>
> I think the confusing thing here is that foo-function isn't a hook at
> all -- variables ending with -function are normally not executed with
> run-hooks at all, so using add-hook on such a variable will normally
> break.
>
> So I'm not sure what that section is doing in the Hooks node at all. It
> origin starts here, where unfortunately vc-region-history gives up.
>
> My preference here would be just to remove the paragraph, which is
> pretty confusing.
It sort of makes sense when read next to the paragraph before, doesn't
it? There the concept "abnormal hook" is defined with an explanation of
variables ending in '-functions', and the paragraph about variables
ending in '-function' is written mostly in contrast to that.
I think the confusing thing here is that there are two ways to modify
these single function hooks: setq and add-function.
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.