(emacs)Basic Indent


Next: Multi-line Indent Up: Program Indent

Basic Program Indentation Commands
----------------------------------

`TAB'
     Adjust indentation of current line.

`LFD'
     Equivalent to RET followed by TAB (`newline-and-indent').

   The basic indentation command is TAB, which gives the current line
the correct indentation as determined from the previous lines.  The
function that TAB runs depends on the major mode; it is
`lisp-indent-line' in Lisp mode, `c-indent-line' in C mode, etc.  These
functions understand different syntaxes for different languages, but
they all do about the same thing.  TAB in any programming language
major mode inserts or deletes whitespace at the beginning of the
current line, independent of where point is in the line.  If point is
inside the whitespace at the beginning of the line, TAB leaves it at
the end of that whitespace; otherwise, TAB leaves point fixed with
respect to the characters around it.

   Use `C-q TAB' to insert a tab at point.

   When entering a large amount of new code, use LFD
(`newline-and-indent'), which is equivalent to a RET followed by a TAB.
LFD creates a blank line, and then gives it the appropriate
indentation.

   TAB indents the second and following lines of the body of a
parenthetical grouping each under the preceding one; therefore, if you
alter one line's indentation to be nonstandard, the lines below will
tend to follow it.  This is the right behavior in cases where the
standard result of TAB is unaesthetic.

   Remember that an open-parenthesis, open-brace or other opening
delimiter at the left margin is assumed by Emacs (including the
indentation routines) to be the start of a function.  Therefore, you
must never have an opening delimiter in column zero that is not the
beginning of a function, not even inside a string.  This restriction is
vital for making the indentation commands fast; you must simply accept
it.  Note: Defuns, for more information on this.


automatically generated by info2www