summaryrefslogtreecommitdiff
path: root/devdocs/elisp/running-hooks.html
blob: 0bbd9e77cb4c771523e447e22f2bde7b144753fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 <h4 class="subsection">Running Hooks</h4> <p>In this section, we document the <code>run-hooks</code> function, which is used to run a normal hook. We also document the functions for running various kinds of abnormal hooks. </p> <dl> <dt id="run-hooks">Function: <strong>run-hooks</strong> <em>&amp;rest hookvars</em>
</dt> <dd>
<p>This function takes one or more normal hook variable names as arguments, and runs each hook in turn. Each argument should be a symbol that is a normal hook variable. These arguments are processed in the order specified. </p> <p>If a hook variable has a non-<code>nil</code> value, that value should be a list of functions. <code>run-hooks</code> calls all the functions, one by one, with no arguments. </p> <p>The hook variable’s value can also be a single function—either a lambda expression or a symbol with a function definition—which <code>run-hooks</code> calls. But this usage is obsolete. </p> <p>If the hook variable is buffer-local, the buffer-local variable will be used instead of the global variable. However, if the buffer-local variable contains the element <code>t</code>, the global hook variable will be run as well. </p>
</dd>
</dl> <dl> <dt id="run-hook-with-args">Function: <strong>run-hook-with-args</strong> <em>hook &amp;rest args</em>
</dt> <dd><p>This function runs an abnormal hook by calling all the hook functions in <var>hook</var>, passing each one the arguments <var>args</var>. </p></dd>
</dl> <dl> <dt id="run-hook-with-args-until-failure">Function: <strong>run-hook-with-args-until-failure</strong> <em>hook &amp;rest args</em>
</dt> <dd><p>This function runs an abnormal hook by calling each hook function in turn, stopping if one of them fails by returning <code>nil</code>. Each hook function is passed the arguments <var>args</var>. If this function stops because one of the hook functions fails, it returns <code>nil</code>; otherwise it returns a non-<code>nil</code> value. </p></dd>
</dl> <dl> <dt id="run-hook-with-args-until-success">Function: <strong>run-hook-with-args-until-success</strong> <em>hook &amp;rest args</em>
</dt> <dd><p>This function runs an abnormal hook by calling each hook function, stopping if one of them succeeds by returning a non-<code>nil</code> value. Each hook function is passed the arguments <var>args</var>. If this function stops because one of the hook functions returns a non-<code>nil</code> value, it returns that value; otherwise it returns <code>nil</code>. </p></dd>
</dl><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Running-Hooks.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Running-Hooks.html</a>
  </p>
</div>