]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix documentation of use-package's ':hook' keyword
authorEli Zaretskii <eliz@gnu.org>
Sat, 24 May 2025 09:56:30 +0000 (12:56 +0300)
committerEshel Yaron <me@eshelyaron.com>
Tue, 27 May 2025 14:32:16 +0000 (16:32 +0200)
* doc/misc/use-package.texi (Hooks): Document how to add several
functions to the same hook (bug#77609).

(cherry picked from commit 36afdd2f6f9f6bbb6bcc95ff2fb1e426c0bcdb3d)

doc/misc/use-package.texi

index 582cc9ab22645461b430292583587a3a4f92b922..dd70a7d33a110bb2dda5aa8a0b4ffc61196ac458 100644 (file)
@@ -1210,8 +1210,7 @@ keybindings you've set using either the @code{:bind} keyword or the
 @cindex hooks
 @findex :hook
 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
+one argument of the form @var{hooks}, specifying  or more functions
 to add to one or more hooks.  For the purposes of @code{:hook}, the
 name of hook variables should always exclude the @samp{-hook} suffix.
 It is appended automatically for you, to save some typing.
@@ -1284,6 +1283,17 @@ applied, the following examples are all equivalent:
 @end group
 @end lisp
 
+To add more than one function to the same hook, add them separately,
+like this:
+
+@lisp
+@group
+(use-package company
+  :hook ((prog-mode . company-mode)
+         (prog-mode . some-other-function)))
+@end group
+@end lisp
+
 One common mistake when using @code{:hook} is to forget to omit the
 @samp{-hook} suffix, which, as already explained, is appended
 automatically.  Therefore, the following will not work, as it attempts