GNU bug report logs - #77609
How to add multiple functions to one hook with :hook in use-package?

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Mon, 7 Apr 2025 13:46:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


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

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-emacs <bug-emacs <at> gnu.org>
Subject: How to add multiple functions to one hook with :hook in use-package?
Date: Mon, 7 Apr 2025 14:43:39 +0100
[Message part 1 (text/plain, inline)]
The manual says:

The @code{:hook} keyword allows adding functions to hooks.  It takes
@c FIXME: The actual forms accepted by :hook are different, see below!
one argument of the form @var{hooks}, specifying one or more functions
to add to one or more hooks.


The FIXME suggests that the documentation may be incorrect!

I am precisely trying to add multiple functions to one hook, and I can't
work out how to do it with a single :hook clause. Is this in fact possible?
The most obvious syntax, copying the syntax for adding a function to
multiple hooks, does not work, e.g.:

(use-package foo-mode
  :hook
  (foo-mode . (function-a function-b)))

I tried other things, and searching online, and even looking at the source
code for use-package, but I can't work it out. Hence, maybe a good chance
to fix this FIXME in the docs, and explain to users how this is done, or
state that it cannot be done, and you have to use another method to add
multiple functions to a hook.

I have to say, use-package (which I have only now looked at) is a
revelation!

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

This bug report was last modified 22 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.