0
|
1
|
|
2 @node Fixit, Files, Search, Top
|
|
3 @chapter Commands for Fixing Typos
|
|
4 @cindex typos
|
|
5 @cindex mistakes, correcting
|
|
6
|
|
7 This chapter describes commands that are especially useful when you
|
|
8 catch a mistake in your text just after you have made it, or when you
|
|
9 change your mind while composing text on line.
|
|
10
|
|
11 @menu
|
|
12 * Kill Errors:: Commands to kill a batch of recently entered text.
|
|
13 * Transpose:: Exchanging two characters, words, lines, lists...
|
|
14 * Fixing Case:: Correcting case of last word entered.
|
|
15 * Spelling:: Apply spelling checker to a word, or a whole file.
|
|
16 @end menu
|
|
17
|
|
18 @node Kill Errors, Transpose, Fixit, Fixit
|
|
19 @section Killing Your Mistakes
|
|
20
|
|
21 @table @kbd
|
|
22 @item @key{DEL}
|
|
23 Delete last character (@code{delete-backward-char}).
|
|
24 @item M-@key{DEL}
|
|
25 Kill last word (@code{backward-kill-word}).
|
|
26 @item C-x @key{DEL}
|
|
27 Kill to beginning of sentence (@code{backward-kill-sentence}).
|
|
28 @end table
|
|
29
|
|
30 @kindex DEL
|
|
31 @findex delete-backward-char
|
|
32 The @key{DEL} character (@code{delete-backward-char}) is the most
|
|
33 important correction command. When used among graphic (self-inserting)
|
|
34 characters, it can be thought of as canceling the last character typed.
|
|
35
|
|
36 @kindex M-DEL
|
|
37 @kindex C-x DEL
|
|
38 @findex backward-kill-word
|
|
39 @findex backward-kill-sentence
|
|
40 When your mistake is longer than a couple of characters, it might be more
|
|
41 convenient to use @kbd{M-@key{DEL}} or @kbd{C-x @key{DEL}}.
|
|
42 @kbd{M-@key{DEL}} kills back to the start of the last word, and @kbd{C-x
|
|
43 @key{DEL}} kills back to the start of the last sentence. @kbd{C-x
|
|
44 @key{DEL}} is particularly useful when you are thinking of what to write as
|
|
45 you type it, in case you change your mind about phrasing.
|
|
46 @kbd{M-@key{DEL}} and @kbd{C-x @key{DEL}} save the killed text for
|
|
47 @kbd{C-y} and @kbd{M-y} to retrieve. @xref{Yanking}.@refill
|
|
48
|
|
49 @kbd{M-@key{DEL}} is often useful even when you have typed only a few
|
|
50 characters wrong, if you know you are confused in your typing and aren't
|
|
51 sure exactly what you typed. At such a time, you cannot correct with
|
|
52 @key{DEL} except by looking at the screen to see what you did. It requires
|
|
53 less thought to kill the whole word and start over.
|
|
54
|
|
55 @node Transpose, Fixing Case, Kill Errors, Fixit
|
|
56 @section Transposing Text
|
|
57
|
|
58 @table @kbd
|
|
59 @item C-t
|
|
60 Transpose two characters (@code{transpose-chars}).
|
|
61 @item M-t
|
|
62 Transpose two words (@code{transpose-words}).
|
|
63 @item C-M-t
|
|
64 Transpose two balanced expressions (@code{transpose-sexps}).
|
|
65 @item C-x C-t
|
|
66 Transpose two lines (@code{transpose-lines}).
|
|
67 @end table
|
|
68
|
|
69 @cindex transposition
|
|
70 @kindex C-t
|
|
71 @findex transpose-chars
|
|
72 The common error of transposing two adjacent characters can be fixed
|
|
73 with the @kbd{C-t} command (@code{transpose-chars}). Normally,
|
|
74 @kbd{C-t} transposes the two characters on either side of point. When
|
|
75 given at the end of a line, @kbd{C-t} transposes the last two characters
|
|
76 on the line, rather than transposing the last character of the line with
|
|
77 the newline, which would be useless. If you catch a
|
|
78 transposition error right away, you can fix it with just @kbd{C-t}.
|
|
79 If you catch the error later, move the cursor back to between
|
|
80 the two transposed characters. If you transposed a space with the last
|
|
81 character of the word before it, the word motion commands are a good way
|
|
82 of getting there. Otherwise, a reverse search (@kbd{C-r}) is often the
|
|
83 best way. @xref{Search}.
|
|
84
|
|
85 @kindex C-x C-t
|
|
86 @findex transpose-lines
|
|
87 @kindex M-t
|
|
88 @findex transpose-words
|
|
89 @kindex C-M-t
|
|
90 @findex transpose-sexps
|
|
91 @kbd{Meta-t} (@code{transpose-words}) transposes the word before point
|
|
92 with the word after point. It moves point forward over a word, dragging
|
|
93 the word preceding or containing point forward as well. The punctuation
|
|
94 characters between the words do not move. For example, @w{@samp{FOO, BAR}}
|
|
95 transposes into @w{@samp{BAR, FOO}} rather than @samp{@w{BAR FOO,}}.
|
|
96
|
|
97 @kbd{C-M-t} (@code{transpose-sexps}) is a similar command for transposing
|
|
98 two expressions (@pxref{Lists}), and @kbd{C-x C-t} (@code{transpose-lines})
|
|
99 exchanges lines. It works like @kbd{M-t} but in determines the
|
|
100 division of the text into syntactic units differently.
|
|
101
|
|
102 A numeric argument to a transpose command serves as a repeat count: it
|
|
103 tells the transpose command to move the character (word, sexp, line) before
|
|
104 or containing point across several other characters (words, sexps, lines).
|
|
105 For example, @kbd{C-u 3 C-t} moves the character before point forward
|
|
106 across three other characters. This is equivalent to repeating @kbd{C-t}
|
|
107 three times. @kbd{C-u - 4 M-t} moves the word before point backward across
|
|
108 four words. @kbd{C-u - C-M-t} would cancel the effect of plain
|
|
109 @kbd{C-M-t}.@refill
|
|
110
|
|
111 A numeric argument of zero transposes the character (word, sexp, line)
|
|
112 ending after point with the one ending after the mark (otherwise a
|
|
113 command with a repeat count of zero would do nothing).
|
|
114
|
|
115 @node Fixing Case, Spelling, Transpose, Fixit
|
|
116 @section Case Conversion
|
|
117
|
|
118 @table @kbd
|
|
119 @item M-- M-l
|
|
120 Convert last word to lower case. Note that @kbd{Meta--} is ``Meta-minus.''
|
|
121 @item M-- M-u
|
|
122 Convert last word to all upper case.
|
|
123 @item M-- M-c
|
|
124 Convert last word to lower case with capital initial.
|
|
125 @end table
|
|
126
|
|
127 @findex downcase-word
|
|
128 @findex upcase-word
|
|
129 @findex capitalize-word
|
|
130 @kindex M-@t{-} M-l
|
|
131 @kindex M-@t{-} M-u
|
|
132 @kindex M-@t{-} M-c
|
|
133 @cindex case conversion
|
|
134 @cindex words
|
|
135 A common error is to type words in the wrong case. Because of this,
|
|
136 the word case-conversion commands @kbd{M-l}, @kbd{M-u}, and @kbd{M-c} do
|
|
137 not move the cursor when used with a negative argument.
|
|
138 As soon as you see you have mistyped the last word, you can simply
|
|
139 case-convert it and continue typing. @xref{Case}.@refill
|
|
140
|
|
141 @node Spelling,, Fixing Case, Fixit
|
|
142 @section Checking and Correcting Spelling
|
|
143 @cindex spelling
|
|
144
|
|
145 @c doublewidecommands
|
|
146 @table @kbd
|
|
147 @item M-$
|
|
148 Check and correct spelling of word (@code{spell-word}).
|
|
149 @item M-x spell-buffer
|
|
150 Check and correct spelling of each word in the buffer.
|
|
151 @item M-x spell-region
|
|
152 Check and correct spelling of each word in the region.
|
|
153 @item M-x spell-string
|
|
154 Check spelling of specified word.
|
|
155 @end table
|
|
156
|
|
157 @kindex M-$
|
|
158 @findex spell-word
|
|
159 To check the spelling of the word before point, and optionally correct
|
|
160 it, use the command @kbd{M-$} (@code{spell-word}). This command runs an
|
|
161 inferior process containing the @code{spell} program to see whether the
|
|
162 word is correct English. If it is not, it asks you to edit the word (in
|
|
163 the minibuffer) into a corrected spelling, and then performs a
|
|
164 @code{query-replace} to substitute the corrected spelling for the old
|
|
165 one throughout the buffer.
|
|
166
|
|
167 If you exit the minibuffer without altering the original spelling, it
|
|
168 means you do not want to do anything to that word. In that case, the
|
|
169 @code{query-replace} is not done.
|
|
170
|
|
171 @findex spell-buffer
|
|
172 @kbd{M-x spell-buffer} checks each word in the buffer the same way that
|
|
173 @code{spell-word} does, doing a @code{query-replace} for
|
|
174 every incorrect word if appropriate.@refill
|
|
175
|
|
176 @findex spell-region
|
|
177 @kbd{M-x spell-region} is similar to @code{spell-buffer} but operates
|
|
178 only on the region, not the entire buffer.
|
|
179
|
|
180 @findex spell-string
|
|
181 @kbd{M-x spell-string} reads a string as an argument and checks
|
|
182 whether that is a correctly spelled English word. It prints a message
|
|
183 giving the answer in the echo area.
|