aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2003-05-22 14:53:58 +0000
committerKai Großjohann2003-05-22 14:53:58 +0000
commit99ffa7daf70e941e4282db147c2d73fb2a71ca79 (patch)
tree7d0a8ab99de8a17138fedfa272ccadc3a4e05352
parent404074e2262e0f8a576646c837b779d87db768ab (diff)
downloademacs-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/ChangeLog6
-rw-r--r--man/indent.texi70
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 @@
12003-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
12003-05-03 Glenn Morris <gmorris@ast.cam.ac.uk> 72003-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
35Indent from point to under an indentation point in the previous line. 35Indent 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
39be called `indentation':
40
41@enumerate
42@item
43The most simple operation is to just insert a tab character. This
44operation does not have a convenient key binding, because it is
45subsumed by the more general operation described next. But you can use
46@kbd{C-q @key{TAB}} to insert a literal tab character.
47
48A tab character is displayed as a stretch of whitespace which extends
49to the next display tab stop position, and the default width of a tab
50stop is eight. @xref{Display Custom}, for more details.
51
52@item
53Emacs also supports tab stops. You can set them at arbitrary
54positions, and then use @kbd{M-i} to advance to the next tab stop. The
55default tab stop list contains positions (columns) that are a multiple
56of 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
59You can set the tab stops with @kbd{M-x edit-tab-stops}.
60
61@item
62You 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
66This shows the effect of relative indentation.
67^ ^ ^ ^ ^ ^ ^
68@end example
69The positions for the @code{^} characters on the second line were
70obtained using @kbd{M-x indent-relative}.
71
72In Fundamental mode and in Text mode, @key{TAB} runs the command
73@code{indent-relative}.
74
75@item
76The most sophisticated method is called @dfn{syntax-driven indentation}
77and 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
39code, lines are indented according to their nesting in parentheses. The 80code, lines are indented according to their nesting in parentheses. The
40same general idea is used for C code, though many details are different. 81same general idea is used for C code, though many details are different.
41 82
83 For some languages, different kinds of indentation styles are
84commonly used. Emacs accomodates this by allowing users to customize
85the indentation. For example, see @ref{Customizing Indentation,,,ccmode},
86for 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
44major mode defines this command to perform the sort of indentation 90major 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
48mode, @key{TAB} implements a subtle and sophisticated indentation style that 94mode, @key{TAB} implements a subtle and sophisticated indentation style that
49knows about many aspects of C syntax. 95knows 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
52indents 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
56the intended indentation. @xref{Just Spaces}, for how to prevent use 100spaces for the needed indentation. @xref{Just Spaces}, for how to
57of tabs. 101prevent use of tabs. However, the first method (@kbd{C-q @key{TAB}})
102always 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,
208but there is a default value which you can change as well. 261but 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
265eight columns wide, but some people like to customize their tools to
266use a different tab width. So by using spaces only, you can make sure
267that 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