This section contains details of commands used to indent text. Indentation is usually achieved by inserting tab or space characters into the text so as to indent that text a predefined number of spaces.
The effect of the editor indentation commands depends on the major mode of the buffer. Where relevant, the command details given below provide information on how they operate in Text mode and Lisp mode. The operation of commands in Fundamental mode is generally the same as that of Text mode.
Arguments: None
Key sequence: Tab
In Text mode, spaces-for-tab #\Space
characters are inserted. A prefix argument causes this to occur at the start of the appropriate number of lines (starting from the current line).
In Lisp mode, the current line is indented according to the structure of the current Lisp form. A prefix argument p causes p lines to be indented according to Lisp syntax.
See editor:*indent-with-tabs* for control over the insertion of #\Tab
characters by this and other indentation commands.
Note: the key sequence Tab
is overridden in Lisp mode to perform Indent Selection or Complete Symbol.
spaces-for-tab Editor Variable
Default value: 8
Determines the width of the whitespace (that is, the number of #\Space
characters) used to display a #\Tab
character.
Arguments: None
Key sequence: Meta
+Ctrl+\
Indents all the text in the region between the mark and the current point.
In Text mode a block of whitespace, which is spaces-for-tab wide, is inserted at the start of each line within the region.
In Lisp mode the text is indented according to the syntax of the Lisp form.
In both cases, a prefix argument causes any existing indentation to be deleted and replaced with a block of whitespace of the appropriate width.
Arguments: None
Key sequence: Ctrl+X Tab
or Ctrl+X Ctrl+I
Indents each line in the region between the current point and the mark by a block of whitespace which is spaces-for-tab wide. Any existing whitespace at the beginning of the lines is retained.
A positive prefix argument causes the lines to be indented by the appropriate number of spaces, in addition to their existing space. A negative prefix argument causes the lines to be shifted to the left by the appropriate number of spaces. Where necessary, tabs are converted to spaces.
Indent Selection Editor Command
Arguments: None
Key sequence: None
Indents all the text in the selection or the current line if there is no selection. With a prefix argument p, any existing indentation is deleted and replaced with a block of space p columns wide.
See also Indent Selection or Complete Symbol.
Delete Indentation Editor Command
Arguments: None
Key sequence: Meta
+Shift+^
Joins the current line with the previous one, deleting all whitespace at the beginning of the current line and at the end of the previous line. The deleted whitespace is normally replaced with a single space. However, if the deleted whitespace is at the beginning of a line, or immediately after a (
, or immediately before a )
, then the whitespace is merely deleted without any characters being inserted. If the preceding character is a sentence terminator, then two spaces are left instead of one.
A prefix argument causes the following line to be joined with the current line.
Back to Indentation Editor Command
Arguments: None
Key sequence: Meta
+M
Moves the current point to the first character in the current line that is not a whitespace character.
Indent New Line Editor Command
Arguments: None
Key sequence: None
Moves everything to the right of the current point to a new line and indents it. Any whitespace before the current point is deleted. If there is a fill-prefix, this is inserted at the start of the new line instead.
A prefix argument causes the current point to be moved down the appropriate number of lines and indented.
Arguments: None
Key sequence: None
Inserts a Tab
character.
A prefix argument causes the appropriate number of tab characters to be inserted.
Editor User Guide (Unix version) - 01 Dec 2021 19:35:18