Subject: bug#77609: closed (Re: bug#77609: How to add multiple functions to one hook with :hook in use-package?)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 24 May 2025 09:59:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77609: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77609
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#77609: How to add multiple functions to one hook with :hook in use-package?
From: Eli Zaretskii <[email-masked]>
To: John Wiegley <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sat, 24 May 2025 12:58:10 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: John Wiegley <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Wed, 21 May 2025 23:20:32 -0700
> 
> >>>>> Eli Zaretskii <[email-masked]> writes:
> 
> > Ping! How can we make any further progress here?
> 
> So, I dug into ‘use-package-normalize/:hook’ to see how hard it would be and…
> it’s unreasonably hard. Accepting a list of functions in this way is just not
> something the code was designed to do in its current form.
> 
> So rather than risk breaking lots of things, I think the user just has to
> expand:
> 
>   :hook (foo a b)
>   :hook (foo . (a b))
> 
> into
> 
>   :hook
>   (foo . a)
>   (foo . b)

Thanks, I've now updated the manual with this information, and I'm
therefore closing this bug.

Subject: How to add multiple functions to one hook with :hook in use-package?
From: Reuben Thomas <[email-masked]>
To: bug-emacs <[email-masked]>
Date: Mon, 7 Apr 2025 14:43:39 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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