Emacs functions for setting multiple hooks.
Typically, you would need to call
add-hook multiple times with
similar arguments to declare multiple functions for one hook, or
add-hooks-pair is a variant that takes multiple
hooks or functions that apply to each other. The
function tidies up duplicate hook and function names further into a
single declarative call (inspired by the
(add-hooks-pair HOOKS FUNCTIONS)
add-hook for each combined pair of items in HOOKS and FUNCTIONS.
HOOKS can be a symbol or a list of symbols representing hook
-hook suffix is implied). FUNCTIONS can be a
symbol, a lambda, or a list of either representing hook
functions. If lists are used, a function can be added to
multiple hooks and/or multiple functions can be added to a hook.
ELISP> (add-hooks-pair '(css-mode sgml-mode) 'emmet-mode) nil ELISP> css-mode-hook (emmet-mode) ELISP> sgml-mode-hook (emmet-mode)
add-hooks-pair on each cons pair in PAIRS.
Each pair has a
car for setting hooks and a
cdr for setting
functions to add to those hooks. Pair values are passed to the
HOOKS and FUNCTIONS arguments of
(add-hooks ((HOOKS . FUNCTIONS)...))
ELISP> (add-hooks '(((css-mode sgml-mode) . emmet-mode))) nil ELISP> css-mode-hook (emmet-mode) ELISP> sgml-mode-hook (emmet-mode)