Emacs manual indentation






















Emacs can figure out how much indentation you need and do the right thing! Remember, often the indentation engines of major modes can be customized. Specially modes based on CC Mode are notorious for their support of styles. See IndentingC for examples. Basic Control. The variable indent-tabs-mode controls. The simplest way to perform indentation is the TAB key. In most major modes, this runs the command indent-for-tab-command. (In C and related modes, TAB runs the command c-indent-line-or-region, which behaves similarly, see C Indent). TAB. Insert whitespace, or indent the current line, in a mode-appropriate way (indent-for-tab-command). If the region is active, . C-M-\ (indent-region) indents each line in the “usual” way, as if you had typed 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.


T Indentation in Formatted Text When editing formatted text, you can specify different amounts of indentation for the right or left margin of an entire paragraph or a part of a paragraph. The margins you specify automatically affect the Emacs fill commands (see section T.5 Filling Text) and line-breaking commands. By default, Emacs reindents a line whenever you type a character in electric-indent-chars, which by default only includes Newline. Major modes can add chars to electric-indent-chars according to the syntax of the language. Deciding what is the right indentation is controlled in Emacs by indent-line-function (see Mode-Specific Indent). Set the standard Emacs variable indent-tabs-mode to t if you want real 'tab' characters to be used in the indentation, to nil if you want only spaces. See Just Spaces in GNU Emacs Manual. User Option: c-tab-always-indent. This variable modifies how TAB operates. When it is t (the default), TAB simply indents the current line.


Set the standard Emacs variable indent-tabs-mode to t if you want real ‘tab’ characters to be used in the indentation, to nil if you want only spaces. See Just Spaces in GNU Emacs Manual. User Option: c-tab-always-indent. This variable modifies how TAB operates. When it is t (the default), TAB simply indents the current line. Indentation Commands. Apart from the TAB (indent-for-tab-command) command, Emacs provides a variety of commands to perform indentation in other ways. C-M-o. Split the current line at point (split-line). The text on the line after point becomes a new line, indented to the same column where point is located. C-M-\ (indent-region) indents each line in the “usual” way, as if you had typed 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.

0コメント

  • 1000 / 1000