(emacs)Multi-line Indent


Next: Lisp Indent Prev: Basic Indent Up: Program Indent

Indenting Several Lines
-----------------------

   When you wish to re-indent several lines of code which have been
altered or moved to a different level in the list structure, you have
several commands available.

`C-M-q'
     Re-indent all the lines within one list (`indent-sexp').

`C-u TAB'
     Shift an entire list rigidly sideways so that its first line is
     properly indented.

`C-M-\'
     Re-indent all lines in the region (`indent-region').

   You can re-indent the contents of a single list by positioning point
before the beginning of it and typing `C-M-q' (`indent-sexp' in Lisp
mode, `indent-c-exp' in C mode; also bound to other suitable commands
in other modes).  The indentation of the line the sexp starts on is not
changed; therefore, only the relative indentation within the list, and
not its position, is changed.  To correct the position as well, type a
TAB before the `C-M-q'.

   If the relative indentation within a list is correct but the
indentation of its beginning is not, go to the line the list begins on
and type `C-u TAB'.  When TAB is given a numeric argument, it moves all
the lines in the grouping starting on the current line sideways the
same amount that the current line moves.  It is clever, though, and
does not move lines that start inside strings, or C preprocessor lines
when in C mode.

   Another way to specify the range to be re-indented is with point and
mark.  The command `C-M-\' (`indent-region') applies TAB to every line
whose first character is between point and mark.


automatically generated by info2www