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: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 25581 <at> debbugs.gnu.org
Subject: bug#25581: 25.1; Incorrect statement in (elisp) `Hooks'
Date: Mon, 24 Aug 2020 17:22:23 +0200
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.

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 <rgm <at> gnu.org>
AuthorDate: Thu Sep 6 04:25:08 2007 +0000
Commit:     Glenn Morris <rgm <at> gnu.org>
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




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.