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

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 24 Aug 2020 17:22:23 +0200

Drew Adams <[email-masked]> 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.

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.

commit b8d4c8d0e9326f8ed2d1f6fc0a38fb89ec29ed27
Author:     Glenn Morris <[email-masked]>
AuthorDate: Thu Sep 6 04:25:08 2007 +0000
Commit:     Glenn Morris <[email-masked]>
CommitDate: Thu Sep 6 04:25:08 2007 +0000

    Move here from ../../lispref

diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
--- /dev/null
+++ b/doc/lispref/modes.texi
@@ -0,0 +76,3 @@
+  By convention, abnormal hook names end in @samp{-functions} or
+@samp{-hooks}.  If the variable's name ends in @samp{-function}, then
+its value is just a single function, not a list of functions.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no