Node: Old-style Command Definition, Next: , Previous: Commands, Up: Commands



Old-style Command Definition

The old-style command declaration syntax looks very much like that of GNU Emacs Lisp. Commands are defined like any other function (using defun), but the first form in the body must be an interactive declaration. This 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.