annotate man/basic.texi @ 36167:aae9fb198e83

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