diff options
| author | Richard M. Stallman | 2003-05-28 11:43:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-05-28 11:43:37 +0000 |
| commit | 5ba75c80540b09d4149487e24ef097b03492741d (patch) | |
| tree | 4e67406dbd43770cdb5827d5ce2b86f1ab071276 | |
| parent | f9ad161b282e67373227d6ed2d1604b6a18d2ec2 (diff) | |
| download | emacs-5ba75c80540b09d4149487e24ef097b03492741d.tar.gz emacs-5ba75c80540b09d4149487e24ef097b03492741d.zip | |
(Indentation): Condense, simplify, clarify prev change.
| -rw-r--r-- | man/indent.texi | 70 |
1 files changed, 21 insertions, 49 deletions
diff --git a/man/indent.texi b/man/indent.texi index 337eb11a858..a940bc77a95 100644 --- a/man/indent.texi +++ b/man/indent.texi | |||
| @@ -40,75 +40,47 @@ be called `indentation': | |||
| 40 | 40 | ||
| 41 | @enumerate | 41 | @enumerate |
| 42 | @item | 42 | @item |
| 43 | The most simple operation is to just insert a tab character. This | 43 | Insert a tab character. You can type @kbd{C-q @key{TAB}} to do this. |
| 44 | operation does not have a convenient key binding, because it is | ||
| 45 | subsumed by the more general operation described next. But you can use | ||
| 46 | @kbd{C-q @key{TAB}} to insert a literal tab character. | ||
| 47 | 44 | ||
| 48 | A tab character is displayed as a stretch of whitespace which extends | 45 | A tab character is displayed as a stretch of whitespace which extends |
| 49 | to the next display tab stop position, and the default width of a tab | 46 | to the next display tab stop position, and the default width of a tab |
| 50 | stop is eight. @xref{Display Custom}, for more details. | 47 | stop is eight. @xref{Display Custom}, for more details. |
| 51 | 48 | ||
| 52 | @item | 49 | @item |
| 53 | Emacs also supports tab stops. You can set them at arbitrary | 50 | Advance to the next tab stop. You can set tab stops at your choice of |
| 54 | positions, and then use @kbd{M-i} to advance to the next tab stop. The | 51 | column positions, then type @kbd{M-i} to advance to the next tab stop. |
| 55 | default tab stop list contains positions (columns) that are a multiple | 52 | The default is to have tab stops every eight columns, which means by |
| 56 | of eight, and so the effect of @kbd{M-i} is the same as that of | 53 | default @kbd{M-i} inserts a tab character. To set the tab stops, use |
| 57 | @kbd{C-q @key{TAB}} in the default case. | 54 | @kbd{M-x edit-tab-stops}. |
| 58 | |||
| 59 | You can set the tab stops with @kbd{M-x edit-tab-stops}. | ||
| 60 | 55 | ||
| 61 | @item | 56 | @item |
| 62 | You can align successive lines with each other. This is called | 57 | Align a line with the previous line. More precisely, the command |
| 63 | @dfn{relative indentation} in Emacs and is performed by the command | 58 | @kbd{M-x indent-relative} indents the current line under the beginning |
| 64 | @kbd{M-x indent-relative}. The effect is best shown by an example: | 59 | of some word in the previous line. In Fundamental mode and in Text |
| 65 | @example | 60 | mode, @key{TAB} runs the command @code{indent-relative}. |
| 66 | This shows the effect of relative indentation. | ||
| 67 | ^ ^ ^ ^ ^ ^ ^ | ||
| 68 | @end example | ||
| 69 | The positions for the @code{^} characters on the second line were | ||
| 70 | obtained using @kbd{M-x indent-relative}. | ||
| 71 | |||
| 72 | In Fundamental mode and in Text mode, @key{TAB} runs the command | ||
| 73 | @code{indent-relative}. | ||
| 74 | 61 | ||
| 75 | @item | 62 | @item |
| 76 | The most sophisticated method is called @dfn{syntax-driven indentation} | 63 | The most sophisticated method is @dfn{syntax-driven indentation}. |
| 77 | and is the default behavior of the @key{TAB} key in Emacs. | 64 | Most programming languages have an indentation convention. For Lisp |
| 78 | 65 | code, lines are indented according to their nesting in parentheses. C | |
| 79 | Most programming languages have some indentation convention. For Lisp | 66 | code uses the same general idea, but many details are different. |
| 80 | code, lines are indented according to their nesting in parentheses. The | ||
| 81 | same general idea is used for C code, though many details are different. | ||
| 82 | |||
| 83 | For some languages, different kinds of indentation styles are | ||
| 84 | commonly used. Emacs accomodates this by allowing users to customize | ||
| 85 | the indentation. For example, see @ref{Customizing Indentation,,,ccmode}, | ||
| 86 | for a description of these facilities for the C language. | ||
| 87 | 67 | ||
| 88 | @kindex TAB | 68 | @kindex TAB |
| 89 | Whatever the language, to indent a line, use the @key{TAB} command. Each | 69 | Type @key{TAB} to do syntax-driven indentation, in a mode that |
| 90 | major mode defines this command to perform the sort of indentation | 70 | supports it. It realigns the current line according with the syntax |
| 91 | appropriate for the particular language. In Lisp mode, @key{TAB} aligns | 71 | of the preceding lines. No matter where in the line you are when you |
| 92 | the line according to its depth in parentheses. No matter where in the | 72 | type @key{TAB}, it aligns the line as a whole. |
| 93 | line you are when you type @key{TAB}, it aligns the line as a whole. In C | ||
| 94 | mode, @key{TAB} implements a subtle and sophisticated indentation style that | ||
| 95 | knows about many aspects of C syntax. | ||
| 96 | |||
| 97 | @end enumerate | 73 | @end enumerate |
| 98 | 74 | ||
| 99 | Normally, all of the above methods insert an optimal mix of tabs and | 75 | Normally, all of the above methods insert an optimal mix of tabs and |
| 100 | spaces for the needed indentation. @xref{Just Spaces}, for how to | 76 | spaces to align to the desired column. @xref{Just Spaces}, for how to |
| 101 | prevent use of tabs. However, the first method (@kbd{C-q @key{TAB}}) | 77 | disable use of tabs. However, @kbd{C-q @key{TAB}} always inserts a |
| 102 | always inserts a tab, even if you prevented their use. | 78 | tab, even they are disabled for the indentation commands. |
| 103 | 79 | ||
| 104 | @c In Text mode, @key{TAB} runs the command @code{tab-to-tab-stop}, which | 80 | @c In Text mode, @key{TAB} runs the command @code{tab-to-tab-stop}, which |
| 105 | @c indents to the next tab stop column. You can set the tab stops with | 81 | @c indents to the next tab stop column. You can set the tab stops with |
| 106 | @c @kbd{M-x edit-tab-stops}. | 82 | @c @kbd{M-x edit-tab-stops}. |
| 107 | 83 | ||
| 108 | @c Normally, @key{TAB} inserts an optimal mix of tabs and spaces for | ||
| 109 | @c the intended indentation. @xref{Just Spaces}, for how to prevent use | ||
| 110 | @c of tabs. | ||
| 111 | |||
| 112 | @menu | 84 | @menu |
| 113 | * Indentation Commands:: Various commands and techniques for indentation. | 85 | * Indentation Commands:: Various commands and techniques for indentation. |
| 114 | * Tab Stops:: You can set arbitrary "tab stops" and then | 86 | * Tab Stops:: You can set arbitrary "tab stops" and then |