From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/using-interactive.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 devdocs/elisp/using-interactive.html (limited to 'devdocs/elisp/using-interactive.html') diff --git a/devdocs/elisp/using-interactive.html b/devdocs/elisp/using-interactive.html new file mode 100644 index 00000000..d658472b --- /dev/null +++ b/devdocs/elisp/using-interactive.html @@ -0,0 +1,28 @@ +

Using interactive

This section describes how to write the interactive form that makes a Lisp function an interactively-callable command, and how to examine a command’s interactive form.

Special Form: interactive &optional arg-descriptor &rest modes +
+

This special form declares that a function is a command, and that it may therefore be called interactively (via M-x or by entering a key sequence bound to it). The argument arg-descriptor declares how to compute the arguments to the command when the command is called interactively.

A command may be called from Lisp programs like any other function, but then the caller supplies the arguments and arg-descriptor has no effect.

The interactive form must be located at top-level in the function body, or in the function symbol’s interactive-form property (see Symbol Properties). It has its effect because the command loop looks for it before calling the function (see Interactive Call). Once the function is called, all its body forms are executed; at this time, if the interactive form occurs within the body, the form simply returns nil without even evaluating its argument.

The modes list allows specifying which modes the command is meant to be used in. See Command Modes for more details about the effect of specifying modes, and when to use it.

By convention, you should put the interactive form in the function body, as the first top-level form. If there is an interactive form in both the interactive-form symbol property and the function body, the former takes precedence. The interactive-form symbol property can be used to add an interactive form to an existing function, or change how its arguments are processed interactively, without redefining the function.

+
+

There are three possibilities for the argument arg-descriptor:

Function: interactive-form function +

This function returns the interactive form of function. If function is an interactively callable function (see Interactive Call), the value is the command’s interactive form (interactive spec), which specifies how to compute its arguments. Otherwise, the value is nil. If function is a symbol, its function definition is used.

+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Using-Interactive.html +

+
-- cgit v1.2.3