Go to the first, previous, next, last section, table of contents.

The Template for a Definition

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.)

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 function 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', write braces around it. For example:

@deffn {Interactive Command} isearch-forward 
... 
@end deffn

Otherwise, the second word will be mistaken for the name of the entity.

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. The @deffn command possesses three predefined, specialized variations, @defun, @defmac, and @defspec, that specify the category for you: "Function", "Macro", and "Special Form" respectively. The @defvr command also is accompanied by several predefined, specialized variations for describing particular kinds of variables.

The template for a specialized definition, such as @defun, is similar to the template for a generalized definition, except that you do not need to specify the category:

@defun name arguments... 
body-of-definition
@end defun

Thus,

@defun buffer-end flag 
This function returns @code{(point-min)} if @var{flag}
is less than 1, @code{(point-max)} otherwise.
... 
@end defun

produces

Function: buffer-end flag

This function returns (point-min) if flag is less than 1, (point-max) otherwise. ...

See section A Sample Function Definition, for a more detailed example of a function definition, including the use of @example inside the definition.

The other specialized commands work like @defun.


Go to the first, previous, next, last section, table of contents.