summaryrefslogtreecommitdiff
path: root/devdocs/elisp/generic-commands.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/generic-commands.html
new repository
Diffstat (limited to 'devdocs/elisp/generic-commands.html')
-rw-r--r--devdocs/elisp/generic-commands.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/devdocs/elisp/generic-commands.html b/devdocs/elisp/generic-commands.html
new file mode 100644
index 00000000..dd265cf7
--- /dev/null
+++ b/devdocs/elisp/generic-commands.html
@@ -0,0 +1,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 &amp;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 &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/Generic-Commands.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Generic-Commands.html</a>
+ </p>
+</div>