comparison man/basic.texi @ 71045:ddc3087f4c41

Many simplifications and improvements in wording.
author Richard M. Stallman <rms@gnu.org>
date Mon, 29 May 2006 01:58:19 +0000
parents 4bb94c09a47d
children 542cd4440e5f
comparison
equal deleted inserted replaced
71044:da5fa425123d 71045:ddc3087f4c41
5 @node Basic, Minibuffer, Exiting, Top 5 @node Basic, Minibuffer, Exiting, Top
6 @chapter Basic Editing Commands 6 @chapter Basic Editing Commands
7 7
8 @kindex C-h t 8 @kindex C-h t
9 @findex help-with-tutorial 9 @findex help-with-tutorial
10 We now give the basics of how to enter text, make corrections, and 10 Here we explain the basics of how to enter text, make corrections,
11 save the text in a file. If this material is new to you, you might 11 and save the text in a file. If this material is new to you, we
12 learn it more easily by running the Emacs learn-by-doing tutorial. To 12 suggest you first run the Emacs learn-by-doing tutorial, by typing
13 use the tutorial, run Emacs and type @kbd{Control-h t} 13 @kbd{Control-h t} inside Emacs. (@code{help-with-tutorial}).
14 (@code{help-with-tutorial}). 14
15 15 To clear and redisplay the screen, type @kbd{C-l} (@code{recenter}).
16 To clear the screen and redisplay, type @kbd{C-l} (@code{recenter}).
17 16
18 @menu 17 @menu
19 18
20 * Inserting Text:: Inserting text by simply typing it. 19 * Inserting Text:: Inserting text by simply typing it.
21 * Moving Point:: How to move the cursor to the place where you want to 20 * Moving Point:: Moving the cursor to the place where you want to
22 change something. 21 change something.
23 * Erasing:: Deleting and killing text. 22 * Erasing:: Deleting and killing text.
24 * Basic Undo:: Undoing recent changes in the text. 23 * Basic Undo:: Undoing recent changes in the text.
25 * Files: Basic Files. Visiting, creating, and saving files. 24 * Files: Basic Files. Visiting, creating, and saving files.
26 * Help: Basic Help. Asking what a character does. 25 * Help: Basic Help. Asking what a character does.
27 * Blank Lines:: Commands to make or delete blank lines. 26 * Blank Lines:: Making and deleting blank lines.
28 * Continuation Lines:: Lines too wide for the screen. 27 * Continuation Lines:: How Emacs displays lines too wide for the screen.
29 * Position Info:: What page, line, row, or column is point on? 28 * Position Info:: What page, line, row, or column is point on?
30 * Arguments:: Numeric arguments for repeating a command. 29 * Arguments:: Numeric arguments for repeating a command N times.
31 * Repeating:: A short-cut for repeating the previous command. 30 * Repeating:: Repeating the previous command quickly.
32 @end menu 31 @end menu
33 32
34 @node Inserting Text 33 @node Inserting Text
35 @section Inserting Text 34 @section Inserting Text
36 35
37 @cindex insertion 36 @cindex insertion
38 @cindex graphic characters 37 @cindex graphic characters
39 To insert printing characters into the text you are editing, just type 38 Typing printing characters inserts them into the text you are
40 them. This inserts the characters you type into the buffer at the 39 editing. It inserts them into the buffer at the cursor; more
41 cursor (that is, at @dfn{point}; @pxref{Point}). The cursor moves 40 precisely, it inserts them at @dfn{point}, but the cursor normally
42 forward, and any text after the cursor moves forward too. If the text 41 shows where point is. @xref{Point}.
43 in the buffer is @samp{FOOBAR}, with the cursor before the @samp{B}, 42
44 then if you type @kbd{XX}, you get @samp{FOOXXBAR}, with the cursor 43 Insertion moves the cursor forward, and the following text moves
45 still before the @samp{B}. 44 forward with the cursor. If the text in the buffer is @samp{FOOBAR},
45 with the cursor before the @samp{B}, and you type @kbd{XX}, you get
46 @samp{FOOXXBAR}, with the cursor still before the @samp{B}.
46 47
47 To @dfn{delete} text you have just inserted, use the large key 48 To @dfn{delete} text you have just inserted, use the large key
48 labeled @key{DEL}, @key{BACKSPACE} or @key{DELETE} which is a short 49 labeled @key{DEL}, @key{BACKSPACE} or @key{DELETE} which is a short
49 distance above the @key{RET} or @key{ENTER} key. This is the key you 50 distance above the @key{RET} or @key{ENTER} key. Regardless of the
50 normally use, outside Emacs, for erasing the last character that you 51 label on that key, Emacs thinks of it as @key{DEL}, and that's what we
51 typed. Regardless of the label on that key, Emacs thinks of it as 52 call it in this manual. @key{DEL} is the key you normally use outside
52 @key{DEL}, and that's what we call it in this manual. 53 Emacs to erase the last character that you typed.
53 54
54 The @key{DEL} key deletes the character @emph{before} the cursor. 55 The @key{DEL} key deletes the character @emph{before} the cursor.
55 As a consequence, the cursor and all the characters after it move 56 As a consequence, the cursor and all the characters after it move
56 backwards. If you type a printing character and then type @key{DEL}, 57 backwards. If you type a printing character and then type @key{DEL},
57 they cancel out. 58 they cancel out.
58 59
59 On most computers, Emacs recognizes automatically which key ought to 60 On most computers, Emacs sets up @key{DEL} automatically. In some
60 be @key{DEL}, and sets it up that way. But in some cases, especially 61 cases, especially with text-only terminals, Emacs may guess wrong. If
61 with text-only terminals, you will need to tell Emacs which key to use 62 the key that ought to erase the last character doesn't do it in Emacs,
62 for that purpose. If the large key not far above the @key{RET} or 63 see @ref{DEL Does Not Delete}.
63 @key{ENTER} key doesn't delete backwards, you need to do this. 64
64 @xref{DEL Does Not Delete}, for an explanation of how. 65 Most PC keyboards have both a @key{BACKSPACE} key a little ways
65 66 above @key{RET} or @key{ENTER}, and a @key{DELETE} key elsewhere. On
66 Most PC keyboards have both a @key{BACKSPACE} key not far above 67 these keyboards, Emacs tries to set up @key{BACKSPACE} as @key{DEL}.
67 @key{RET} or @key{ENTER}, and a @key{DELETE} key elsewhere. On these 68 The @key{DELETE} key deletes ``forwards'' like @kbd{C-d} (see below),
68 keyboards, Emacs supports when possible the usual convention that the 69 which means it deletes the character underneath the cursor (after
69 @key{BACKSPACE} key deletes backwards (it is @key{DEL}), while the 70 point).
70 @key{DELETE} key deletes ``forwards,'' deleting the character after
71 point, the one underneath the cursor, like @kbd{C-d} (see below).
72 71
73 @kindex RET 72 @kindex RET
74 @cindex newline 73 @cindex newline
75 To end a line and start typing a new one, type @key{RET}. This 74 To end a line and start typing a new one, type @key{RET}. (This
76 inserts a newline character in the buffer. If point is in the middle of 75 key may be labeled @key{RETURN} or @key{ENTER}, but in Emacs we call
77 a line, the effect is to split the line. Typing @key{DEL} when the cursor is 76 it @key{RET}.) This inserts a newline character in the buffer. If
78 at the beginning of a line deletes the preceding newline, thus joining 77 point is at the end of the line, this creates a new blank line after
79 the line with the preceding line. 78 it. If point is in the middle of a line, the effect is to split that
80 79 line. Typing @key{DEL} when the cursor is at the beginning of a line
81 Emacs can split lines automatically when they become too long, if you 80 deletes the preceding newline character, thus joining the line with
82 turn on a special minor mode called @dfn{Auto Fill} mode. 81 the one before it.
83 @xref{Filling}, for how to use Auto Fill mode and other modes for 82
84 @dfn{filling} text. 83 Emacs can split lines automatically when they become too long, if
85 84 you turn on a special minor mode called @dfn{Auto Fill} mode.
86 If you prefer to have text characters replace (overwrite) existing 85 @xref{Filling}, for Auto Fill mode and other methods of @dfn{filling}
87 text rather than shove it to the right, you can enable Overwrite mode, 86 text.
88 a minor mode. @xref{Minor Modes}. 87
88 If you prefer printing characters to replace (overwrite) existing
89 text, rather than shove it to the right, you should enable Overwrite
90 mode, a minor mode. @xref{Minor Modes}.
89 91
90 @cindex quoting 92 @cindex quoting
91 @kindex C-q 93 @kindex C-q
92 @findex quoted-insert 94 @findex quoted-insert
93 Direct insertion works for printing characters and @key{SPC}, but other 95 Only printing characters and @key{SPC} insert themselves in Emacs.
94 characters act as editing commands and do not insert themselves. If you 96 Other characters act as editing commands and do not insert themselves.
95 need to insert a control character or a character whose code is above 200 97 These include control characters, and characters with codes above 200
96 octal, you must @dfn{quote} it by typing the character @kbd{Control-q} 98 octal. If you need to insert one of these characters in the buffer,
97 (@code{quoted-insert}) first. (This character's name is normally written 99 you must @dfn{quote} it by typing the character @kbd{Control-q}
98 @kbd{C-q} for short.) There are two ways to use @kbd{C-q}:@refill 100 (@code{quoted-insert}) first. (This character's name is normally
101 written @kbd{C-q} for short.) There are two ways to use
102 @kbd{C-q}:
99 103
100 @itemize @bullet 104 @itemize @bullet
101 @item 105 @item
102 @kbd{C-q} followed by any non-graphic character (even @kbd{C-g}) 106 @kbd{C-q} followed by any non-graphic character (even @kbd{C-g})
103 inserts that character. 107 inserts that character.
129 To use decimal or hexadecimal instead of octal, set the variable 133 To use decimal or hexadecimal instead of octal, set the variable
130 @code{read-quoted-char-radix} to 10 or 16. If the radix is greater than 134 @code{read-quoted-char-radix} to 10 or 16. If the radix is greater than
131 10, some letters starting with @kbd{a} serve as part of a character 135 10, some letters starting with @kbd{a} serve as part of a character
132 code, just like digits. 136 code, just like digits.
133 137
134 A numeric argument to @kbd{C-q} specifies how many copies of the 138 A numeric argument tells @kbd{C-q} how many copies of the quoted
135 quoted character should be inserted (@pxref{Arguments}). 139 character to insert (@pxref{Arguments}).
136 140
137 @findex newline 141 @findex newline
138 @findex self-insert 142 @findex self-insert
139 Customization information: @key{DEL} in most modes runs the command 143 Customization information: @key{DEL} in most modes runs the command
140 @code{delete-backward-char}; @key{RET} runs the command @code{newline}, and 144 @code{delete-backward-char}; @key{RET} runs the command
141 self-inserting printing characters run the command @code{self-insert}, 145 @code{newline}, and self-inserting printing characters run the command
142 which inserts whatever character was typed to invoke it. Some major modes 146 @code{self-insert}, which inserts whatever character you typed. Some
143 rebind @key{DEL} to other commands. 147 major modes rebind @key{DEL} to other commands.
144 148
145 @node Moving Point 149 @node Moving Point
146 @section Changing the Location of Point 150 @section Changing the Location of Point
147 151
148 @cindex arrow keys 152 @cindex arrow keys
197 @item M-f 201 @item M-f
198 Move forward one word (@code{forward-word}). 202 Move forward one word (@code{forward-word}).
199 @item M-b 203 @item M-b
200 Move backward one word (@code{backward-word}). 204 Move backward one word (@code{backward-word}).
201 @item C-n 205 @item C-n
202 Move down one line, vertically (@code{next-line}). This command 206 Move down one line vertically (@code{next-line}). This command
203 attempts to keep the horizontal position unchanged, so if you start in 207 attempts to keep the horizontal position unchanged, so if you start in
204 the middle of one line, you end in the middle of the next. The 208 the middle of one line, you move to the middle of the next. The
205 down-arrow key does the same thing. 209 down-arrow key does the same thing.
206 @item C-p 210 @item C-p
207 Move up one line, vertically (@code{previous-line}). The up-arrow key 211 Move up one line, vertically (@code{previous-line}). The up-arrow key
208 has the same effect. 212 has the same effect. This command preserves position within the line,
213 like @kbd{C-n}.
209 @item M-r 214 @item M-r
210 Move point to left margin, vertically centered in the window 215 Move point to left margin, vertically centered in the window
211 (@code{move-to-window-line}). Text does not move on the screen. 216 (@code{move-to-window-line}). Text does not move on the screen.
212 217 A numeric argument says which screen line to place point on, counting
213 A numeric argument says which screen line to place point on. It counts 218 downward from the top of the window (zero means the top line). A
214 screen lines down from the top of the window (zero for the top line). A 219 negative argument counts lines up from the bottom (@minus{}1 means the
215 negative argument counts lines from the bottom (@minus{}1 for the bottom 220 bottom line).
216 line).
217 @item M-< 221 @item M-<
218 Move to the top of the buffer (@code{beginning-of-buffer}). With 222 Move to the top of the buffer (@code{beginning-of-buffer}). With
219 numeric argument @var{n}, move to @var{n}/10 of the way from the top. 223 numeric argument @var{n}, move to @var{n}/10 of the way from the top.
220 @xref{Arguments}, for more information on numeric arguments.@refill 224 @xref{Arguments}, for more information on numeric arguments.@refill
221 @item M-> 225 @item M->
226 Scroll the display one screen forward, and move point if necessary to 230 Scroll the display one screen forward, and move point if necessary to
227 put it on the screen (@code{scroll-up}). This doesn't always move 231 put it on the screen (@code{scroll-up}). This doesn't always move
228 point, but it is commonly used to do so. If your keyboard has a 232 point, but it is commonly used to do so. If your keyboard has a
229 @key{PAGEDOWN} or @key{PRIOR} key, it does the same thing. 233 @key{PAGEDOWN} or @key{PRIOR} key, it does the same thing.
230 234
231 Scrolling commands are further described in @ref{Scrolling}. 235 Scrolling commands are described further in @ref{Scrolling}.
232 @item M-v 236 @item M-v
233 @itemx @key{PAGEUP} 237 @itemx @key{PAGEUP}
234 @itemx @key{NEXT} 238 @itemx @key{NEXT}
235 Scroll one screen backward, and move point if necessary to put it on 239 Scroll one screen backward, and move point if necessary to put it on
236 the screen (@code{scroll-down}). This doesn't always move point, but 240 the screen (@code{scroll-down}). This doesn't always move point, but
242 @item M-g M-g 246 @item M-g M-g
243 @itemx M-g g 247 @itemx M-g g
244 @itemx M-x goto-line 248 @itemx M-x goto-line
245 Read a number @var{n} and move point to the beginning of line number 249 Read a number @var{n} and move point to the beginning of line number
246 @var{n}. Line 1 is the beginning of the buffer. If point is on or 250 @var{n}. Line 1 is the beginning of the buffer. If point is on or
247 just after a number, then that is the default for @var{n}, if you just 251 just after a number in the buffer, and you type @key{RET} with the
248 press @key{RET} with an empty minibuffer. 252 minibuffer empty, that number is used for @var{n}.
249 @item C-x C-n 253 @item C-x C-n
250 @findex set-goal-column 254 @findex set-goal-column
251 @kindex C-x C-n 255 @kindex C-x C-n
252 Use the current column of point as the @dfn{semipermanent goal column} for 256 Use the current column of point as the @dfn{semipermanent goal column}
253 @kbd{C-n} and @kbd{C-p} (@code{set-goal-column}). Henceforth, those 257 for @kbd{C-n} and @kbd{C-p} (@code{set-goal-column}). Henceforth,
254 commands always move to this column in each line moved into, or as 258 those commands always try move to this column, or as close as possible
255 close as possible given the contents of the line. This goal column remains 259 to it, after moving vertically. The goal column remains in effect
256 in effect until canceled. 260 until canceled.
257 @item C-u C-x C-n 261 @item C-u C-x C-n
258 Cancel the goal column. Henceforth, @kbd{C-n} and @kbd{C-p} once 262 Cancel the goal column. Henceforth, @kbd{C-n} and @kbd{C-p} try to
259 again try to stick to a fixed horizontal position, as usual. 263 preserve the horizontal position, as usual.
260 @end table 264 @end table
261 265
262 @vindex track-eol 266 @vindex track-eol
263 If you set the variable @code{track-eol} to a non-@code{nil} value, 267 If you set the variable @code{track-eol} to a non-@code{nil} value,
264 then @kbd{C-n} and @kbd{C-p}, when starting at the end of the line, move 268 then @kbd{C-n} and @kbd{C-p}, when starting at the end of the line, move
265 to the end of another line. Normally, @code{track-eol} is @code{nil}. 269 to the end of another line. Normally, @code{track-eol} is @code{nil}.
266 @xref{Variables}, for how to set variables such as @code{track-eol}. 270 @xref{Variables}, for how to set variables such as @code{track-eol}.
267 271
268 @vindex next-line-add-newlines 272 @vindex next-line-add-newlines
269 @kbd{C-n} normally stops at the end of the buffer when you use it on 273 @kbd{C-n} normally stops at the end of the buffer when you use it on
270 the last line of the buffer. But if you set the variable 274 the last line of the buffer. However, if you set the variable
271 @code{next-line-add-newlines} to a non-@code{nil} value, @kbd{C-n} on 275 @code{next-line-add-newlines} to a non-@code{nil} value, @kbd{C-n} on
272 the last line of a buffer creates an additional line at the end and 276 the last line of a buffer creates an additional line at the end and
273 moves down onto it. 277 moves down into it.
274 278
275 @node Erasing 279 @node Erasing
276 @section Erasing Text 280 @section Erasing Text
277 281
278 @table @kbd 282 @table @kbd
301 You already know about the @key{DEL} key which deletes the character 305 You already know about the @key{DEL} key which deletes the character
302 before point (that is, before the cursor). Another key, @kbd{Control-d} 306 before point (that is, before the cursor). Another key, @kbd{Control-d}
303 (@kbd{C-d} for short), deletes the character after point (that is, the 307 (@kbd{C-d} for short), deletes the character after point (that is, the
304 character that the cursor is on). This shifts the rest of the text on 308 character that the cursor is on). This shifts the rest of the text on
305 the line to the left. If you type @kbd{C-d} at the end of a line, it 309 the line to the left. If you type @kbd{C-d} at the end of a line, it
306 joins together that line and the next line. 310 joins that line with the following line.
307 311
308 To erase a larger amount of text, use the @kbd{C-k} key, which kills a 312 To erase a larger amount of text, use the @kbd{C-k} key, which
309 line at a time. If you type @kbd{C-k} at the beginning or middle of a 313 erases (kills) a line at a time. If you type @kbd{C-k} at the
310 line, it kills all the text up to the end of the line. If you type 314 beginning or middle of a line, it kills all the text up to the end of
311 @kbd{C-k} at the end of a line, it joins that line and the next line. 315 the line. If you type @kbd{C-k} at the end of a line, it joins that
316 line with the following line.
312 317
313 @xref{Killing}, for more flexible ways of killing text. 318 @xref{Killing}, for more flexible ways of killing text.
314 319
315 @node Basic Undo 320 @node Basic Undo
316 @section Undoing Changes 321 @section Undoing Changes
317 322
318 Emacs records a list of changes made in the buffer text, so you can 323 Emacs records a list of changes made in the buffer text, so you can
319 you can undo all the recent changes, as far as the records go. 324 you can undo recent changes, as far as the records go.
320 Usually each editing command makes a separate entry in the undo 325 Usually each editing command makes a separate entry in the undo
321 records, but sometimes an entry covers just part of a command, and 326 records, but sometimes an entry covers just part of a command, and
322 very simple commands may be grouped. 327 very simple commands may be grouped.
323 328
324 @table @kbd 329 @table @kbd
329 @itemx C-/ 334 @itemx C-/
330 The same. 335 The same.
331 @end table 336 @end table
332 337
333 The command @kbd{C-x u} (or @kbd{C-_} or @kbd{C-/}) is how you undo. 338 The command @kbd{C-x u} (or @kbd{C-_} or @kbd{C-/}) is how you undo.
334 The first time you give this command, it undoes the last change. 339 Normally this command undoes the last change, and moves point back to
335 Point moves back to where it was before the command that made the 340 where it was before the change.
336 change. 341
337 342 If you repeat @kbd{C-x u} (or its aliases), each repetition undoes
338 Consecutive repetitions of @kbd{C-x u} (or its aliases) undo earlier 343 another, earlier change, back to the limit of the undo information
339 and earlier changes, back to the limit of the undo information
340 available. If all recorded changes have already been undone, the undo 344 available. If all recorded changes have already been undone, the undo
341 command displays an error message and does nothing. 345 command displays an error message and does nothing.
342 346
343 The undo command applies only to changes in the buffer; you can't 347 The undo command applies only to changes in the buffer; you can't
344 use it to undo mere cursor motion. However, some cursor motion 348 use it to undo mere cursor motion. However, some cursor motion
347 popping the mark ring (@pxref{Mark Ring}). 351 popping the mark ring (@pxref{Mark Ring}).
348 352
349 @node Basic Files 353 @node Basic Files
350 @section Files 354 @section Files
351 355
352 The commands described above are sufficient for creating and altering 356 Text that you insert in an Emacs buffer lasts only as long as the
353 text in an Emacs buffer; the more advanced Emacs commands just make 357 Emacs session. To keep any text permanently you must put it in a
354 things easier. However, to keep any text permanently you must put it in a
355 @dfn{file}. Files are named units of text which are stored by the 358 @dfn{file}. Files are named units of text which are stored by the
356 operating system for you to retrieve later by name. To look at or use 359 operating system for you to retrieve later by name. To use the
357 the contents of a file in any way, including editing the file with 360 contents of a file in any way, you must specify the file name. That
358 Emacs, you must specify the file name. 361 includes editing the file with Emacs.
359 362
360 Consider a file named @file{test.emacs}. (We can assume it is in 363 Suppose there is a file named @file{test.emacs} in your home
361 your home directory.) In Emacs, to begin editing this file, type 364 directory. To begin editing this file in Emacs, type
362 365
363 @example 366 @example
364 C-x C-f test.emacs @key{RET} 367 C-x C-f test.emacs @key{RET}
365 @end example 368 @end example
366 369
367 @noindent 370 @noindent
368 Here the file name is given as an @dfn{argument} to the command @kbd{C-x 371 Here the file name is given as an @dfn{argument} to the command @kbd{C-x
369 C-f} (@code{find-file}). That command uses the @dfn{minibuffer} to 372 C-f} (@code{find-file}). That command uses the @dfn{minibuffer} to
370 read the argument, and you type @key{RET} to terminate the argument 373 read the argument, and you type @key{RET} to terminate the argument
371 (@pxref{Minibuffer}).@refill 374 (@pxref{Minibuffer}).
372 375
373 Emacs obeys the command by @dfn{visiting} the file: creating a buffer, 376 Emacs obeys this command by @dfn{visiting} the file: it creates a
374 copying the contents of the file into the buffer, and then displaying 377 buffer, it copies the contents of the file into the buffer, and then
375 the buffer for you to edit. If you alter the text, you can @dfn{save} 378 displays the buffer for editing. If you alter the text, you can
376 the new text in the file by typing @kbd{C-x C-s} (@code{save-buffer}). 379 @dfn{save} the new text in the file by typing @kbd{C-x C-s}
377 This makes the changes permanent by copying the altered buffer contents 380 (@code{save-buffer}). This copies the altered buffer contents back
378 back into the file @file{test.emacs}. Until you save, the changes 381 into the file @file{test.emacs}, making them permanent. Until you
379 exist only inside Emacs, and the file @file{test.emacs} is unaltered. 382 save, the changed text exists only inside Emacs, and the file
380 383 @file{test.emacs} is unaltered.
381 To create a file, just visit the file with @kbd{C-x C-f} as if it 384
382 already existed. This creates an empty buffer in which you can insert 385 To create a file, just visit it with @kbd{C-x C-f} as if it already
383 the text you want to put in the file. The file is actually created when 386 existed. This creates an empty buffer, in which you can insert the
384 you save this buffer with @kbd{C-x C-s}. 387 text you want to put in the file. Emacs actually creates the file the
385 388 first time you save this buffer with @kbd{C-x C-s}.
386 Of course, there is a lot more to learn about using files. @xref{Files}. 389
390 To learn more about using files in Emacs, see @ref{Files}.
387 391
388 @node Basic Help 392 @node Basic Help
389 @section Help 393 @section Help
390 394
391 @cindex getting help with keys 395 @cindex getting help with keys
392 If you forget what a key does, you can find out with the Help 396 If you forget what a key does, you can find out with the Help
393 character, which is @kbd{C-h} (or @key{F1}, which is an alias for 397 character, which is @kbd{C-h} (or @key{F1}, which is an alias for
394 @kbd{C-h}). Type @kbd{C-h k} followed by the key you want to know 398 @kbd{C-h}). Type @kbd{C-h k} followed by the key of interest; for
395 about; for example, @kbd{C-h k C-n} tells you all about what @kbd{C-n} 399 example, @kbd{C-h k C-n} tells you what @kbd{C-n} does. @kbd{C-h} is
396 does. @kbd{C-h} is a prefix key; @kbd{C-h k} is just one of its 400 a prefix key; @kbd{C-h k} is just one of its subcommands (the command
397 subcommands (the command @code{describe-key}). The other subcommands of 401 @code{describe-key}). The other subcommands of @kbd{C-h} provide
398 @kbd{C-h} provide different kinds of help. Type @kbd{C-h} twice to get 402 different kinds of help. Type @kbd{C-h} twice to get a description of
399 a description of all the help facilities. @xref{Help}.@refill 403 all the help facilities. @xref{Help}.
400 404
401 @node Blank Lines 405 @node Blank Lines
402 @section Blank Lines 406 @section Blank Lines
403 407
404 @cindex inserting blank lines 408 @cindex inserting blank lines
405 @cindex deleting blank lines 409 @cindex deleting blank lines
406 Here are special commands and techniques for putting in and taking out 410 Here are special commands and techniques for inserting and deleting
407 blank lines. 411 blank lines.
408 412
409 @table @kbd 413 @table @kbd
410 @item C-o 414 @item C-o
411 Insert one or more blank lines after the cursor (@code{open-line}). 415 Insert one or more blank lines after the cursor (@code{open-line}).
417 @kindex C-o 421 @kindex C-o
418 @kindex C-x C-o 422 @kindex C-x C-o
419 @cindex blank lines 423 @cindex blank lines
420 @findex open-line 424 @findex open-line
421 @findex delete-blank-lines 425 @findex delete-blank-lines
422 When you want to insert a new line of text before an existing line, you 426 To insert a new line of text before an existing line,
423 can do it by typing the new line of text, followed by @key{RET}. 427 type the new line of text, followed by @key{RET}.
424 However, it may be easier to see what you are doing if you first make a 428 However, it may be easier to see what you are doing if you first make a
425 blank line and then insert the desired text into it. This is easy to do 429 blank line and then insert the desired text into it. This is easy to do
426 using the key @kbd{C-o} (@code{open-line}), which inserts a newline 430 using the key @kbd{C-o} (@code{open-line}), which inserts a newline
427 after point but leaves point in front of the newline. After @kbd{C-o}, 431 after point but leaves point in front of the newline. After @kbd{C-o},
428 type the text for the new line. @kbd{C-o F O O} has the same effect as 432 type the text for the new line. @kbd{C-o F O O} has the same effect as
429 @w{@kbd{F O O @key{RET}}}, except for the final location of point. 433 @w{@kbd{F O O @key{RET}}}, except for the final location of point.
430 434
431 You can make several blank lines by typing @kbd{C-o} several times, or 435 You can make several blank lines by typing @kbd{C-o} several times, or
432 by giving it a numeric argument to tell it how many blank lines to make. 436 by giving it a numeric argument specifying how many blank lines to make.
433 @xref{Arguments}, for how. If you have a fill prefix, the @kbd{C-o} 437 @xref{Arguments}, for how. If you have a fill prefix, the @kbd{C-o}
434 command inserts the fill prefix on the new line, when you use it at the 438 command inserts the fill prefix on the new line, if typed at the
435 beginning of a line. @xref{Fill Prefix}. 439 beginning of a line. @xref{Fill Prefix}.
436 440
437 The easy way to get rid of extra blank lines is with the command 441 The easy way to get rid of extra blank lines is with the command
438 @kbd{C-x C-o} (@code{delete-blank-lines}). @kbd{C-x C-o} in a run of 442 @kbd{C-x C-o} (@code{delete-blank-lines}). @kbd{C-x C-o} in a run of
439 several blank lines deletes all but one of them. @kbd{C-x C-o} on a 443 several blank lines deletes all but one of them. @kbd{C-x C-o} on a
440 solitary blank line deletes that blank line. When point is on a 444 lone blank line deletes that one. When point is on a nonblank line,
441 nonblank line, @kbd{C-x C-o} deletes any blank lines following that 445 @kbd{C-x C-o} deletes all following blank lines (if any).
442 nonblank line.
443 446
444 @node Continuation Lines 447 @node Continuation Lines
445 @section Continuation Lines 448 @section Continuation Lines
446 449
447 @cindex continuation line 450 @cindex continuation line
448 @cindex wrapping 451 @cindex wrapping
449 @cindex line wrapping 452 @cindex line wrapping
450 @cindex fringes, and continuation lines 453 @cindex fringes, and continuation lines
451 If you add too many characters to one line without breaking it with 454 When a text line is too long to fit in one screen line, Emacs
452 @key{RET}, the line grows to occupy two (or more) lines on the screen. 455 displays it on two or more screen lines. This is called
453 On graphical displays, Emacs indicates line wrapping with small bent 456 @dfn{continuation} or @dfn{line wrapping}. On graphical displays,
454 arrows in the fringes to the left and right of the window. On 457 Emacs indicates line wrapping with small bent arrows in the left and
455 text-only terminals, Emacs displays a @samp{\} character at the right 458 right window fringes. On text-only terminals, Emacs displays a
456 margin of a screen line if it is not the last in its text line. This 459 @samp{\} character at the right margin of a screen line if it is not
457 @samp{\} character says that the following screen line is not really a 460 the last in its text line. This @samp{\} character says that the
458 distinct line in the text, just a @dfn{continuation} of a line too 461 following screen line is not really a new text line.
459 long to fit the screen. Continuation is also called @dfn{line 462
460 wrapping}. 463 When line wrapping occurs just before a character that is wider than one
461
462 When line wrapping occurs before a character that is wider than one
463 column, some columns at the end of the previous screen line may be 464 column, some columns at the end of the previous screen line may be
464 ``empty.'' In this case, Emacs displays additional @samp{\} 465 ``empty.'' In this case, Emacs displays additional @samp{\}
465 characters in the ``empty'' columns, just before the @samp{\} 466 characters in the ``empty'' columns before the @samp{\}
466 character that indicates continuation. 467 character that indicates continuation.
467 468
468 Continued lines can be rather difficult to read, since each line is 469 Continued lines can be difficult to read, since lines can break in
469 typically broken in the middle of a word. You can have Emacs insert a 470 the middle of a word. If you prefer, you can make Emacs insert a
470 newline automatically when a line gets too long, by using Auto Fill 471 newline automatically when a line gets too long, by using Auto Fill
471 mode. Another approach, intermediate between continued lines and Auto 472 mode. Or enable Long Lines mode, which ensures that wrapping only
472 Fill mode, is Long Lines mode, which ensures that wrapping only occurs 473 occurs between words. @xref{Filling}.
473 in the spaces between words. @xref{Filling}.
474 474
475 @cindex truncation 475 @cindex truncation
476 @cindex line truncation, and fringes 476 @cindex line truncation, and fringes
477 Emacs can also display long lines by @dfn{truncation}. This means 477 Emacs can optionally @dfn{truncate} long lines---this means
478 that all the characters that do not fit in the width of the screen or 478 displaying just one screen line worth, and the rest of the long line
479 window do not appear at all. @samp{$} in the last column or a small 479 does not appear at all. @samp{$} in the last column or a small
480 straight arrow in the fringe to the right of the window indicates a 480 straight arrow in the window's right fringe indicates a truncated
481 truncated line. 481 line.
482 482
483 @xref{Display Custom}, for more information about line truncation, 483 @xref{Display Custom}, for more about line truncation,
484 and other variables that affect how text is displayed. 484 and other variables that control how text is displayed.
485 485
486 @node Position Info 486 @node Position Info
487 @section Cursor Position Information 487 @section Cursor Position Information
488 488
489 Here are commands to get information about the size and position of 489 Here are commands to get information about the size and position of
490 parts of the buffer, and to count lines. 490 parts of the buffer, and to count lines.
491 491
492 @table @kbd 492 @table @kbd
493 @item M-x what-page 493 @item M-x what-page
494 Display the page number of point, and the line number within the page. 494 Display the page number of point, and the line number within that page.
495 @item M-x what-line 495 @item M-x what-line
496 Display the line number of point in the buffer. 496 Display the line number of point in the whole buffer.
497 @item M-x line-number-mode 497 @item M-x line-number-mode
498 @itemx M-x column-number-mode 498 @itemx M-x column-number-mode
499 Toggle automatic display of current line number or column number. 499 Toggle automatic display of the current line number or column number.
500 @xref{Optional Mode Line}. 500 @xref{Optional Mode Line}.
501 @item M-= 501 @item M-=
502 Display the number of lines in the current region (@code{count-lines-region}). 502 Display the number of lines in the current region (@code{count-lines-region}).
503 @xref{Mark}, for information about the region. 503 @xref{Mark}, for information about the region.
504 @item C-x = 504 @item C-x =
516 @findex what-line 516 @findex what-line
517 @cindex line number commands 517 @cindex line number commands
518 @cindex location of point 518 @cindex location of point
519 @cindex cursor location 519 @cindex cursor location
520 @cindex point location 520 @cindex point location
521 @kbd{M-x what-line} computes the current line number and displays it 521 @kbd{M-x what-line} displays the current line number
522 in the echo area. You can also see the current line number in the 522 in the echo area. You can also see the current line number in the
523 mode line; see @ref{Mode Line}. If you narrow the buffer, then the 523 mode line; see @ref{Mode Line}; but if you narrow the buffer, the
524 line number in the mode line is relative to the accessible portion 524 line number in the mode line is relative to the accessible portion
525 (@pxref{Narrowing}). By contrast, @code{what-line} shows both the 525 (@pxref{Narrowing}). By contrast, @code{what-line} shows both the
526 line number relative to the narrowed region and the line number 526 line number relative to the narrowed region and the line number
527 relative to the whole buffer. 527 relative to the whole buffer.
528 528
530 counts lines within the page, showing both numbers in the echo area. 530 counts lines within the page, showing both numbers in the echo area.
531 @xref{Pages}. 531 @xref{Pages}.
532 532
533 @kindex M-= 533 @kindex M-=
534 @findex count-lines-region 534 @findex count-lines-region
535 While on this subject, we might as well mention @kbd{M-=} (@code{count-lines-region}), 535 Use @kbd{M-=} (@code{count-lines-region}) to displays the number of
536 which displays the number of lines in the region (@pxref{Mark}). 536 lines in the region (@pxref{Mark}). @xref{Pages}, for the command
537 @xref{Pages}, for the command @kbd{C-x l} which counts the lines in the 537 @kbd{C-x l} which counts the lines in the current page.
538 current page.
539 538
540 @kindex C-x = 539 @kindex C-x =
541 @findex what-cursor-position 540 @findex what-cursor-position
542 The command @kbd{C-x =} (@code{what-cursor-position}) shows what 541 The command @kbd{C-x =} (@code{what-cursor-position}) shows what
543 column the cursor is in, and other miscellaneous information about 542 cursor's column position, and other information about point and the
544 point and the character after it. It displays a line in the echo area 543 character after it. It displays a line in the echo area that looks
545 that looks like this: 544 like this:
546 545
547 @smallexample 546 @smallexample
548 Char: c (99, #o143, #x63) point=28062 of 36168 (78%) column=53 547 Char: c (99, #o143, #x63) point=28062 of 36168 (78%) column=53
549 @end smallexample 548 @end smallexample
550 549
561 a file. In Emacs, that byte is represented as a sequence of 8-bit 560 a file. In Emacs, that byte is represented as a sequence of 8-bit
562 characters, but all of them together display as the original invalid 561 characters, but all of them together display as the original invalid
563 byte, in octal code. In this case, @kbd{C-x =} shows @samp{part of 562 byte, in octal code. In this case, @kbd{C-x =} shows @samp{part of
564 display ...} instead of @samp{file}. 563 display ...} instead of @samp{file}.
565 564
566 @samp{point=} is followed by the position of point expressed as a character 565 @samp{point=} is followed by the position of point expressed as a
567 count. The front of the buffer counts as position 1, one character later 566 character count. The start of the buffer is position 1, one character
568 as 2, and so on. The next, larger, number is the total number of characters 567 later is position 2, and so on. The next, larger, number is the total
569 in the buffer. Afterward in parentheses comes the position expressed as a 568 number of characters in the buffer. Afterward in parentheses comes
570 percentage of the total size. 569 the position expressed as a percentage of the total size.
571 570
572 @samp{column=} is followed by the horizontal position of point, in 571 @samp{column=} is followed by the horizontal position of point, in
573 columns from the left edge of the window. 572 columns from the left edge of the window.
574 573
575 If the buffer has been narrowed, making some of the text at the 574 If the buffer has been narrowed, making some of the text at the
612 @item 611 @item
613 The character's encodings, both internally in the buffer, and externally 612 The character's encodings, both internally in the buffer, and externally
614 if you were to save the file. 613 if you were to save the file.
615 614
616 @item 615 @item
617 What to type to input the character in the current input method 616 What keys to type to input the character in the current input method
618 (if it supports the character). 617 (if it supports the character).
619 618
620 @item 619 @item
621 If you are running Emacs on a graphical display, the font name and 620 If you are running Emacs on a graphical display, the font name and
622 glyph code for the character. If you are running Emacs on a text-only 621 glyph code for the character. If you are running Emacs on a text-only
654 @section Numeric Arguments 653 @section Numeric Arguments
655 @cindex numeric arguments 654 @cindex numeric arguments
656 @cindex prefix arguments 655 @cindex prefix arguments
657 @cindex arguments to commands 656 @cindex arguments to commands
658 657
659 In mathematics and computer usage, the word @dfn{argument} means 658 In mathematics and computer usage, @dfn{argument} means
660 ``data provided to a function or operation.'' You can give any Emacs 659 ``data provided to a function or operation.'' You can give any Emacs
661 command a @dfn{numeric argument} (also called a @dfn{prefix argument}). 660 command a @dfn{numeric argument} (also called a @dfn{prefix argument}).
662 Some commands interpret the argument as a repetition count. For 661 Some commands interpret the argument as a repetition count. For
663 example, @kbd{C-f} with an argument of ten moves forward ten characters 662 example, @kbd{C-f} with an argument of ten moves forward ten characters
664 instead of one. With these commands, no argument is equivalent to an 663 instead of one. With these commands, no argument is equivalent to an
677 @example 676 @example
678 M-5 C-n 677 M-5 C-n
679 @end example 678 @end example
680 679
681 @noindent 680 @noindent
682 would move down five lines. The characters @kbd{Meta-1}, @kbd{Meta-2}, 681 moves down five lines. The characters @kbd{Meta-1}, @kbd{Meta-2},
683 and so on, as well as @kbd{Meta--}, do this because they are keys bound 682 and so on, as well as @kbd{Meta--}, do this because they are keys bound
684 to commands (@code{digit-argument} and @code{negative-argument}) that 683 to commands (@code{digit-argument} and @code{negative-argument}) that
685 are defined to contribute to an argument for the next command. 684 are defined to set up an argument for the next command.
686 @kbd{Meta--} without digits normally means @minus{}1. Digits and 685 @kbd{Meta--} without digits normally means @minus{}1. Digits and
687 @kbd{-} modified with Control, or Control and Meta, also specify numeric 686 @kbd{-} modified with Control, or Control and Meta, also specify numeric
688 arguments. 687 arguments.
689 688
690 @kindex C-u 689 @kindex C-u
691 @findex universal-argument 690 @findex universal-argument
692 Another way of specifying an argument is to use the @kbd{C-u} 691 You can also specify a numeric argument by typing @kbd{C-u}
693 (@code{universal-argument}) command followed by the digits of the 692 (@code{universal-argument}) followed by the digits. The advantage of
694 argument. With @kbd{C-u}, you can type the argument digits without 693 @kbd{C-u} is that you can type the digits without modifier keys; thus,
695 holding down modifier keys; @kbd{C-u} works on all terminals. To type a 694 @kbd{C-u} works on all terminals. For a negative argument, type a
696 negative argument, type a minus sign after @kbd{C-u}. Just a minus sign 695 minus sign after @kbd{C-u}. A minus sign without digits normally
697 without digits normally means @minus{}1. 696 means @minus{}1.
698 697
699 @kbd{C-u} without digits or minus sign has the special meaning of 698 @kbd{C-u} alone has the special meaning of
700 ``four times'': it multiplies the argument for the next command by 699 ``four times'': it multiplies the argument for the next command by
701 four. @kbd{C-u C-u} multiplies it by sixteen. Thus, @kbd{C-u C-u 700 four. @kbd{C-u C-u} multiplies it by sixteen. Thus, @kbd{C-u C-u
702 C-f} moves forward sixteen characters. This is a good way to move 701 C-f} moves forward sixteen characters. This is a good way to move
703 forward ``fast,'' since it moves about 1/5 of a line in the usual size 702 forward ``fast,'' since it moves about 1/5 of a line in the usual size
704 screen. Other useful combinations are @kbd{C-u C-n}, @kbd{C-u C-u 703 screen. Other useful combinations are @kbd{C-u C-n}, @kbd{C-u C-u
705 C-n} (move down a good fraction of a screen), @kbd{C-u C-u C-o} (make 704 C-n} (move down a good fraction of a screen), @kbd{C-u C-u C-o} (make
706 ``a lot'' of blank lines), and @kbd{C-u C-k} (kill four lines).@refill 705 ``a lot'' of blank lines), and @kbd{C-u C-k} (kill four lines).
707 706
708 Some commands care only about whether there is an argument, and not about 707 Some commands care whether there is an argument, but ignore its
709 its value. For example, the command @kbd{M-q} (@code{fill-paragraph}) with 708 value. For example, the command @kbd{M-q} (@code{fill-paragraph})
710 no argument fills text; with an argument, it justifies the text as well. 709 fills text; with an argument, it justifies the text as well.
711 (@xref{Filling}, for more information on @kbd{M-q}.) Plain @kbd{C-u} is a 710 (@xref{Filling}, for more information on @kbd{M-q}.) Plain @kbd{C-u}
712 handy way of providing an argument for such commands. 711 is a handy way of providing an argument for such commands.
713 712
714 Some commands use the value of the argument as a repeat count, but do 713 Some commands use the value of the argument as a repeat count, but do
715 something peculiar when there is no argument. For example, the command 714 something peculiar when there is no argument. For example, the command
716 @kbd{C-k} (@code{kill-line}) with argument @var{n} kills @var{n} lines, 715 @kbd{C-k} (@code{kill-line}) with argument @var{n} kills @var{n} lines,
717 including their terminating newlines. But @kbd{C-k} with no argument is 716 including their terminating newlines. But @kbd{C-k} with no argument is
718 special: it kills the text up to the next newline, or, if point is right at 717 special: it kills the text up to the next newline, or, if point is right at
719 the end of the line, it kills the newline itself. Thus, two @kbd{C-k} 718 the end of the line, it kills the newline itself. Thus, two @kbd{C-k}
720 commands with no arguments can kill a nonblank line, just like @kbd{C-k} 719 commands with no arguments can kill a nonblank line, just like @kbd{C-k}
721 with an argument of one. (@xref{Killing}, for more information on 720 with an argument of one. (@xref{Killing}, for more information on
722 @kbd{C-k}.)@refill 721 @kbd{C-k}.)
723 722
724 A few commands treat a plain @kbd{C-u} differently from an ordinary 723 A few commands treat a plain @kbd{C-u} differently from an ordinary
725 argument. A few others may treat an argument of just a minus sign 724 argument. A few others may treat an argument of just a minus sign
726 differently from an argument of @minus{}1. These unusual cases are 725 differently from an argument of @minus{}1. These unusual cases are
727 described when they come up; they are always for reasons of 726 described when they come up; they exist to make an individual command
728 convenience of use of the individual command, and they are documented 727 more convenient, and they are documented in that command's
729 in the command's documentation string. 728 documentation string.
730 729
731 You can use a numeric argument to insert multiple copies of a 730 You can use a numeric argument before a self-inserting character to
732 character. This is straightforward unless the character is a digit; for 731 insert multiple copies of it. This is straightforward when the
733 example, @kbd{C-u 6 4 a} inserts 64 copies of the character @samp{a}. 732 character is not a digit; for example, @kbd{C-u 6 4 a} inserts 64
734 But this does not work for inserting digits; @kbd{C-u 6 4 1} specifies 733 copies of the character @samp{a}. But this does not work for
735 an argument of 641, rather than inserting anything. To separate the 734 inserting digits; @kbd{C-u 6 4 1} specifies an argument of 641. You
736 digit to insert from the argument, type another @kbd{C-u}; for example, 735 can separate the argument from the digit to insert with another
737 @kbd{C-u 6 4 C-u 1} does insert 64 copies of the character @samp{1}. 736 @kbd{C-u}; for example, @kbd{C-u 6 4 C-u 1} does insert 64 copies of
738 737 the character @samp{1}.
739 We use the term ``prefix argument'' as well as ``numeric argument'' to 738
740 emphasize that you type the argument before the command, and to 739 We use the term ``prefix argument'' as well as ``numeric argument'',
741 distinguish these arguments from minibuffer arguments that come after 740 to emphasize that you type these argument before the command, and to
742 the command. 741 distinguish them from minibuffer arguments that come after the
742 command.
743 743
744 @node Repeating 744 @node Repeating
745 @section Repeating a Command 745 @section Repeating a Command
746 @cindex repeating a command 746 @cindex repeating a command
747 747
748 Many simple commands, such as those invoked with a single key or 748 Many simple commands, such as those invoked with a single key or
749 with @kbd{M-x @var{command-name} @key{RET}}, can be repeated by 749 with @kbd{M-x @var{command-name} @key{RET}}, can be repeated by
750 invoking them with a numeric argument that serves as a repeat count 750 invoking them with a numeric argument that serves as a repeat count
751 (@pxref{Arguments}). However, if the command you want to repeat 751 (@pxref{Arguments}). However, if the command you want to repeat
752 prompts for some input, or uses a numeric argument in another way, 752 prompts for input, or uses a numeric argument in another way, that
753 repetition using a numeric argument might be problematical. 753 method won't work.
754 754
755 @kindex C-x z 755 @kindex C-x z
756 @findex repeat 756 @findex repeat
757 The command @kbd{C-x z} (@code{repeat}) provides another way to repeat 757 The command @kbd{C-x z} (@code{repeat}) provides another way to repeat
758 an Emacs command many times. This command repeats the previous Emacs 758 an Emacs command many times. This command repeats the previous Emacs