From: npostavs@users.sourceforge.net
To: Drew Adams <drew.adams@oracle.com>
Cc: 25581@debbugs.gnu.org
Subject: bug#25581: 25.1; Incorrect statement in (elisp) `Hooks'
Date: Mon, 30 Jan 2017 23:16:32 -0500 [thread overview]
Message-ID: <87efzjrhi7.fsf@users.sourceforge.net> (raw)
In-Reply-To: <4218ccf3-da3c-43e3-9901-183e4ec81f71@default> (Drew Adams's message of "Mon, 30 Jan 2017 19:55:23 -0800 (PST)")
Drew Adams <drew.adams@oracle.com> writes:
>>
>> 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}
>> +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}).
>
> Not in my opinion. The fact that it automatically turns the
> value into a list is a _feature_, not something to avoid.
Perhaps an example would help clarify things:
emacs -Q
M-: (add-hook 'blink-paren-function #'ignore) RET
insert "()"
blink-paren-post-self-insert-function: Invalid function: (ignore blink-matching-open)
In my opinion, such errors (triggered by putting a list where a function
was wanted) are something to avoid.
> Yes, it is true that there are "single-function" hooks
> (hooks that happen to have only one function at the
> moment) and "single-function" hooks (hooks that are
> designed/expected to only ever have a single function,
> never zero or more than one). And yes, the current
> wording is a bit ambiguous in this regard.
IMO the current wording is pretty unambiguous that a variable ending in
"-function" should be a single function and not a list. But if you feel
differently, please suggest an alternate wording.
>
> And such code should also _document_ this (exceptional)
> need for its hook to have only a single function.
From a quick look at M-x apropos-variable RET .*-function$ RET, every
such variable is described as "a function" or "function" which is
clearly not a list of functions.
next prev parent reply other threads:[~2017-01-31 4:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 16:51 bug#25581: 25.1; Incorrect statement in (elisp) `Hooks' Drew Adams
2017-01-31 3:05 ` npostavs
2017-01-31 3:36 ` Mark Oteiza
2017-01-31 4:06 ` Drew Adams
2017-01-31 3:55 ` Drew Adams
2017-01-31 4:16 ` npostavs [this message]
2017-01-31 16:02 ` Drew Adams
2017-02-01 3:35 ` npostavs
2017-02-01 17:01 ` Drew Adams
2017-02-04 21:00 ` npostavs
2017-02-05 2:11 ` Drew Adams
2017-02-10 1:42 ` npostavs
2017-02-10 3:00 ` Drew Adams
2020-10-11 2:26 ` Lars Ingebrigtsen
2020-10-11 14:12 ` Drew Adams
2020-08-24 15:22 ` Lars Ingebrigtsen
2020-08-24 15:54 ` Stefan Kangas
2020-08-24 15:58 ` Lars Ingebrigtsen
2020-08-24 16:20 ` Drew Adams
2020-08-24 16:13 ` Drew Adams
2020-08-24 16:18 ` Drew Adams
2020-08-26 1:50 ` Richard Stallman
2020-08-26 18:27 ` Drew Adams
2020-08-24 16:01 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87efzjrhi7.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=25581@debbugs.gnu.org \
--cc=drew.adams@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).