486 |
|
|
487 |
@cindex @code{lisp-indent-function} property |
@cindex @code{lisp-indent-function} property |
488 |
You can override the standard pattern in various ways for individual |
You can override the standard pattern in various ways for individual |
489 |
functions, according to the @code{lisp-indent-function} property of the |
functions, according to the @code{lisp-indent-function} property of |
490 |
function name. There are four possibilities for this property: |
the function name. Normally you would use this for macro definitions |
491 |
|
and specify it using the @code{declare} construct (@pxref{Defining |
492 |
@table @asis |
Macros,,, elisp, the Emacs Lisp Reference Manual}). |
|
@item @code{nil} |
|
|
This is the same as no property---use the standard indentation pattern. |
|
|
@item @code{defun} |
|
|
Handle this function like a @samp{def} construct: treat the second |
|
|
line as the start of a @dfn{body}. |
|
|
@item a number, @var{number} |
|
|
The first @var{number} arguments of the function are |
|
|
@dfn{distinguished} arguments; the rest are considered the body |
|
|
of the expression. A line in the expression is indented according to |
|
|
whether the first argument on it is distinguished or not. If the |
|
|
argument is part of the body, the line is indented @code{lisp-body-indent} |
|
|
more columns than the open-parenthesis starting the containing |
|
|
expression. If the argument is distinguished and is either the first |
|
|
or second argument, it is indented @emph{twice} that many extra columns. |
|
|
If the argument is distinguished and not the first or second argument, |
|
|
the line uses the standard pattern. |
|
|
@item a symbol, @var{symbol} |
|
|
@var{symbol} should be a function name; that function is called to |
|
|
calculate the indentation of a line within this expression. The |
|
|
function receives two arguments: |
|
|
@table @asis |
|
|
@item @var{state} |
|
|
The value returned by @code{parse-partial-sexp} (a Lisp primitive for |
|
|
indentation and nesting computation) when it parses up to the |
|
|
beginning of this line. |
|
|
@item @var{pos} |
|
|
The position at which the line being indented begins. |
|
|
@end table |
|
|
@noindent |
|
|
It should return either a number, which is the number of columns of |
|
|
indentation for that line, or a list whose car is such a number. The |
|
|
difference between returning a number and returning a list is that a |
|
|
number says that all following lines at the same nesting level should |
|
|
be indented just like this one; a list says that following lines might |
|
|
call for different indentations. This makes a difference when the |
|
|
indentation is being computed by @kbd{C-M-q}; if the value is a |
|
|
number, @kbd{C-M-q} need not recalculate indentation for the following |
|
|
lines until the end of the list. |
|
|
@end table |
|
493 |
|
|
494 |
@node C Indent |
@node C Indent |
495 |
@subsection Commands for C Indentation |
@subsection Commands for C Indentation |