Fix documentation of use-package's ':hook' keyword
* doc/misc/use-package.texi (Hooks): Document how to add several functions to the same hook (bug#77609).
This commit is contained in:
@@ -1191,8 +1191,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.
|
||||
@@ -1265,6 +1264,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
|
||||
|
||||
Reference in New Issue
Block a user