(lemacs.info)Multi-line Indent


Next: Lisp Indent Prev: Basic Indent Up: Grinding

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

   Several commands are available to re-indent several lines of code
which have been altered or moved to a different level in a list
structure.

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

   To re-indent the contents of a single list, position point before the
beginning of it and type `C-M-q'. This key is bound to `indent-sexp' in
Lisp mode, `indent-c-exp' in C mode, and bound to other suitable
functions 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 `C-M-q'.

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

   Another way to specify a 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