The special form
interactive turns a Lisp function into a
interactive form must be located at top-level in
the function body, usually as the first form in the body; this applies
to both lambda expressions (see Lambda Expressions) and
defun forms (see Defining Functions). This form does
nothing during the actual execution of the function; its presence
serves as a flag, telling the Emacs command loop that the function can
be called interactively. The argument of the
specifies how the arguments for an interactive call should be read.
interactive form may be specified in a
interactive-form property. A non-
value for this property takes precedence over any
form in the function body itself. This feature is seldom used.
Sometimes, a function is only intended to be called interactively,
never directly from Lisp. In that case, give the function a
interactive-only property, either directly
declare (see Declare Form). This causes the
byte compiler to warn if the command is called from Lisp. The output
describe-function will include similar information.
The value of the property can be: a string, which the byte-compiler
will use directly in its warning (it should end with a period, and not
start with a capital, e.g.,
"use (system-name) instead.");
other symbol, which should be an alternative function to use in Lisp
Generic functions (see Generic Functions) cannot be turned into
commands by adding the
interactive form to them.
|• Using Interactive:||General rules for |
|• 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.|