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



New-style Command Definition

The new syntax does not depend on special magic in defun. Instead, it uses keyword arguments to indicate the calling specification and other properties.

define-command name fun #!key spec type doc doc-key class Function
Define a window managed command called name (a symbol). The function fun will be called to execute the command.

spec and type may be used to define the arguments expected by the command; spec is an interactive specification and type is a custom-type specification. See Interactive Calling Specification.

doc is the documentation string associated with the command. The command-documentation may be stored in the doc file, rather than in the code itself; if it exists, the doc-key will be used to look up the doc file entry. If both arguments are provided, both will be stored. But the command-documentation function favors the built-in doc string over the doc file entry.

class is an annotation for the command. It allows the definition to mark the class as 'advanced, for example. Other parts of Sawfish can then take advantage of this note.

define-command-to-screen name fun #!key spec type doc doc-key class Function
As define-command, but any printed output of fun is sent to the screen.

autoload-command name module #!key spec type doc doc-key class Function
Record that loading the module called module (a symbol) will provde a command called name.

The keyword values have the same meanings as for define-command. Defining those properties as part of the autoload provides useful feedback to the user without having to do loading.