Next: , Previous: , Up: Commands   [Contents][Index]


17.2 Old-style Command Definition

GNU Emacs-like command definition is a deprecated, old-syntax, but still supported. There command definition is included in function definition. The first form in the function body must be an interactive declaration which marks that the function may be called interactively and tells the call-command function how to compute the argument values to apply to the command.

The interactive declaration looks like a call to the special form interactive, in actual fact this special form always returns nil and has no side-effects. The only effect of this form is to show the call-command function that the function definition may be called interactively. The second element of the declaration form (after the interactive symbol) defines how the argument values applied to the command are computed.

The structure of an interactive declaration, then, is:

(interactive [calling-spec])

When a command is defined this is how it includes the interactive declaration:

(defun some-command (arg1)
  "Optional documentation string."
  (interactive …)
  …

The calling-spec is defined in See Interactive Calling Specification.