[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter describes the Emacs commands that add, remove, or adjust indentation.
newline-and-indent
).
delete-indentation
).
This would cancel out the effect of C-j.
split-line
).
back-to-indentation
).
indent-region
).
indent-rigidly
).
tab-to-tab-stop
).
Most programming languages have some indentation convention. For Lisp code, lines are indented according to their nesting in parentheses. The same general idea is used for C code, though many details are different.
Whatever the language, to indent a line, use the TAB command. Each major mode defines this command to perform the sort of indentation appropriate for the particular language. In Lisp mode, TAB aligns the line according to its depth in parentheses. No matter where in the line you are when you type TAB, it aligns the line as a whole. In C mode, TAB implements a subtle and sophisticated indentation style that knows about many aspects of C syntax.
In Text mode, TAB runs the command tab-to-tab-stop
, which
indents to the next tab stop column. You can set the tab stops with
M-x edit-tab-stops.
Normally, TAB inserts an optimal mix of tabs and spaces for the intended indentation. See section S.3 Tabs vs. Spaces, for how to prevent use of tabs.
S.1 Indentation Commands and Techniques Various commands and techniques for indentation. S.2 Tab Stops You can set arbitrary "tab stops" and then indent to the next tab stop when you want to. S.3 Tabs vs. Spaces You can request indentation using just spaces.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |