blob: dd265cf754bcde6ec21dcfc13b986c0bba50178d (
plain)
1
2
3
4
5
6
7
8
9
10
|
<h4 class="subsection">Select among Command Alternatives</h4> <p>The macro <code>define-alternatives</code> can be used to define <em>generic commands</em>. These are interactive functions whose implementation can be selected from several alternatives, as a matter of user preference. </p> <dl> <dt id="define-alternatives">Macro: <strong>define-alternatives</strong> <em>command &rest customizations</em>
</dt> <dd>
<p>Define the new command <var>command</var>, a symbol. </p> <p>When a user runs <kbd>M-x <var>command</var> <span class="key">RET</span></kbd> for the first time, Emacs prompts for which real form of the command to use, and records the selection by way of a custom variable. Using a prefix argument repeats this process of choosing an alternative. </p> <p>The variable <code><var>command</var>-alternatives</code> should contain an alist with alternative implementations of <var>command</var>. Until this variable is set, <code>define-alternatives</code> has no effect. </p> <p>If <var>customizations</var> is non-<code>nil</code>, it should consist of alternating <code>defcustom</code> keywords (typically <code>:group</code> and <code>:version</code>) and values to add to the declaration of <code><var>command</var>-alternatives</code>. </p>
</dd>
</dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 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/Generic-Commands.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Generic-Commands.html</a>
</p>
</div>
|