+2014-02-28 Xue Fuqiao <xfq@gnu.org>
+
+ * elisp.texi (Top):
+ * commands.texi (Generic Commands):
+ (Defining Commands): Document `define-alternatives'.
+
2014-02-27 Xue Fuqiao <xfq@gnu.org>
* windows.texi (Window Sizes): Document `window-size'.
* Interactive Codes:: The standard letter-codes for reading arguments
in various ways.
* Interactive Examples:: Examples of how to read interactive arguments.
+* Generic Commands:: Select among command alternatives.
@end menu
@node Using Interactive
@end group
@end example
+@node Generic Commands
+@subsection Select among Command Alternatives
+@cindex generic commands
+@cindex alternatives, defining
+
+The macro @code{define-alternatives} can be used to define
+@dfn{generic commands}. Generic commands are interactive functions
+whose implementation can be selected among several alternatives, as a
+matter of user preference.
+
+@defmac define-alternatives command &rest customizations
+Define the new command `COMMAND'.
+
+The argument `COMMAND' should be a symbol.
+
+When a user runs @kbd{M-x COMMAND @key{RET}} for the first time, Emacs
+will prompt for which alternative to use and record the selected
+command as a custom variable.
+
+Running @kbd{C-u M-x COMMAND @key{RET}} prompts again for an
+alternative and overwrites the previous choice.
+
+The variable @code{COMMAND-alternatives} contains an alist
+(@pxref{Association Lists}) with alternative implementations of
+`COMMAND'. @code{define-alternatives} does not have any effect until
+this variable is set.
+
+If @var{customizations} is non-@var{nil}, it should be composed of
+alternating @code{defcustom} keywords and values to add to the
+declaration of @code{COMMAND-alternatives} (typically :group and
+:version).
+@end defmac
+
@node Interactive Call
@section Interactive Call
@cindex interactive call
+++
** Octave mode
-*** Font locking for texinfo comments and new keywords.
+*** Font locking for Texinfo comments and new keywords.
*** Completion in Octave file buffers.
+++
** New functions `special-form-p' and `macrop'.
++++
** New macro `define-alternatives' can be used to define generic commands.
Generic commands are interactive functions whose implementation can be
selected among several alternatives, as a matter of user preference.