(emacs.info) Indentation Commands
(emacs.info) Tab Stops
Indentation Commands and Techniques
To move over the indentation on a line, do `M-m'
(`back-to-indentation'). This command, given anywhere on a line,
positions point at the first nonblank character on the line.
To insert an indented line before the current line, do `C-a C-o
<TAB>'. To make an indented line after the current line, use `C-e C-j'.
If you just want to insert a tab character in the buffer, you can
type `C-q <TAB>'.
`C-M-o' (`split-line') moves the text from point to the end of the
line vertically down, so that the current line becomes two lines.
`C-M-o' first moves point forward over any spaces and tabs. Then it
inserts after point a newline and enough indentation to reach the same
column point is on. Point remains before the inserted newline; in this
regard, `C-M-o' resembles `C-o'.
To join two lines cleanly, use the `M-^' (`delete-indentation')
command. It deletes the indentation at the front of the current line,
and the line boundary as well, replacing them with a single space. As
a special case (useful for Lisp code) the single space is omitted if
the characters to be joined are consecutive open parentheses or closing
parentheses, or if the junction follows another newline. To delete
just the indentation of a line, go to the beginning of the line and use
`M-\' (`delete-horizontal-space'), which deletes all spaces and tabs
around the cursor.
If you have a fill prefix, `M-^' deletes the fill prefix if it
appears after the newline that is deleted. Fill Prefix.
There are also commands for changing the indentation of several lines
at once. `C-M-\' (`indent-region') applies to all the lines that begin
in the region; it indents each line in the "usual" way, as if you had
typed <TAB> at the beginning of the line. A numeric argument specifies
the column to indent to, and each line is shifted left or right so that
its first nonblank character appears in that column. `C-x <TAB>'
(`indent-rigidly') moves all of the lines in the region right by its
argument (left, for negative arguments). The whole group of lines
moves rigidly sideways, which is how the command gets its name.
`M-x indent-relative' indents at point based on the previous line
(actually, the last nonempty line). It inserts whitespace at point,
moving point, until it is underneath an indentation point in the
previous line. An indentation point is the end of a sequence of
whitespace or the end of the line. If point is farther right than any
indentation point in the previous line, the whitespace before point is
deleted and the first indentation point then applicable is used. If no
indentation point is applicable even then, `indent-relative' runs
`tab-to-tab-stop' ( Tab Stops).
`indent-relative' is the definition of <TAB> in Indented Text mode.
Format Indentation, for another way of specifying the
indentation for part of your text.
(emacs.info) Tab Stops
automatically generated by