bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#77609: How to add multiple functions to one hook with :hook in use-p


From: Reuben Thomas
Subject: bug#77609: How to add multiple functions to one hook with :hook in use-package?
Date: Mon, 7 Apr 2025 14:43:39 +0100

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]