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


Message #59 received at 25581 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Kangas <stefankangas <at> gmail.com>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 25581 <at> debbugs.gnu.org
Subject: RE: bug#25581: 25.1; Incorrect statement in (elisp) `Hooks'
Date: Mon, 24 Aug 2020 09:18:27 -0700 (PDT)
> I think the confusing thing here is that there are two ways to modify
> these single function hooks: setq and add-function.

`setq' can always be used to change a variable's value.
But that doesn't mean it's always the best thing to use.

See earlier posts in this thread, about variables whose
value is a "single function".  They can be hooks, but
need not be hooks (and this, regardless of their names).

Some vars are _intended_ to only ever have a single
function as their value.  Some vars are _intended_ to
have a value that can be a single function or a list of
functions.  Some of the latter kind of variables are
hooks.  (Maybe _all_ of the latter can be treated as
hooks; maybe not.)

`add-hook' is the best way to add a function to a hook.
This is so, regardless of its name.  That you can use
`setq' or something else instead doesn't make that TRT.




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.