Next: Def Cmd Continuation Lines, Up: Definition Commands [Contents][Index]
The @deffn
command is used for definitions of entities that
resemble functions. To write a definition using the @deffn
command, write the @deffn
command at the beginning of a line
and follow it on the same line by the category of the entity, the name
of the entity itself, and its arguments (if any). Then write the body
of the definition on succeeding lines. (You may embed examples in the
body.) Finally, end the definition with an @end deffn
command
written on a line of its own.
The other definition commands follow the same format: a line with the
@def…
command and whatever arguments are appropriate for
that command; the body of the definition; and a corresponding
@end
line.
The template for a definition looks like this:
@deffn category name arguments… body-of-definition @end deffn
For example,
@deffn Command forward-word count This command moves point forward @var{count} words (or backward if @var{count} is negative). … @end deffn
produces
- Command: forward-word count
This command moves point forward count words (or backward if count is negative). …
Capitalize the category name like a title. If the name of the category contains spaces, as in the phrase ‘Interactive Command’, enclose it in braces. For example:
@deffn {Interactive Command} isearch-forward … @end deffn
Otherwise, the second word will be mistaken for the name of the entity. As a general rule, when any of the arguments in the heading line except the last one are more than one word, you need to enclose them in braces. This may also be necessary if the text contains commands, for example, ‘{declaraci@'on}’ if you are writing in Spanish.
Some of the definition commands are more general than others. The
@deffn
command, for example, is the general definition command
for functions and the like—for entities that may take arguments.
When you use this command, you specify the category to which the
entity belongs. Three predefined, specialized variations
(@defun
, @defmac
, and @defspec
) specify the
category for you: “Function”, “Macro”, and “Special Form”
respectively. (In Lisp, a special form is an entity much like a
function.) Similarly, the general @defvr
command is
accompanied by several specialized variations for describing
particular kinds of variables.
See Sample Function Definition, for a detailed example of a
function definition, including the use of @example
inside the
definition.
Next: Def Cmd Continuation Lines, Up: Definition Commands [Contents][Index]