Mercurial > emacs
annotate man/basic.texi @ 36724:c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 12 Mar 2001 03:24:41 +0000 |
parents | 8abc334af58e |
children | f71fe44b07ea |
rev | line source |
---|---|
25829 | 1 @c This is part of the Emacs manual. |
27220
dddb1bca9704
Reference column-number-mode, hl-line-mode, blink-cursor-mode.
Dave Love <fx@gnu.org>
parents:
25829
diff
changeset
|
2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000 Free Software Foundation, Inc. |
25829 | 3 @c See file emacs.texi for copying conditions. |
4 @node Basic, Minibuffer, Exiting, Top | |
5 @chapter Basic Editing Commands | |
6 | |
7 @kindex C-h t | |
8 @findex help-with-tutorial | |
9 We now give the basics of how to enter text, make corrections, and | |
10 save the text in a file. If this material is new to you, you might | |
11 learn it more easily by running the Emacs learn-by-doing tutorial. To | |
12 use the tutorial, run Emacs and type @kbd{Control-h t} | |
13 (@code{help-with-tutorial}). | |
14 | |
15 To clear the screen and redisplay, type @kbd{C-l} (@code{recenter}). | |
16 | |
17 @menu | |
18 | |
19 * Inserting Text:: Inserting text by simply typing it. | |
20 * Moving Point:: How to move the cursor to the place where you want to | |
21 change something. | |
22 * Erasing:: Deleting and killing text. | |
23 * Undo:: Undoing recent changes in the text. | |
24 * Files: Basic Files. Visiting, creating, and saving files. | |
25 * Help: Basic Help. Asking what a character does. | |
26 * Blank Lines:: Commands to make or delete blank lines. | |
27 * Continuation Lines:: Lines too wide for the screen. | |
28 * Position Info:: What page, line, row, or column is point on? | |
29 * Arguments:: Numeric arguments for repeating a command. | |
30 * Repeating:: A short-cut for repeating the previous command. | |
31 @end menu | |
32 | |
33 @node Inserting Text | |
34 @section Inserting Text | |
35 | |
36 @cindex insertion | |
37 @cindex graphic characters | |
38 To insert printing characters into the text you are editing, just type | |
39 them. This inserts the characters you type into the buffer at the | |
40 cursor (that is, at @dfn{point}; @pxref{Point}). The cursor moves | |
41 forward, and any text after the cursor moves forward too. If the text | |
42 in the buffer is @samp{FOOBAR}, with the cursor before the @samp{B}, | |
43 then if you type @kbd{XX}, you get @samp{FOOXXBAR}, with the cursor | |
44 still before the @samp{B}. | |
45 | |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
46 To @dfn{delete} text you have just inserted, use the large key |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
47 labeled @key{DEL}, @key{BACKSPACE} or @key{DELETE} which is a short |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
48 distance above the @key{RET} or @key{ENTER} key. This is the key you |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
49 normally use for erasing the last character that you typed. |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
50 Regardless of the actual name on the key, Emacs always thinks of it as |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
51 @key{DEL}, and that's what we call it in the manual. |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
52 |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
53 The @key{DEL} key deletes the character @emph{before} the cursor. |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
54 As a consequence, the cursor and all the characters after it move |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
55 backwards. If you type a printing character and then type @key{DEL}, |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
56 they cancel out. |
25829 | 57 |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
58 Many keyboards have both a @key{BACKSPACE} key a short ways above |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
59 @key{RET} or @key{ENTER}, and a @key{DELETE} key elsewhere. In that |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
60 case, the @key{BACKSPACE} key is @key{DEL}, and the @key{DELETE} key |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
61 does something else---it deletes ``forwards,'' deleting the character |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
62 after point, the one underneath the cursor, like @kbd{C-d} (see |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
63 below). |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
64 |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
65 On a text-only terminal, Emacs cannot automatically tell which keys |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
66 it has and where they are located. If the convenient key for deletion |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
67 is @key{BACKSPACE}, you must type @kbd{M-x |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
68 delete-key-deletes-forward-mode @key{RET}} to make that key behave as |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
69 @key{DEL}. @xref{Deletion}, for more explanation of this. |
36654
8abc334af58e
(Inserting Text): Add a note aboute the DEL/Delete/BS controversy.
Eli Zaretskii <eliz@gnu.org>
parents:
36651
diff
changeset
|
70 |
25829 | 71 @kindex RET |
72 @cindex newline | |
73 To end a line and start typing a new one, type @key{RET}. This | |
74 inserts a newline character in the buffer. If point is in the middle of | |
75 a line, @key{RET} splits the line. Typing @key{DEL} when the cursor is | |
76 at the beginning of a line deletes the preceding newline, thus joining | |
77 the line with the preceding line. | |
78 | |
79 Emacs can split lines automatically when they become too long, if you | |
80 turn on a special minor mode called @dfn{Auto Fill} mode. | |
81 @xref{Filling}, for how to use Auto Fill mode. | |
82 | |
83 If you prefer to have text characters replace (overwrite) existing | |
84 text rather than shove it to the right, you can enable Overwrite mode, | |
85 a minor mode. @xref{Minor Modes}. | |
86 | |
87 @cindex quoting | |
88 @kindex C-q | |
89 @findex quoted-insert | |
90 Direct insertion works for printing characters and @key{SPC}, but other | |
91 characters act as editing commands and do not insert themselves. If you | |
92 need to insert a control character or a character whose code is above 200 | |
93 octal, you must @dfn{quote} it by typing the character @kbd{Control-q} | |
94 (@code{quoted-insert}) first. (This character's name is normally written | |
95 @kbd{C-q} for short.) There are two ways to use @kbd{C-q}:@refill | |
96 | |
97 @itemize @bullet | |
98 @item | |
99 @kbd{C-q} followed by any non-graphic character (even @kbd{C-g}) | |
100 inserts that character. | |
101 | |
102 @item | |
103 @kbd{C-q} followed by a sequence of octal digits inserts the character | |
104 with the specified octal character code. You can use any number of | |
105 octal digits; any non-digit terminates the sequence. If the terminating | |
106 character is @key{RET}, it serves only to terminate the sequence; any | |
107 other non-digit is itself used as input after terminating the sequence. | |
108 (The use of octal sequences is disabled in ordinary non-binary Overwrite | |
109 mode, to give you a convenient way to insert a digit instead of | |
110 overwriting with it.) | |
111 @end itemize | |
112 | |
33552
82d0163f6fb7
Say "ISO 8859" instead of "ISO Latin", to cover non-Latin ISO-8859
Eli Zaretskii <eliz@gnu.org>
parents:
33518
diff
changeset
|
113 @cindex 8-bit character codes |
25829 | 114 @noindent |
33518 | 115 When multibyte characters are enabled, if you specify a code in the |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
116 range 0200 through 0377 octal, @kbd{C-q} assumes that you intend to |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
117 use some ISO 8859-@var{n} character set, and converts the specified |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
118 code to the corresponding Emacs character code. @xref{Enabling |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
119 Multibyte}. You select @emph{which} of the ISO 8859 character sets to |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
120 use through your choice of language environment (@pxref{Language |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
121 Environments}). |
25829 | 122 |
123 @vindex read-quoted-char-radix | |
124 To use decimal or hexadecimal instead of octal, set the variable | |
125 @code{read-quoted-char-radix} to 10 or 16. If the radix is greater than | |
126 10, some letters starting with @kbd{a} serve as part of a character | |
127 code, just like digits. | |
128 | |
129 A numeric argument to @kbd{C-q} specifies how many copies of the | |
130 quoted character should be inserted (@pxref{Arguments}). | |
131 | |
132 @findex newline | |
133 @findex self-insert | |
134 Customization information: @key{DEL} in most modes runs the command | |
135 @code{delete-backward-char}; @key{RET} runs the command @code{newline}, and | |
136 self-inserting printing characters run the command @code{self-insert}, | |
137 which inserts whatever character was typed to invoke it. Some major modes | |
138 rebind @key{DEL} to other commands. | |
139 | |
140 @node Moving Point | |
141 @section Changing the Location of Point | |
142 | |
143 @cindex arrow keys | |
144 @cindex moving point | |
145 @cindex movement | |
146 @cindex cursor motion | |
147 @cindex moving the cursor | |
148 To do more than insert characters, you have to know how to move point | |
149 (@pxref{Point}). The simplest way to do this is with arrow keys, or by | |
150 clicking the left mouse button where you want to move to. | |
151 | |
152 There are also control and meta characters for cursor motion. Some | |
153 are equivalent to the arrow keys (these date back to the days before | |
154 terminals had arrow keys, and are usable on terminals which don't have | |
155 them). Others do more sophisticated things. | |
156 | |
157 @kindex C-a | |
158 @kindex C-e | |
159 @kindex C-f | |
160 @kindex C-b | |
161 @kindex C-n | |
162 @kindex C-p | |
163 @kindex M-> | |
164 @kindex M-< | |
165 @kindex M-r | |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
166 @kindex LEFT |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
167 @kindex RIGHT |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
168 @kindex UP |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
169 @kindex DOWN |
25829 | 170 @findex beginning-of-line |
171 @findex end-of-line | |
172 @findex forward-char | |
173 @findex backward-char | |
174 @findex next-line | |
175 @findex previous-line | |
176 @findex beginning-of-buffer | |
177 @findex end-of-buffer | |
178 @findex goto-char | |
179 @findex goto-line | |
180 @findex move-to-window-line | |
181 @table @kbd | |
182 @item C-a | |
183 Move to the beginning of the line (@code{beginning-of-line}). | |
184 @item C-e | |
185 Move to the end of the line (@code{end-of-line}). | |
186 @item C-f | |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
187 Move forward one character (@code{forward-char}). The right-arrow key |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
188 does the same thing. |
25829 | 189 @item C-b |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
190 Move backward one character (@code{backward-char}). The left-arrow |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
191 key has the same effect. |
25829 | 192 @item M-f |
193 Move forward one word (@code{forward-word}). | |
194 @item M-b | |
195 Move backward one word (@code{backward-word}). | |
196 @item C-n | |
197 Move down one line, vertically (@code{next-line}). This command | |
198 attempts to keep the horizontal position unchanged, so if you start in | |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
199 the middle of one line, you end in the middle of the next. The |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
200 down-arrow key does the same thing. |
25829 | 201 @item C-p |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
202 Move up one line, vertically (@code{previous-line}). The up-arrow key |
36651
f16f21a469b1
(Moving Point): Mention C-v and M-v, and the arrow keys.
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
203 has the same effect. |
25829 | 204 @item M-r |
205 Move point to left margin, vertically centered in the window | |
206 (@code{move-to-window-line}). Text does not move on the screen. | |
207 | |
208 A numeric argument says which screen line to place point on. It counts | |
209 screen lines down from the top of the window (zero for the top line). A | |
210 negative argument counts lines from the bottom (@minus{}1 for the bottom | |
211 line). | |
212 @item M-< | |
213 Move to the top of the buffer (@code{beginning-of-buffer}). With | |
214 numeric argument @var{n}, move to @var{n}/10 of the way from the top. | |
215 @xref{Arguments}, for more information on numeric arguments.@refill | |
216 @item M-> | |
217 Move to the end of the buffer (@code{end-of-buffer}). | |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
218 @item C-v |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
219 Scroll the display one screen forward, and move point if necessary to put |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
220 it on the screen (@code{scroll-up}). This doesn't always |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
221 move point, but it is commonly used to do so. |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
222 If your keyboard has a @key{PAGEDOWN} key, it does the same thing. |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
223 |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
224 Scrolling commands are further described in @ref{Scrolling}. |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
225 @item M-v |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
226 Scroll one screen backward, and move point if necessary to put it on |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
227 the screen (@code{scroll-down}). This doesn't always move point, but |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
228 it is commonly used to do so. The @key{PAGEUP} key has the same |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
229 effect. |
25829 | 230 @item M-x goto-char |
231 Read a number @var{n} and move point to buffer position @var{n}. | |
232 Position 1 is the beginning of the buffer. | |
233 @item M-x goto-line | |
234 Read a number @var{n} and move point to line number @var{n}. Line 1 | |
235 is the beginning of the buffer. | |
236 @item C-x C-n | |
237 @findex set-goal-column | |
238 @kindex C-x C-n | |
239 Use the current column of point as the @dfn{semipermanent goal column} for | |
240 @kbd{C-n} and @kbd{C-p} (@code{set-goal-column}). Henceforth, those | |
241 commands always move to this column in each line moved into, or as | |
242 close as possible given the contents of the line. This goal column remains | |
243 in effect until canceled. | |
244 @item C-u C-x C-n | |
245 Cancel the goal column. Henceforth, @kbd{C-n} and @kbd{C-p} once | |
246 again try to stick to a fixed horizontal position, as usual. | |
247 @end table | |
248 | |
249 @vindex track-eol | |
250 If you set the variable @code{track-eol} to a non-@code{nil} value, | |
251 then @kbd{C-n} and @kbd{C-p} when at the end of the starting line move | |
252 to the end of another line. Normally, @code{track-eol} is @code{nil}. | |
253 @xref{Variables}, for how to set variables such as @code{track-eol}. | |
254 | |
255 @vindex next-line-add-newlines | |
35923 | 256 @kbd{C-n} normally gets an error when you use it on the last line of |
257 the buffer (just as @kbd{C-p} gets an error on the first line). But | |
258 if you set the variable @code{next-line-add-newlines} to a | |
259 non-@code{nil} value, @kbd{C-n} on the last line of a buffer creates | |
260 an additional line at the end and moves down onto it. | |
25829 | 261 |
262 @node Erasing | |
263 @section Erasing Text | |
264 | |
265 @table @kbd | |
266 @item @key{DEL} | |
267 Delete the character before point (@code{delete-backward-char}). | |
268 @item C-d | |
269 Delete the character after point (@code{delete-char}). | |
36724
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
270 @item @key{DELETE} |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
271 @itemx @key{BACKSPACE} |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
272 One of these keys, whichever is the large key above the @key{RET} or |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
273 @key{ENTER} key, deletes the character before point, like @key{DEL}. |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
274 If that is @key{BACKSPACE}, and your keyboard also has @key{DELETE}, |
c3461a4e8d2e
Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents:
36654
diff
changeset
|
275 then @key{DELETE} deletes forwards, like @kbd{C-d}. |
25829 | 276 @item C-k |
277 Kill to the end of the line (@code{kill-line}). | |
278 @item M-d | |
279 Kill forward to the end of the next word (@code{kill-word}). | |
280 @item M-@key{DEL} | |
281 Kill back to the beginning of the previous word | |
282 (@code{backward-kill-word}). | |
283 @end table | |
284 | |
285 @cindex killing characters and lines | |
286 @cindex deleting characters and lines | |
287 @cindex erasing characters and lines | |
288 You already know about the @key{DEL} key which deletes the character | |
289 before point (that is, before the cursor). Another key, @kbd{Control-d} | |
290 (@kbd{C-d} for short), deletes the character after point (that is, the | |
291 character that the cursor is on). This shifts the rest of the text on | |
292 the line to the left. If you type @kbd{C-d} at the end of a line, it | |
293 joins together that line and the next line. | |
294 | |
295 To erase a larger amount of text, use the @kbd{C-k} key, which kills a | |
296 line at a time. If you type @kbd{C-k} at the beginning or middle of a | |
297 line, it kills all the text up to the end of the line. If you type | |
298 @kbd{C-k} at the end of a line, it joins that line and the next line. | |
299 | |
300 @xref{Killing}, for more flexible ways of killing text. | |
301 | |
302 @node Undo | |
303 @section Undoing Changes | |
304 @cindex undo | |
305 @cindex changes, undoing | |
306 | |
307 You can undo all the recent changes in the buffer text, up to a | |
308 certain point. Each buffer records changes individually, and the undo | |
309 command always applies to the current buffer. Usually each editing | |
310 command makes a separate entry in the undo records, but some commands | |
311 such as @code{query-replace} make many entries, and very simple commands | |
312 such as self-inserting characters are often grouped to make undoing less | |
313 tedious. | |
314 | |
315 @table @kbd | |
316 @item C-x u | |
317 Undo one batch of changes---usually, one command worth (@code{undo}). | |
318 @item C-_ | |
319 The same. | |
320 @item C-u C-x u | |
321 Undo one batch of changes in the region. | |
322 @end table | |
323 | |
324 @kindex C-x u | |
325 @kindex C-_ | |
326 @findex undo | |
327 The command @kbd{C-x u} or @kbd{C-_} is how you undo. The first time | |
328 you give this command, it undoes the last change. Point moves back to | |
329 where it was before the command that made the change. | |
330 | |
331 Consecutive repetitions of @kbd{C-_} or @kbd{C-x u} undo earlier and | |
332 earlier changes, back to the limit of the undo information available. | |
333 If all recorded changes have already been undone, the undo command | |
334 prints an error message and does nothing. | |
335 | |
336 Any command other than an undo command breaks the sequence of undo | |
337 commands. Starting from that moment, the previous undo commands become | |
338 ordinary changes that you can undo. Thus, to redo changes you have | |
339 undone, type @kbd{C-f} or any other command that will harmlessly break | |
340 the sequence of undoing, then type more undo commands. | |
341 | |
342 @cindex selective undo | |
343 @kindex C-u C-x u | |
344 Ordinary undo applies to all changes made in the current buffer. You | |
345 can also perform @dfn{selective undo}, limited to the current region. | |
346 To do this, specify the region you want, then run the @code{undo} | |
347 command with a prefix argument (the value does not matter): @kbd{C-u C-x | |
348 u} or @kbd{C-u C-_}. This undoes the most recent change in the region. | |
349 To undo further changes in the same region, repeat the @code{undo} | |
350 command (no prefix argument is needed). In Transient Mark mode, any use | |
351 of @code{undo} when there is an active region performs selective undo; | |
352 you do not need a prefix argument. | |
353 | |
354 If you notice that a buffer has been modified accidentally, the | |
355 easiest way to recover is to type @kbd{C-_} repeatedly until the stars | |
356 disappear from the front of the mode line. At this time, all the | |
357 modifications you made have been canceled. Whenever an undo command | |
358 makes the stars disappear from the mode line, it means that the buffer | |
359 contents are the same as they were when the file was last read in or | |
360 saved. | |
361 | |
362 If you do not remember whether you changed the buffer deliberately, | |
363 type @kbd{C-_} once. When you see the last change you made undone, you | |
364 will see whether it was an intentional change. If it was an accident, | |
365 leave it undone. If it was deliberate, redo the change as described | |
366 above. | |
367 | |
368 Not all buffers record undo information. Buffers whose names start with | |
369 spaces don't; these buffers are used internally by Emacs and its extensions | |
370 to hold text that users don't normally look at or edit. | |
371 | |
372 You cannot undo mere cursor motion; only changes in the buffer | |
373 contents save undo information. However, some cursor motion commands | |
374 set the mark, so if you use these commands from time to time, you can | |
375 move back to the neighborhoods you have moved through by popping the | |
376 mark ring (@pxref{Mark Ring}). | |
377 | |
378 @vindex undo-limit | |
379 @vindex undo-strong-limit | |
380 @cindex undo limit | |
381 When the undo information for a buffer becomes too large, Emacs | |
382 discards the oldest undo information from time to time (during garbage | |
383 collection). You can specify how much undo information to keep by | |
384 setting two variables: @code{undo-limit} and @code{undo-strong-limit}. | |
385 Their values are expressed in units of bytes of space. | |
386 | |
387 The variable @code{undo-limit} sets a soft limit: Emacs keeps undo | |
388 data for enough commands to reach this size, and perhaps exceed it, but | |
389 does not keep data for any earlier commands beyond that. Its default | |
390 value is 20000. The variable @code{undo-strong-limit} sets a stricter | |
391 limit: the command which pushes the size past this amount is itself | |
392 forgotten. Its default value is 30000. | |
393 | |
394 Regardless of the values of those variables, the most recent change is | |
395 never discarded, so there is no danger that garbage collection occurring | |
396 right after an unintentional large change might prevent you from undoing | |
397 it. | |
398 | |
399 The reason the @code{undo} command has two keys, @kbd{C-x u} and | |
400 @kbd{C-_}, set up to run it is that it is worthy of a single-character | |
401 key, but on some keyboards it is not obvious how to type @kbd{C-_}. | |
402 @kbd{C-x u} is an alternative you can type straightforwardly on any | |
403 terminal. | |
404 | |
405 @node Basic Files | |
406 @section Files | |
407 | |
408 The commands described above are sufficient for creating and altering | |
409 text in an Emacs buffer; the more advanced Emacs commands just make | |
410 things easier. But to keep any text permanently you must put it in a | |
411 @dfn{file}. Files are named units of text which are stored by the | |
412 operating system for you to retrieve later by name. To look at or use | |
413 the contents of a file in any way, including editing the file with | |
414 Emacs, you must specify the file name. | |
415 | |
416 Consider a file named @file{/usr/rms/foo.c}. In Emacs, to begin editing | |
417 this file, type | |
418 | |
419 @example | |
420 C-x C-f /usr/rms/foo.c @key{RET} | |
421 @end example | |
422 | |
423 @noindent | |
424 Here the file name is given as an @dfn{argument} to the command @kbd{C-x | |
425 C-f} (@code{find-file}). That command uses the @dfn{minibuffer} to | |
426 read the argument, and you type @key{RET} to terminate the argument | |
427 (@pxref{Minibuffer}).@refill | |
428 | |
429 Emacs obeys the command by @dfn{visiting} the file: creating a buffer, | |
430 copying the contents of the file into the buffer, and then displaying | |
431 the buffer for you to edit. If you alter the text, you can @dfn{save} | |
432 the new text in the file by typing @kbd{C-x C-s} (@code{save-buffer}). | |
433 This makes the changes permanent by copying the altered buffer contents | |
434 back into the file @file{/usr/rms/foo.c}. Until you save, the changes | |
435 exist only inside Emacs, and the file @file{foo.c} is unaltered. | |
436 | |
437 To create a file, just visit the file with @kbd{C-x C-f} as if it | |
438 already existed. This creates an empty buffer in which you can insert | |
439 the text you want to put in the file. The file is actually created when | |
440 you save this buffer with @kbd{C-x C-s}. | |
441 | |
442 Of course, there is a lot more to learn about using files. @xref{Files}. | |
443 | |
444 @node Basic Help | |
445 @section Help | |
446 | |
447 @cindex getting help with keys | |
448 If you forget what a key does, you can find out with the Help | |
449 character, which is @kbd{C-h} (or @key{F1}, which is an alias for | |
450 @kbd{C-h}). Type @kbd{C-h k} followed by the key you want to know | |
451 about; for example, @kbd{C-h k C-n} tells you all about what @kbd{C-n} | |
452 does. @kbd{C-h} is a prefix key; @kbd{C-h k} is just one of its | |
453 subcommands (the command @code{describe-key}). The other subcommands of | |
454 @kbd{C-h} provide different kinds of help. Type @kbd{C-h} twice to get | |
455 a description of all the help facilities. @xref{Help}.@refill | |
456 | |
457 @node Blank Lines | |
458 @section Blank Lines | |
459 | |
460 @cindex inserting blank lines | |
461 @cindex deleting blank lines | |
462 Here are special commands and techniques for putting in and taking out | |
463 blank lines. | |
464 | |
465 @c widecommands | |
466 @table @kbd | |
467 @item C-o | |
468 Insert one or more blank lines after the cursor (@code{open-line}). | |
469 @item C-x C-o | |
470 Delete all but one of many consecutive blank lines | |
471 (@code{delete-blank-lines}). | |
472 @end table | |
473 | |
474 @kindex C-o | |
475 @kindex C-x C-o | |
476 @cindex blank lines | |
477 @findex open-line | |
478 @findex delete-blank-lines | |
479 When you want to insert a new line of text before an existing line, you | |
480 can do it by typing the new line of text, followed by @key{RET}. | |
481 However, it may be easier to see what you are doing if you first make a | |
482 blank line and then insert the desired text into it. This is easy to do | |
483 using the key @kbd{C-o} (@code{open-line}), which inserts a newline | |
484 after point but leaves point in front of the newline. After @kbd{C-o}, | |
485 type the text for the new line. @kbd{C-o F O O} has the same effect as | |
486 @w{@kbd{F O O @key{RET}}}, except for the final location of point. | |
487 | |
488 You can make several blank lines by typing @kbd{C-o} several times, or | |
489 by giving it a numeric argument to tell it how many blank lines to make. | |
490 @xref{Arguments}, for how. If you have a fill prefix, then @kbd{C-o} | |
491 command inserts the fill prefix on the new line, when you use it at the | |
492 beginning of a line. @xref{Fill Prefix}. | |
493 | |
494 The easy way to get rid of extra blank lines is with the command | |
495 @kbd{C-x C-o} (@code{delete-blank-lines}). @kbd{C-x C-o} in a run of | |
496 several blank lines deletes all but one of them. @kbd{C-x C-o} on a | |
497 solitary blank line deletes that blank line. When point is on a | |
498 nonblank line, @kbd{C-x C-o} deletes any blank lines following that | |
499 nonblank line. | |
500 | |
501 @node Continuation Lines | |
502 @section Continuation Lines | |
503 | |
504 @cindex continuation line | |
505 @cindex wrapping | |
506 @cindex line wrapping | |
507 If you add too many characters to one line without breaking it with | |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
508 @key{RET}, the line grows to occupy two (or more) lines on the screen. |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
509 On graphical displays, Emacs indicates line wrapping with small bent |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
510 arrows in the fringes to the left and right of the window. On |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
511 text-only terminals, Emacs displays a @samp{\} character at the right |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
512 margin of a screen line if it is not the last in its text line. This |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
513 @samp{\} character says that the following screen line is not really a |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
514 distinct line in the text, just a @dfn{continuation} of a line too |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
515 long to fit the screen. Continuation is also called @dfn{line |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
516 wrapping}. |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
517 |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
518 When line wrapping occurs before a character that is wider than one |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
519 column, some columns at the end of the previous screen line may be |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
520 ``empty.'' In this case, Emacs displays additional @samp{\} |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
521 characters in the ``empty'' columns, just before the @samp{\} |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
522 character that indicates continuation. |
25829 | 523 |
524 Sometimes it is nice to have Emacs insert newlines automatically when | |
525 a line gets too long. Continuation on the screen does not do that. Use | |
526 Auto Fill mode (@pxref{Filling}) if that's what you want. | |
527 | |
528 @vindex truncate-lines | |
529 @cindex truncation | |
530 As an alternative to continuation, Emacs can display long lines by | |
35206 | 531 @dfn{truncation}. This means that all the characters that do not fit |
532 in the width of the screen or window do not appear at all. They | |
533 remain in the buffer, temporarily invisible. On terminals, @samp{$} | |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
534 in the last column informs you that the line has been truncated on the |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
535 display. On window systems, a small straight arrow in the fringe to |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
536 the right of the window indicates a truncated line. |
25829 | 537 |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
538 @findex toggle-truncate-lines |
25829 | 539 Truncation instead of continuation happens whenever horizontal |
540 scrolling is in use, and optionally in all side-by-side windows | |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
541 (@pxref{Windows}). You can enable or disable truncation for a |
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
542 particular buffer with the command @kbd{M-x toggle-truncate-lines}. |
31952
9ab15b2742ba
(Continuation Lines): Add description of
Gerd Moellmann <gerd@gnu.org>
parents:
27220
diff
changeset
|
543 |
36209
e80f51792a09
Fix xref to Display Custom.
Richard M. Stallman <rms@gnu.org>
parents:
36140
diff
changeset
|
544 @xref{Display Custom}, for additional variables that affect how text is |
25829 | 545 displayed. |
546 | |
547 @node Position Info | |
548 @section Cursor Position Information | |
549 | |
550 Here are commands to get information about the size and position of | |
551 parts of the buffer, and to count lines. | |
552 | |
553 @table @kbd | |
554 @item M-x what-page | |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
555 Display the page number of point, and the line number within the page. |
25829 | 556 @item M-x what-line |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
557 Display the line number of point in the buffer. |
25829 | 558 @item M-x line-number-mode |
27220
dddb1bca9704
Reference column-number-mode, hl-line-mode, blink-cursor-mode.
Dave Love <fx@gnu.org>
parents:
25829
diff
changeset
|
559 @itemx M-x column-number-mode |
dddb1bca9704
Reference column-number-mode, hl-line-mode, blink-cursor-mode.
Dave Love <fx@gnu.org>
parents:
25829
diff
changeset
|
560 Toggle automatic display of current line number or column number. |
dddb1bca9704
Reference column-number-mode, hl-line-mode, blink-cursor-mode.
Dave Love <fx@gnu.org>
parents:
25829
diff
changeset
|
561 @xref{Optional Mode Line}. |
25829 | 562 @item M-= |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
563 Display the number of lines in the current region (@code{count-lines-region}). |
25829 | 564 @xref{Mark}, for information about the region. |
565 @item C-x = | |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
566 Display the character code of character after point, character position of |
25829 | 567 point, and column of point (@code{what-cursor-position}). |
27220
dddb1bca9704
Reference column-number-mode, hl-line-mode, blink-cursor-mode.
Dave Love <fx@gnu.org>
parents:
25829
diff
changeset
|
568 @item M-x hl-line-mode |
36140
af4e219e9947
Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents:
35923
diff
changeset
|
569 Enable or disable highlighting of the current line. |
25829 | 570 @end table |
571 | |
572 @findex what-page | |
573 @findex what-line | |
574 @cindex line number commands | |
575 @cindex location of point | |
576 @cindex cursor location | |
577 @cindex point location | |
578 There are two commands for working with line numbers. @kbd{M-x | |
579 what-line} computes the current line number and displays it in the echo | |
580 area. To go to a given line by number, use @kbd{M-x goto-line}; it | |
581 prompts you for the number. These line numbers count from one at the | |
582 beginning of the buffer. | |
583 | |
584 You can also see the current line number in the mode line; @xref{Mode | |
585 Line}. If you narrow the buffer, then the line number in the mode line | |
586 is relative to the accessible portion (@pxref{Narrowing}). By contrast, | |
587 @code{what-line} shows both the line number relative to the narrowed | |
588 region and the line number relative to the whole buffer. | |
589 | |
590 By contrast, @kbd{M-x what-page} counts pages from the beginning of | |
591 the file, and counts lines within the page, printing both numbers. | |
592 @xref{Pages}. | |
593 | |
594 @kindex M-= | |
595 @findex count-lines-region | |
596 While on this subject, we might as well mention @kbd{M-=} (@code{count-lines-region}), | |
597 which prints the number of lines in the region (@pxref{Mark}). | |
598 @xref{Pages}, for the command @kbd{C-x l} which counts the lines in the | |
599 current page. | |
600 | |
601 @kindex C-x = | |
602 @findex what-cursor-position | |
603 The command @kbd{C-x =} (@code{what-cursor-position}) can be used to find out | |
604 the column that the cursor is in, and other miscellaneous information about | |
605 point. It prints a line in the echo area that looks like this: | |
606 | |
607 @smallexample | |
608 Char: c (0143, 99, 0x63) point=21044 of 26883(78%) column 53 | |
609 @end smallexample | |
610 | |
611 @noindent | |
612 (In fact, this is the output produced when point is before the | |
613 @samp{column} in the example.) | |
614 | |
615 The four values after @samp{Char:} describe the character that follows | |
616 point, first by showing it and then by giving its character code in | |
617 octal, decimal and hex. For a non-ASCII multibyte character, these are | |
618 followed by @samp{ext} and the character's representation, in hex, in | |
619 the buffer's coding system, if that coding system encodes the character | |
620 safely and with a single byte (@pxref{Coding Systems}). If the | |
621 character's encoding is longer than one byte, Emacs shows @samp{ext ...}. | |
622 | |
623 @samp{point=} is followed by the position of point expressed as a character | |
624 count. The front of the buffer counts as position 1, one character later | |
625 as 2, and so on. The next, larger, number is the total number of characters | |
626 in the buffer. Afterward in parentheses comes the position expressed as a | |
627 percentage of the total size. | |
628 | |
629 @samp{column} is followed by the horizontal position of point, in | |
630 columns from the left edge of the window. | |
631 | |
632 If the buffer has been narrowed, making some of the text at the | |
633 beginning and the end temporarily inaccessible, @kbd{C-x =} prints | |
634 additional text describing the currently accessible range. For example, it | |
635 might display this: | |
636 | |
637 @smallexample | |
638 Char: C (0103, 67, 0x43) point=252 of 889(28%) <231 - 599> column 0 | |
639 @end smallexample | |
640 | |
641 @noindent | |
642 where the two extra numbers give the smallest and largest character | |
643 position that point is allowed to assume. The characters between those | |
644 two positions are the accessible ones. @xref{Narrowing}. | |
645 | |
646 If point is at the end of the buffer (or the end of the accessible | |
647 part), the @w{@kbd{C-x =}} output does not describe a character after | |
648 point. The output might look like this: | |
649 | |
650 @smallexample | |
651 point=26957 of 26956(100%) column 0 | |
652 @end smallexample | |
653 | |
654 @w{@kbd{C-u C-x =}} displays additional information about a character, | |
655 in place of the buffer coordinates and column: the character set name | |
656 and the codes that identify the character within that character set; | |
657 ASCII characters are identified as belonging to the @code{ASCII} | |
658 character set. In addition, the full character encoding, even if it | |
659 takes more than a single byte, is shown after @samp{ext}. Here's an | |
660 example for a Latin-1 character A with a grave accent in a buffer whose | |
661 coding system is iso-2022-7bit@footnote{On terminals that support | |
662 Latin-1 characters, the character shown after @samp{Char:} is displayed | |
663 as the actual glyph of A with grave accent.}: | |
664 | |
665 @example | |
666 Char: @`A (04300, 2240, 0x8c0, ext ESC , A @@) (latin-iso8859-1 64) | |
667 @end example | |
668 | |
669 @node Arguments | |
670 @section Numeric Arguments | |
671 @cindex numeric arguments | |
672 @cindex prefix arguments | |
36263
11db0318031d
Remove redundant index entries.
Eli Zaretskii <eliz@gnu.org>
parents:
36209
diff
changeset
|
673 @cindex arguments to commands |
25829 | 674 |
675 In mathematics and computer usage, the word @dfn{argument} means | |
676 ``data provided to a function or operation.'' You can give any Emacs | |
677 command a @dfn{numeric argument} (also called a @dfn{prefix argument}). | |
678 Some commands interpret the argument as a repetition count. For | |
679 example, @kbd{C-f} with an argument of ten moves forward ten characters | |
680 instead of one. With these commands, no argument is equivalent to an | |
681 argument of one. Negative arguments tell most such commands to move or | |
682 act in the opposite direction. | |
683 | |
684 @kindex M-1 | |
685 @kindex M-@t{-} | |
686 @findex digit-argument | |
687 @findex negative-argument | |
688 If your terminal keyboard has a @key{META} key, the easiest way to | |
689 specify a numeric argument is to type digits and/or a minus sign while | |
690 holding down the @key{META} key. For example, | |
691 @example | |
692 M-5 C-n | |
693 @end example | |
694 @noindent | |
695 would move down five lines. The characters @kbd{Meta-1}, @kbd{Meta-2}, | |
696 and so on, as well as @kbd{Meta--}, do this because they are keys bound | |
697 to commands (@code{digit-argument} and @code{negative-argument}) that | |
698 are defined to contribute to an argument for the next command. Digits | |
699 and @kbd{-} modified with Control, or Control and Meta, also specify | |
700 numeric arguments. | |
701 | |
702 @kindex C-u | |
703 @findex universal-argument | |
704 Another way of specifying an argument is to use the @kbd{C-u} | |
705 (@code{universal-argument}) command followed by the digits of the | |
706 argument. With @kbd{C-u}, you can type the argument digits without | |
707 holding down modifier keys; @kbd{C-u} works on all terminals. To type a | |
708 negative argument, type a minus sign after @kbd{C-u}. Just a minus sign | |
709 without digits normally means @minus{}1. | |
710 | |
711 @kbd{C-u} followed by a character which is neither a digit nor a minus | |
712 sign has the special meaning of ``multiply by four.'' It multiplies the | |
713 argument for the next command by four. @kbd{C-u} twice multiplies it by | |
714 sixteen. Thus, @kbd{C-u C-u C-f} moves forward sixteen characters. This | |
715 is a good way to move forward ``fast,'' since it moves about 1/5 of a line | |
716 in the usual size screen. Other useful combinations are @kbd{C-u C-n}, | |
717 @kbd{C-u C-u C-n} (move down a good fraction of a screen), @kbd{C-u C-u | |
718 C-o} (make ``a lot'' of blank lines), and @kbd{C-u C-k} (kill four | |
719 lines).@refill | |
720 | |
721 Some commands care only about whether there is an argument, and not about | |
722 its value. For example, the command @kbd{M-q} (@code{fill-paragraph}) with | |
723 no argument fills text; with an argument, it justifies the text as well. | |
724 (@xref{Filling}, for more information on @kbd{M-q}.) Plain @kbd{C-u} is a | |
725 handy way of providing an argument for such commands. | |
726 | |
727 Some commands use the value of the argument as a repeat count, but do | |
728 something peculiar when there is no argument. For example, the command | |
729 @kbd{C-k} (@code{kill-line}) with argument @var{n} kills @var{n} lines, | |
730 including their terminating newlines. But @kbd{C-k} with no argument is | |
731 special: it kills the text up to the next newline, or, if point is right at | |
732 the end of the line, it kills the newline itself. Thus, two @kbd{C-k} | |
733 commands with no arguments can kill a nonblank line, just like @kbd{C-k} | |
734 with an argument of one. (@xref{Killing}, for more information on | |
735 @kbd{C-k}.)@refill | |
736 | |
737 A few commands treat a plain @kbd{C-u} differently from an ordinary | |
738 argument. A few others may treat an argument of just a minus sign | |
739 differently from an argument of @minus{}1. These unusual cases are | |
740 described when they come up; they are always for reasons of convenience | |
741 of use of the individual command. | |
742 | |
743 You can use a numeric argument to insert multiple copies of a | |
744 character. This is straightforward unless the character is a digit; for | |
745 example, @kbd{C-u 6 4 a} inserts 64 copies of the character @samp{a}. | |
746 But this does not work for inserting digits; @kbd{C-u 6 4 1} specifies | |
747 an argument of 641, rather than inserting anything. To separate the | |
748 digit to insert from the argument, type another @kbd{C-u}; for example, | |
749 @kbd{C-u 6 4 C-u 1} does insert 64 copies of the character @samp{1}. | |
750 | |
751 We use the term ``prefix argument'' as well as ``numeric argument'' to | |
752 emphasize that you type the argument before the command, and to | |
753 distinguish these arguments from minibuffer arguments that come after | |
754 the command. | |
755 | |
756 @node Repeating | |
757 @section Repeating a Command | |
758 @cindex repeating a command | |
759 | |
760 @kindex C-x z | |
761 @findex repeat | |
762 The command @kbd{C-x z} (@code{repeat}) provides another way to repeat | |
763 an Emacs command many times. This command repeats the previous Emacs | |
764 command, whatever that was. Repeating a command uses the same arguments | |
765 that were used before; it does not read new arguments each time. | |
766 | |
767 To repeat the command more than once, type additional @kbd{z}'s: each | |
768 @kbd{z} repeats the command one more time. Repetition ends when you | |
769 type a character other than @kbd{z}, or press a mouse button. | |
770 | |
771 For example, suppose you type @kbd{C-u 2 0 C-d} to delete 20 | |
772 characters. You can repeat that command (including its argument) three | |
773 additional times, to delete a total of 80 characters, by typing @kbd{C-x | |
774 z z z}. The first @kbd{C-x z} repeats the command once, and each | |
775 subsequent @kbd{z} repeats it once again. | |
776 |