Some major modes provide functions which manage the indentation of the buffer they are installed in. These modes are usually those which are designed for a particular programming language; for example C mode understands how to indent C source and Lisp mode knows about Lisp code.
To simplify matters there is a unified interface to the indentation process; each major mode simply sets the value of a buffer-local variable to the function used to indent a line in that buffer. This variable is then referenced by the functions which provide indentation.
The function should take one optional argument, the position of the line
to indent. If the value of this argument is nil the current line
should be indented. The function should set the indentation of the
line to the correct depth then return the glyph position
(see section Glyph Positions) of the first non-whitespace character.
For example Lisp mode sets this variable to lisp-indent-line, this
function is defined as,
(defun lisp-indent-line (&optional pos) (set-indent-pos (lisp-indent-pos (or pos (cursor-pos)))))
Where the function lisp-indent-pos calculates the proper indentation
for the line pointed to by its argument.
For the functions dealing with indentation see section Indentation Functions.
Go to the first, previous, next, last section, table of contents.