diff options
| author | Kai Großjohann | 2003-05-22 14:53:58 +0000 |
|---|---|---|
| committer | Kai Großjohann | 2003-05-22 14:53:58 +0000 |
| commit | 99ffa7daf70e941e4282db147c2d73fb2a71ca79 (patch) | |
| tree | 7d0a8ab99de8a17138fedfa272ccadc3a4e05352 | |
| parent | 404074e2262e0f8a576646c837b779d87db768ab (diff) | |
| download | emacs-99ffa7daf70e941e4282db147c2d73fb2a71ca79.tar.gz emacs-99ffa7daf70e941e4282db147c2d73fb2a71ca79.zip | |
(Indentation): Explain the concepts.
(Just Spaces): Explain why preventing tabs for indentation might
be useful.
| -rw-r--r-- | man/ChangeLog | 6 | ||||
| -rw-r--r-- | man/indent.texi | 70 |
2 files changed, 70 insertions, 6 deletions
diff --git a/man/ChangeLog b/man/ChangeLog index d06d60fbcd0..3dac8e5555d 100644 --- a/man/ChangeLog +++ b/man/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2003-05-22 Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net> | ||
| 2 | |||
| 3 | * indent.texi (Indentation): Explain the concepts. | ||
| 4 | (Just Spaces): Explain why preventing tabs for indentation might | ||
| 5 | be useful. | ||
| 6 | |||
| 1 | 2003-05-03 Glenn Morris <gmorris@ast.cam.ac.uk> | 7 | 2003-05-03 Glenn Morris <gmorris@ast.cam.ac.uk> |
| 2 | 8 | ||
| 3 | * faq.texi: Improve previous changes. | 9 | * faq.texi: Improve previous changes. |
diff --git a/man/indent.texi b/man/indent.texi index 3fb3718f85f..337eb11a858 100644 --- a/man/indent.texi +++ b/man/indent.texi | |||
| @@ -35,10 +35,56 @@ Indent from point to the next prespecified tab stop column | |||
| 35 | Indent from point to under an indentation point in the previous line. | 35 | Indent from point to under an indentation point in the previous line. |
| 36 | @end table | 36 | @end table |
| 37 | 37 | ||
| 38 | Emacs supports four general categories of operations that could all | ||
| 39 | be called `indentation': | ||
| 40 | |||
| 41 | @enumerate | ||
| 42 | @item | ||
| 43 | The most simple operation is to just insert a tab character. 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 | |||
| 48 | 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 | ||
| 50 | stop is eight. @xref{Display Custom}, for more details. | ||
| 51 | |||
| 52 | @item | ||
| 53 | Emacs also supports tab stops. You can set them at arbitrary | ||
| 54 | positions, and then use @kbd{M-i} to advance to the next tab stop. The | ||
| 55 | default tab stop list contains positions (columns) that are a multiple | ||
| 56 | of eight, and so the effect of @kbd{M-i} is the same as that of | ||
| 57 | @kbd{C-q @key{TAB}} in the default case. | ||
| 58 | |||
| 59 | You can set the tab stops with @kbd{M-x edit-tab-stops}. | ||
| 60 | |||
| 61 | @item | ||
| 62 | You can align successive lines with each other. This is called | ||
| 63 | @dfn{relative indentation} in Emacs and is performed by the command | ||
| 64 | @kbd{M-x indent-relative}. The effect is best shown by an example: | ||
| 65 | @example | ||
| 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 | |||
| 75 | @item | ||
| 76 | The most sophisticated method is called @dfn{syntax-driven indentation} | ||
| 77 | and is the default behavior of the @key{TAB} key in Emacs. | ||
| 78 | |||
| 38 | Most programming languages have some indentation convention. For Lisp | 79 | Most programming languages have some indentation convention. For Lisp |
| 39 | code, lines are indented according to their nesting in parentheses. The | 80 | code, lines are indented according to their nesting in parentheses. The |
| 40 | same general idea is used for C code, though many details are different. | 81 | same general idea is used for C code, though many details are different. |
| 41 | 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 | |||
| 42 | @kindex TAB | 88 | @kindex TAB |
| 43 | Whatever the language, to indent a line, use the @key{TAB} command. Each | 89 | Whatever the language, to indent a line, use the @key{TAB} command. Each |
| 44 | major mode defines this command to perform the sort of indentation | 90 | major mode defines this command to perform the sort of indentation |
| @@ -48,13 +94,20 @@ line you are when you type @key{TAB}, it aligns the line as a whole. In C | |||
| 48 | mode, @key{TAB} implements a subtle and sophisticated indentation style that | 94 | mode, @key{TAB} implements a subtle and sophisticated indentation style that |
| 49 | knows about many aspects of C syntax. | 95 | knows about many aspects of C syntax. |
| 50 | 96 | ||
| 51 | In Text mode, @key{TAB} runs the command @code{tab-to-tab-stop}, which | 97 | @end enumerate |
| 52 | indents to the next tab stop column. You can set the tab stops with | ||
| 53 | @kbd{M-x edit-tab-stops}. | ||
| 54 | 98 | ||
| 55 | Normally, @key{TAB} inserts an optimal mix of tabs and spaces for | 99 | Normally, all of the above methods insert an optimal mix of tabs and |
| 56 | the intended indentation. @xref{Just Spaces}, for how to prevent use | 100 | spaces for the needed indentation. @xref{Just Spaces}, for how to |
| 57 | of tabs. | 101 | prevent use of tabs. However, the first method (@kbd{C-q @key{TAB}}) |
| 102 | always inserts a tab, even if you prevented their use. | ||
| 103 | |||
| 104 | @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 | ||
| 106 | @c @kbd{M-x edit-tab-stops}. | ||
| 107 | |||
| 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. | ||
| 58 | 111 | ||
| 59 | @menu | 112 | @menu |
| 60 | * Indentation Commands:: Various commands and techniques for indentation. | 113 | * Indentation Commands:: Various commands and techniques for indentation. |
| @@ -208,6 +261,11 @@ variable, so altering the variable affects only the current buffer, | |||
| 208 | but there is a default value which you can change as well. | 261 | but there is a default value which you can change as well. |
| 209 | @xref{Locals}. | 262 | @xref{Locals}. |
| 210 | 263 | ||
| 264 | A tab is not always displayed in the same way. By default, tabs are | ||
| 265 | eight columns wide, but some people like to customize their tools to | ||
| 266 | use a different tab width. So by using spaces only, you can make sure | ||
| 267 | that your file looks the same regardless of the tab width setting. | ||
| 268 | |||
| 211 | @findex tabify | 269 | @findex tabify |
| 212 | @findex untabify | 270 | @findex untabify |
| 213 | There are also commands to convert tabs to spaces or vice versa, always | 271 | There are also commands to convert tabs to spaces or vice versa, always |