annotate man/basic.texi @ 83790:2aeb19284040

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Thu, 30 Aug 2007 19:27:43 +0000
parents dc09c3d8a304
children aaccdab0ee26
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.
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62483
diff changeset
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
75348
3d45362f1d38 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 72559
diff changeset
3 @c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
4 @c See file emacs.texi for copying conditions.
Dave Love <fx@gnu.org>
parents:
diff changeset
5 @node Basic, Minibuffer, Exiting, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
6 @chapter Basic Editing Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
7
Dave Love <fx@gnu.org>
parents:
diff changeset
8 @kindex C-h t
Dave Love <fx@gnu.org>
parents:
diff changeset
9 @findex help-with-tutorial
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
10 Here we explain the basics of how to enter text, make corrections,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
11 and save the text in a file. If this material is new to you, we
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
12 suggest you first run the Emacs learn-by-doing tutorial, by typing
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
13 @kbd{Control-h t} inside Emacs. (@code{help-with-tutorial}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
14
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
15 To clear and redisplay the screen, type @kbd{C-l} (@code{recenter}).
25829
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.
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
20 * Moving Point:: Moving the cursor to the place where you want to
25829
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.
68505
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
23 * Basic Undo:: Undoing recent changes in the text.
25829
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.
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
26 * Blank Lines:: Making and deleting blank lines.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
27 * Continuation Lines:: How Emacs displays lines too wide for the screen.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
28 * Position Info:: What page, line, row, or column is point on?
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
29 * Arguments:: Numeric arguments for repeating a command N times.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
30 * Repeating:: Repeating the previous command quickly.
25829
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
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
38 Typing printing characters inserts them into the text you are
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
39 editing. It inserts them into the buffer at the cursor; more
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
40 precisely, it inserts them at @dfn{point}, but the cursor normally
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
41 shows where point is. @xref{Point}.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
42
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
43 Insertion moves the cursor forward, and the following text moves
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
44 forward with the cursor. If the text in the buffer is @samp{FOOBAR},
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
45 with the cursor before the @samp{B}, and you type @kbd{XX}, you get
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
46 @samp{FOOXXBAR}, with the cursor still before the @samp{B}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
47
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
48 To @dfn{delete} text you have just inserted, use the large key
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
49 labeled @key{DEL}, @key{BACKSPACE} or @key{DELETE} which is a short
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
50 distance above the @key{RET} or @key{ENTER} key. Regardless of the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
51 label on that key, Emacs thinks of it as @key{DEL}, and that's what we
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
52 call it in this manual. @key{DEL} is the key you normally use outside
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
53 Emacs to erase the last character that you typed.
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
54
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
55 The @key{DEL} key deletes the character @emph{before} the cursor.
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
56 As a consequence, the cursor and all the characters after it move
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
57 backwards. If you type a printing character and then type @key{DEL},
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
58 they cancel out.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
59
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
60 On most computers, Emacs sets up @key{DEL} automatically. In some
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
61 cases, especially with text-only terminals, Emacs may guess wrong. If
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
62 the key that ought to erase the last character doesn't do it in Emacs,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
63 see @ref{DEL Does Not Delete}.
36789
f71fe44b07ea Simplify the discussion of DEL. Refer to `DEL Gets Help' node
Richard M. Stallman <rms@gnu.org>
parents: 36724
diff changeset
64
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
65 Most PC keyboards have both a @key{BACKSPACE} key a little ways
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
66 above @key{RET} or @key{ENTER}, and a @key{DELETE} key elsewhere. On
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
67 these keyboards, Emacs tries to set up @key{BACKSPACE} as @key{DEL}.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
68 The @key{DELETE} key deletes ``forwards'' like @kbd{C-d} (see below),
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
69 which means it deletes the character underneath the cursor (after
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
70 point).
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
71
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
72 @kindex RET
Dave Love <fx@gnu.org>
parents:
diff changeset
73 @cindex newline
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
74 To end a line and start typing a new one, type @key{RET}. (This
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
75 key may be labeled @key{RETURN} or @key{ENTER}, but in Emacs we call
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
76 it @key{RET}.) This inserts a newline character in the buffer. If
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
77 point is at the end of the line, this creates a new blank line after
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
78 it. If point is in the middle of a line, the effect is to split that
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
79 line. Typing @key{DEL} when the cursor is at the beginning of a line
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
80 deletes the preceding newline character, thus joining the line with
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
81 the one before it.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
82
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
83 Emacs can split lines automatically when they become too long, if
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
84 you turn on a special minor mode called @dfn{Auto Fill} mode.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
85 @xref{Filling}, for Auto Fill mode and other methods of @dfn{filling}
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
86 text.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
87
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
88 If you prefer printing characters to replace (overwrite) existing
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
89 text, rather than shove it to the right, you should enable Overwrite
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
90 mode, a minor mode. @xref{Minor Modes}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
91
Dave Love <fx@gnu.org>
parents:
diff changeset
92 @cindex quoting
Dave Love <fx@gnu.org>
parents:
diff changeset
93 @kindex C-q
Dave Love <fx@gnu.org>
parents:
diff changeset
94 @findex quoted-insert
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
95 Only printing characters and @key{SPC} insert themselves in Emacs.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
96 Other characters act as editing commands and do not insert themselves.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
97 These include control characters, and characters with codes above 200
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
98 octal. If you need to insert one of these characters in the buffer,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
99 you must @dfn{quote} it by typing the character @kbd{Control-q}
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
100 (@code{quoted-insert}) first. (This character's name is normally
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
101 written @kbd{C-q} for short.) There are two ways to use
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
102 @kbd{C-q}:
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
103
Dave Love <fx@gnu.org>
parents:
diff changeset
104 @itemize @bullet
Dave Love <fx@gnu.org>
parents:
diff changeset
105 @item
Dave Love <fx@gnu.org>
parents:
diff changeset
106 @kbd{C-q} followed by any non-graphic character (even @kbd{C-g})
Dave Love <fx@gnu.org>
parents:
diff changeset
107 inserts that character.
Dave Love <fx@gnu.org>
parents:
diff changeset
108
Dave Love <fx@gnu.org>
parents:
diff changeset
109 @item
Dave Love <fx@gnu.org>
parents:
diff changeset
110 @kbd{C-q} followed by a sequence of octal digits inserts the character
Dave Love <fx@gnu.org>
parents:
diff changeset
111 with the specified octal character code. You can use any number of
37152
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
112 octal digits; any non-digit terminates the sequence. If the
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
113 terminating character is @key{RET}, it serves only to terminate the
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
114 sequence. Any other non-digit terminates the sequence and then acts
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
115 as normal input---thus, @kbd{C-q 1 0 1 B} inserts @samp{AB}.
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
116
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
117 The use of octal sequences is disabled in ordinary non-binary
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
118 Overwrite mode, to give you a convenient way to insert a digit instead
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
119 of overwriting with it.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
120 @end itemize
Dave Love <fx@gnu.org>
parents:
diff changeset
121
33552
82d0163f6fb7 Say "ISO 8859" instead of "ISO Latin", to cover non-Latin ISO-8859
Eli Zaretskii <eliz@gnu.org>
parents: 33518
diff changeset
122 @cindex 8-bit character codes
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
123 @noindent
33518
797566a752f7 Modify about inserting 8-bit.
Dave Love <fx@gnu.org>
parents: 31952
diff changeset
124 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
125 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
126 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
127 code to the corresponding Emacs character code. @xref{Enabling
af4e219e9947 Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 35923
diff changeset
128 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
129 use through your choice of language environment (@pxref{Language
af4e219e9947 Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 35923
diff changeset
130 Environments}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
131
Dave Love <fx@gnu.org>
parents:
diff changeset
132 @vindex read-quoted-char-radix
Dave Love <fx@gnu.org>
parents:
diff changeset
133 To use decimal or hexadecimal instead of octal, set the variable
Dave Love <fx@gnu.org>
parents:
diff changeset
134 @code{read-quoted-char-radix} to 10 or 16. If the radix is greater than
Dave Love <fx@gnu.org>
parents:
diff changeset
135 10, some letters starting with @kbd{a} serve as part of a character
Dave Love <fx@gnu.org>
parents:
diff changeset
136 code, just like digits.
Dave Love <fx@gnu.org>
parents:
diff changeset
137
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
138 A numeric argument tells @kbd{C-q} how many copies of the quoted
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
139 character to insert (@pxref{Arguments}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
140
Dave Love <fx@gnu.org>
parents:
diff changeset
141 @findex newline
Dave Love <fx@gnu.org>
parents:
diff changeset
142 @findex self-insert
Dave Love <fx@gnu.org>
parents:
diff changeset
143 Customization information: @key{DEL} in most modes runs the command
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
144 @code{delete-backward-char}; @key{RET} runs the command
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
145 @code{newline}, and self-inserting printing characters run the command
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
146 @code{self-insert}, which inserts whatever character you typed. Some
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
147 major modes rebind @key{DEL} to other commands.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
148
Dave Love <fx@gnu.org>
parents:
diff changeset
149 @node Moving Point
Dave Love <fx@gnu.org>
parents:
diff changeset
150 @section Changing the Location of Point
Dave Love <fx@gnu.org>
parents:
diff changeset
151
Dave Love <fx@gnu.org>
parents:
diff changeset
152 @cindex arrow keys
Dave Love <fx@gnu.org>
parents:
diff changeset
153 @cindex moving point
Dave Love <fx@gnu.org>
parents:
diff changeset
154 @cindex movement
Dave Love <fx@gnu.org>
parents:
diff changeset
155 @cindex cursor motion
Dave Love <fx@gnu.org>
parents:
diff changeset
156 @cindex moving the cursor
Dave Love <fx@gnu.org>
parents:
diff changeset
157 To do more than insert characters, you have to know how to move point
Dave Love <fx@gnu.org>
parents:
diff changeset
158 (@pxref{Point}). The simplest way to do this is with arrow keys, or by
Dave Love <fx@gnu.org>
parents:
diff changeset
159 clicking the left mouse button where you want to move to.
Dave Love <fx@gnu.org>
parents:
diff changeset
160
Dave Love <fx@gnu.org>
parents:
diff changeset
161 There are also control and meta characters for cursor motion. Some
68452
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
162 are equivalent to the arrow keys (it is faster to use these control
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
163 keys than move your hand over to the arrow keys). Others do more
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
164 sophisticated things.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
165
Dave Love <fx@gnu.org>
parents:
diff changeset
166 @kindex C-a
Dave Love <fx@gnu.org>
parents:
diff changeset
167 @kindex C-e
Dave Love <fx@gnu.org>
parents:
diff changeset
168 @kindex C-f
Dave Love <fx@gnu.org>
parents:
diff changeset
169 @kindex C-b
Dave Love <fx@gnu.org>
parents:
diff changeset
170 @kindex C-n
Dave Love <fx@gnu.org>
parents:
diff changeset
171 @kindex C-p
Dave Love <fx@gnu.org>
parents:
diff changeset
172 @kindex M->
Dave Love <fx@gnu.org>
parents:
diff changeset
173 @kindex M-<
Dave Love <fx@gnu.org>
parents:
diff changeset
174 @kindex M-r
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
175 @kindex LEFT
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
176 @kindex RIGHT
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
177 @kindex UP
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
178 @kindex DOWN
62193
598f5ebd4f94 Various typo and grammar fixes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61100
diff changeset
179 @findex move-beginning-of-line
59140
13368da050f1 (Moving Point): C-e now runs move-end-of-line.
Richard M. Stallman <rms@gnu.org>
parents: 52979
diff changeset
180 @findex move-end-of-line
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
181 @findex forward-char
Dave Love <fx@gnu.org>
parents:
diff changeset
182 @findex backward-char
Dave Love <fx@gnu.org>
parents:
diff changeset
183 @findex next-line
Dave Love <fx@gnu.org>
parents:
diff changeset
184 @findex previous-line
Dave Love <fx@gnu.org>
parents:
diff changeset
185 @findex beginning-of-buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
186 @findex end-of-buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
187 @findex goto-char
Dave Love <fx@gnu.org>
parents:
diff changeset
188 @findex goto-line
Dave Love <fx@gnu.org>
parents:
diff changeset
189 @findex move-to-window-line
Dave Love <fx@gnu.org>
parents:
diff changeset
190 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
191 @item C-a
62193
598f5ebd4f94 Various typo and grammar fixes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61100
diff changeset
192 Move to the beginning of the line (@code{move-beginning-of-line}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
193 @item C-e
59140
13368da050f1 (Moving Point): C-e now runs move-end-of-line.
Richard M. Stallman <rms@gnu.org>
parents: 52979
diff changeset
194 Move to the end of the line (@code{move-end-of-line}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
195 @item C-f
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
196 Move forward one character (@code{forward-char}). The right-arrow key
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
197 does the same thing.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
198 @item C-b
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
199 Move backward one character (@code{backward-char}). The left-arrow
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
200 key has the same effect.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
201 @item M-f
Dave Love <fx@gnu.org>
parents:
diff changeset
202 Move forward one word (@code{forward-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
203 @item M-b
Dave Love <fx@gnu.org>
parents:
diff changeset
204 Move backward one word (@code{backward-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
205 @item C-n
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
206 Move down one line vertically (@code{next-line}). This command
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
207 attempts to keep the horizontal position unchanged, so if you start in
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
208 the middle of one line, you move to the middle of the next. The
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
209 down-arrow key does the same thing.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
210 @item C-p
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
211 Move up one line, vertically (@code{previous-line}). The up-arrow key
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
212 has the same effect. This command preserves position within the line,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
213 like @kbd{C-n}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
214 @item M-r
Dave Love <fx@gnu.org>
parents:
diff changeset
215 Move point to left margin, vertically centered in the window
Dave Love <fx@gnu.org>
parents:
diff changeset
216 (@code{move-to-window-line}). Text does not move on the screen.
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
217 A numeric argument says which screen line to place point on, counting
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
218 downward from the top of the window (zero means the top line). A
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
219 negative argument counts lines up from the bottom (@minus{}1 means the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
220 bottom line).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
221 @item M-<
Dave Love <fx@gnu.org>
parents:
diff changeset
222 Move to the top of the buffer (@code{beginning-of-buffer}). With
Dave Love <fx@gnu.org>
parents:
diff changeset
223 numeric argument @var{n}, move to @var{n}/10 of the way from the top.
Dave Love <fx@gnu.org>
parents:
diff changeset
224 @xref{Arguments}, for more information on numeric arguments.@refill
Dave Love <fx@gnu.org>
parents:
diff changeset
225 @item M->
Dave Love <fx@gnu.org>
parents:
diff changeset
226 Move to the end of the buffer (@code{end-of-buffer}).
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
227 @item C-v
59947
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
228 @itemx @key{PAGEDOWN}
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
229 @itemx @key{PRIOR}
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
230 Scroll the display one screen forward, and move point if necessary to
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
231 put it on the screen (@code{scroll-up}). This doesn't always move
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
232 point, but it is commonly used to do so. If your keyboard has a
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
233 @key{PAGEDOWN} or @key{PRIOR} key, it does the same thing.
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
234
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
235 Scrolling commands are described further in @ref{Scrolling}.
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
236 @item M-v
59947
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
237 @itemx @key{PAGEUP}
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
238 @itemx @key{NEXT}
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
239 Scroll one screen backward, and move point if necessary to put it on
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
240 the screen (@code{scroll-down}). This doesn't always move point, but
59947
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
241 it is commonly used to do so. If your keyboard has a @key{PAGEUP} or
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
242 @key{NEXT} key, it does the same thing.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
243 @item M-x goto-char
Dave Love <fx@gnu.org>
parents:
diff changeset
244 Read a number @var{n} and move point to buffer position @var{n}.
Dave Love <fx@gnu.org>
parents:
diff changeset
245 Position 1 is the beginning of the buffer.
60788
98fb3a23b966 (Moving Point): Add M-g M-g binding.
Richard M. Stallman <rms@gnu.org>
parents: 60102
diff changeset
246 @item M-g M-g
62338
9d25647627a1 (Moving Point): Mention `M-g g' binding for goto-line.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62207
diff changeset
247 @itemx M-g g
60788
98fb3a23b966 (Moving Point): Add M-g M-g binding.
Richard M. Stallman <rms@gnu.org>
parents: 60102
diff changeset
248 @itemx M-x goto-line
62483
8daca9735e20 (Moving Point): Mention default for `goto-line'.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62338
diff changeset
249 Read a number @var{n} and move point to the beginning of line number
8daca9735e20 (Moving Point): Mention default for `goto-line'.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62338
diff changeset
250 @var{n}. Line 1 is the beginning of the buffer. If point is on or
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
251 just after a number in the buffer, and you type @key{RET} with the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
252 minibuffer empty, that number is used for @var{n}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
253 @item C-x C-n
Dave Love <fx@gnu.org>
parents:
diff changeset
254 @findex set-goal-column
Dave Love <fx@gnu.org>
parents:
diff changeset
255 @kindex C-x C-n
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
256 Use the current column of point as the @dfn{semipermanent goal column}
71114
542cd4440e5f (Moving Point): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 71045
diff changeset
257 for @kbd{C-n} and @kbd{C-p} (@code{set-goal-column}). When a
542cd4440e5f (Moving Point): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 71045
diff changeset
258 semipermanent goal column is in effect, those commands always try to
542cd4440e5f (Moving Point): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 71045
diff changeset
259 move to this column, or as close as possible to it, after moving
542cd4440e5f (Moving Point): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 71045
diff changeset
260 vertically. The goal column remains in effect until canceled.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
261 @item C-u C-x C-n
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
262 Cancel the goal column. Henceforth, @kbd{C-n} and @kbd{C-p} try to
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
263 preserve the horizontal position, as usual.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
264 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
265
Dave Love <fx@gnu.org>
parents:
diff changeset
266 @vindex track-eol
Dave Love <fx@gnu.org>
parents:
diff changeset
267 If you set the variable @code{track-eol} to a non-@code{nil} value,
38172
aad260e72f97 Minor change.
Richard M. Stallman <rms@gnu.org>
parents: 37988
diff changeset
268 then @kbd{C-n} and @kbd{C-p}, when starting at the end of the line, move
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
269 to the end of another line. Normally, @code{track-eol} is @code{nil}.
Dave Love <fx@gnu.org>
parents:
diff changeset
270 @xref{Variables}, for how to set variables such as @code{track-eol}.
Dave Love <fx@gnu.org>
parents:
diff changeset
271
Dave Love <fx@gnu.org>
parents:
diff changeset
272 @vindex next-line-add-newlines
62193
598f5ebd4f94 Various typo and grammar fixes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61100
diff changeset
273 @kbd{C-n} normally stops at the end of the buffer when you use it on
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
274 the last line of the buffer. However, if you set the variable
59947
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
275 @code{next-line-add-newlines} to a non-@code{nil} value, @kbd{C-n} on
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
276 the last line of a buffer creates an additional line at the end and
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
277 moves down into it.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
278
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46040
diff changeset
279 @node Erasing
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
280 @section Erasing Text
Dave Love <fx@gnu.org>
parents:
diff changeset
281
Dave Love <fx@gnu.org>
parents:
diff changeset
282 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
283 @item @key{DEL}
Dave Love <fx@gnu.org>
parents:
diff changeset
284 Delete the character before point (@code{delete-backward-char}).
Dave Love <fx@gnu.org>
parents:
diff changeset
285 @item C-d
Dave Love <fx@gnu.org>
parents:
diff changeset
286 Delete the character after point (@code{delete-char}).
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
287 @item @key{DELETE}
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
288 @itemx @key{BACKSPACE}
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
289 One of these keys, whichever is the large key above the @key{RET} or
68452
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
290 @key{ENTER} key, deletes the character before point---it is @key{DEL}.
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
291 If @key{BACKSPACE} is @key{DEL}, and your keyboard also has @key{DELETE},
36724
c3461a4e8d2e Clarify BACKSPACE vs DELETE. Mention delete-key-deletes-forward-mode.
Richard M. Stallman <rms@gnu.org>
parents: 36654
diff changeset
292 then @key{DELETE} deletes forwards, like @kbd{C-d}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
293 @item C-k
Dave Love <fx@gnu.org>
parents:
diff changeset
294 Kill to the end of the line (@code{kill-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
295 @item M-d
Dave Love <fx@gnu.org>
parents:
diff changeset
296 Kill forward to the end of the next word (@code{kill-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
297 @item M-@key{DEL}
Dave Love <fx@gnu.org>
parents:
diff changeset
298 Kill back to the beginning of the previous word
Dave Love <fx@gnu.org>
parents:
diff changeset
299 (@code{backward-kill-word}).
Dave Love <fx@gnu.org>
parents:
diff changeset
300 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
301
Dave Love <fx@gnu.org>
parents:
diff changeset
302 @cindex killing characters and lines
Dave Love <fx@gnu.org>
parents:
diff changeset
303 @cindex deleting characters and lines
Dave Love <fx@gnu.org>
parents:
diff changeset
304 @cindex erasing characters and lines
Dave Love <fx@gnu.org>
parents:
diff changeset
305 You already know about the @key{DEL} key which deletes the character
Dave Love <fx@gnu.org>
parents:
diff changeset
306 before point (that is, before the cursor). Another key, @kbd{Control-d}
Dave Love <fx@gnu.org>
parents:
diff changeset
307 (@kbd{C-d} for short), deletes the character after point (that is, the
Dave Love <fx@gnu.org>
parents:
diff changeset
308 character that the cursor is on). This shifts the rest of the text on
Dave Love <fx@gnu.org>
parents:
diff changeset
309 the line to the left. If you type @kbd{C-d} at the end of a line, it
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
310 joins that line with the following line.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
311
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
312 To erase a larger amount of text, use the @kbd{C-k} key, which
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
313 erases (kills) a line at a time. If you type @kbd{C-k} at the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
314 beginning or middle of a line, it kills all the text up to the end of
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
315 the line. If you type @kbd{C-k} at the end of a line, it joins that
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
316 line with the following line.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
317
Dave Love <fx@gnu.org>
parents:
diff changeset
318 @xref{Killing}, for more flexible ways of killing text.
Dave Love <fx@gnu.org>
parents:
diff changeset
319
68505
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
320 @node Basic Undo
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
321 @section Undoing Changes
Dave Love <fx@gnu.org>
parents:
diff changeset
322
68505
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
323 Emacs records a list of changes made in the buffer text, so you can
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
324 you can undo recent changes, as far as the records go.
68505
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
325 Usually each editing command makes a separate entry in the undo
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
326 records, but sometimes an entry covers just part of a command, and
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
327 very simple commands may be grouped.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
328
Dave Love <fx@gnu.org>
parents:
diff changeset
329 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
330 @item C-x u
68505
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
331 Undo one entry of the undo records---usually, one command worth
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
332 (@code{undo}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
333 @item C-_
59947
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
334 @itemx C-/
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
335 The same.
Dave Love <fx@gnu.org>
parents:
diff changeset
336 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
337
59947
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
338 The command @kbd{C-x u} (or @kbd{C-_} or @kbd{C-/}) is how you undo.
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
339 Normally this command undoes the last change, and moves point back to
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
340 where it was before the change.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
341
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
342 If you repeat @kbd{C-x u} (or its aliases), each repetition undoes
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
343 another, earlier change, back to the limit of the undo information
68505
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
344 available. If all recorded changes have already been undone, the undo
d2c4afd6b173 (Basic Undo): Renamed from Undo. Most of text moved to new Undo node.
Richard M. Stallman <rms@gnu.org>
parents: 68464
diff changeset
345 command displays an error message and does nothing.
68452
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
346
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
347 The undo command applies only to changes in the buffer; you can't
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
348 use it to undo mere cursor motion. However, some cursor motion
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
349 commands set the mark, so if you use these commands from time to time,
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
350 you can move back to the neighborhoods you have moved through by
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
351 popping the mark ring (@pxref{Mark Ring}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
352
Dave Love <fx@gnu.org>
parents:
diff changeset
353 @node Basic Files
Dave Love <fx@gnu.org>
parents:
diff changeset
354 @section Files
Dave Love <fx@gnu.org>
parents:
diff changeset
355
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
356 Text that you insert in an Emacs buffer lasts only as long as the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
357 Emacs session. To keep any text permanently you must put it in a
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
358 @dfn{file}. Files are named units of text which are stored by the
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
359 operating system for you to retrieve later by name. To use the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
360 contents of a file in any way, you must specify the file name. That
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
361 includes editing the file with Emacs.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
362
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
363 Suppose there is a file named @file{test.emacs} in your home
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
364 directory. To begin editing this file in Emacs, type
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
365
Dave Love <fx@gnu.org>
parents:
diff changeset
366 @example
68452
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
367 C-x C-f test.emacs @key{RET}
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
368 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
369
Dave Love <fx@gnu.org>
parents:
diff changeset
370 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
371 Here the file name is given as an @dfn{argument} to the command @kbd{C-x
Dave Love <fx@gnu.org>
parents:
diff changeset
372 C-f} (@code{find-file}). That command uses the @dfn{minibuffer} to
Dave Love <fx@gnu.org>
parents:
diff changeset
373 read the argument, and you type @key{RET} to terminate the argument
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
374 (@pxref{Minibuffer}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
375
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
376 Emacs obeys this command by @dfn{visiting} the file: it creates a
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
377 buffer, it copies the contents of the file into the buffer, and then
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
378 displays the buffer for editing. If you alter the text, you can
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
379 @dfn{save} the new text in the file by typing @kbd{C-x C-s}
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
380 (@code{save-buffer}). This copies the altered buffer contents back
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
381 into the file @file{test.emacs}, making them permanent. Until you
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
382 save, the changed text exists only inside Emacs, and the file
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
383 @file{test.emacs} is unaltered.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
384
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
385 To create a file, just visit it with @kbd{C-x C-f} as if it already
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
386 existed. This creates an empty buffer, in which you can insert the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
387 text you want to put in the file. Emacs actually creates the file the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
388 first time you save this buffer with @kbd{C-x C-s}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
389
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
390 To learn more about using files in Emacs, see @ref{Files}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
391
Dave Love <fx@gnu.org>
parents:
diff changeset
392 @node Basic Help
Dave Love <fx@gnu.org>
parents:
diff changeset
393 @section Help
Dave Love <fx@gnu.org>
parents:
diff changeset
394
Dave Love <fx@gnu.org>
parents:
diff changeset
395 @cindex getting help with keys
Dave Love <fx@gnu.org>
parents:
diff changeset
396 If you forget what a key does, you can find out with the Help
Dave Love <fx@gnu.org>
parents:
diff changeset
397 character, which is @kbd{C-h} (or @key{F1}, which is an alias for
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
398 @kbd{C-h}). Type @kbd{C-h k} followed by the key of interest; for
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
399 example, @kbd{C-h k C-n} tells you what @kbd{C-n} does. @kbd{C-h} is
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
400 a prefix key; @kbd{C-h k} is just one of its subcommands (the command
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
401 @code{describe-key}). The other subcommands of @kbd{C-h} provide
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
402 different kinds of help. Type @kbd{C-h} twice to get a description of
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
403 all the help facilities. @xref{Help}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
404
Dave Love <fx@gnu.org>
parents:
diff changeset
405 @node Blank Lines
Dave Love <fx@gnu.org>
parents:
diff changeset
406 @section Blank Lines
Dave Love <fx@gnu.org>
parents:
diff changeset
407
Dave Love <fx@gnu.org>
parents:
diff changeset
408 @cindex inserting blank lines
Dave Love <fx@gnu.org>
parents:
diff changeset
409 @cindex deleting blank lines
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
410 Here are special commands and techniques for inserting and deleting
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
411 blank lines.
Dave Love <fx@gnu.org>
parents:
diff changeset
412
Dave Love <fx@gnu.org>
parents:
diff changeset
413 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
414 @item C-o
Dave Love <fx@gnu.org>
parents:
diff changeset
415 Insert one or more blank lines after the cursor (@code{open-line}).
Dave Love <fx@gnu.org>
parents:
diff changeset
416 @item C-x C-o
Dave Love <fx@gnu.org>
parents:
diff changeset
417 Delete all but one of many consecutive blank lines
Dave Love <fx@gnu.org>
parents:
diff changeset
418 (@code{delete-blank-lines}).
Dave Love <fx@gnu.org>
parents:
diff changeset
419 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
420
Dave Love <fx@gnu.org>
parents:
diff changeset
421 @kindex C-o
Dave Love <fx@gnu.org>
parents:
diff changeset
422 @kindex C-x C-o
Dave Love <fx@gnu.org>
parents:
diff changeset
423 @cindex blank lines
Dave Love <fx@gnu.org>
parents:
diff changeset
424 @findex open-line
Dave Love <fx@gnu.org>
parents:
diff changeset
425 @findex delete-blank-lines
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
426 To insert a new line of text before an existing line,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
427 type the new line of text, followed by @key{RET}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
428 However, it may be easier to see what you are doing if you first make a
Dave Love <fx@gnu.org>
parents:
diff changeset
429 blank line and then insert the desired text into it. This is easy to do
Dave Love <fx@gnu.org>
parents:
diff changeset
430 using the key @kbd{C-o} (@code{open-line}), which inserts a newline
Dave Love <fx@gnu.org>
parents:
diff changeset
431 after point but leaves point in front of the newline. After @kbd{C-o},
Dave Love <fx@gnu.org>
parents:
diff changeset
432 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
433 @w{@kbd{F O O @key{RET}}}, except for the final location of point.
Dave Love <fx@gnu.org>
parents:
diff changeset
434
Dave Love <fx@gnu.org>
parents:
diff changeset
435 You can make several blank lines by typing @kbd{C-o} several times, or
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
436 by giving it a numeric argument specifying how many blank lines to make.
62193
598f5ebd4f94 Various typo and grammar fixes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61100
diff changeset
437 @xref{Arguments}, for how. If you have a fill prefix, the @kbd{C-o}
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
438 command inserts the fill prefix on the new line, if typed at the
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
439 beginning of a line. @xref{Fill Prefix}.
Dave Love <fx@gnu.org>
parents:
diff changeset
440
Dave Love <fx@gnu.org>
parents:
diff changeset
441 The easy way to get rid of extra blank lines is with the command
Dave Love <fx@gnu.org>
parents:
diff changeset
442 @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
443 several blank lines deletes all but one of them. @kbd{C-x C-o} on a
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
444 lone blank line deletes that one. When point is on a nonblank line,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
445 @kbd{C-x C-o} deletes all following blank lines (if any).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
446
Dave Love <fx@gnu.org>
parents:
diff changeset
447 @node Continuation Lines
Dave Love <fx@gnu.org>
parents:
diff changeset
448 @section Continuation Lines
Dave Love <fx@gnu.org>
parents:
diff changeset
449
Dave Love <fx@gnu.org>
parents:
diff changeset
450 @cindex continuation line
Dave Love <fx@gnu.org>
parents:
diff changeset
451 @cindex wrapping
Dave Love <fx@gnu.org>
parents:
diff changeset
452 @cindex line wrapping
42902
f83cc0d82951 (Continuation Lines): Add index entries for the fringe usage.
Eli Zaretskii <eliz@gnu.org>
parents: 42364
diff changeset
453 @cindex fringes, and continuation lines
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
454 When a text line is too long to fit in one screen line, Emacs
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
455 displays it on two or more screen lines. This is called
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
456 @dfn{continuation} or @dfn{line wrapping}. On graphical displays,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
457 Emacs indicates line wrapping with small bent arrows in the left and
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
458 right window fringes. On text-only terminals, Emacs displays a
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
459 @samp{\} character at the right margin of a screen line if it is not
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
460 the last in its text line. This @samp{\} character says that the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
461 following screen line is not really a new text line.
36140
af4e219e9947 Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 35923
diff changeset
462
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
463 When line wrapping occurs just before a character that is wider than one
36140
af4e219e9947 Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 35923
diff changeset
464 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
465 ``empty.'' In this case, Emacs displays additional @samp{\}
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
466 characters in the ``empty'' columns before the @samp{\}
36140
af4e219e9947 Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 35923
diff changeset
467 character that indicates continuation.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
468
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
469 Continued lines can be difficult to read, since lines can break in
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
470 the middle of a word. If you prefer, you can make Emacs insert a
68464
79464a6167f5 * basic.texi (Continuation Lines, Inserting Text): Mention
Chong Yidong <cyd@stupidchicken.com>
parents: 68452
diff changeset
471 newline automatically when a line gets too long, by using Auto Fill
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
472 mode. Or enable Long Lines mode, which ensures that wrapping only
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
473 occurs between words. @xref{Filling}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
474
Dave Love <fx@gnu.org>
parents:
diff changeset
475 @cindex truncation
42902
f83cc0d82951 (Continuation Lines): Add index entries for the fringe usage.
Eli Zaretskii <eliz@gnu.org>
parents: 42364
diff changeset
476 @cindex line truncation, and fringes
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
477 Emacs can optionally @dfn{truncate} long lines---this means
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
478 displaying just one screen line worth, and the rest of the long line
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
479 does not appear at all. @samp{$} in the last column or a small
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
480 straight arrow in the window's right fringe indicates a truncated
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
481 line.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
482
72559
f142d3f60937 (Continuation Lines): Update xref.
Richard M. Stallman <rms@gnu.org>
parents: 72101
diff changeset
483 @xref{Line Truncation}, for more about line truncation,
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
484 and other variables that control how text is displayed.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
485
Dave Love <fx@gnu.org>
parents:
diff changeset
486 @node Position Info
Dave Love <fx@gnu.org>
parents:
diff changeset
487 @section Cursor Position Information
Dave Love <fx@gnu.org>
parents:
diff changeset
488
Dave Love <fx@gnu.org>
parents:
diff changeset
489 Here are commands to get information about the size and position of
Dave Love <fx@gnu.org>
parents:
diff changeset
490 parts of the buffer, and to count lines.
Dave Love <fx@gnu.org>
parents:
diff changeset
491
Dave Love <fx@gnu.org>
parents:
diff changeset
492 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
493 @item M-x what-page
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
494 Display the page number of point, and the line number within that page.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
495 @item M-x what-line
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
496 Display the line number of point in the whole buffer.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
497 @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
498 @itemx M-x column-number-mode
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
499 Toggle automatic display of the current line number or column number.
27220
dddb1bca9704 Reference column-number-mode, hl-line-mode, blink-cursor-mode.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
500 @xref{Optional Mode Line}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
501 @item M-=
36140
af4e219e9947 Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 35923
diff changeset
502 Display the number of lines in the current region (@code{count-lines-region}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
503 @xref{Mark}, for information about the region.
Dave Love <fx@gnu.org>
parents:
diff changeset
504 @item C-x =
36140
af4e219e9947 Miscellaneous clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 35923
diff changeset
505 Display the character code of character after point, character position of
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
506 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
507 @item M-x hl-line-mode
38660
65fd4c8a6447 (Position Info): Add a cross-reference to where hl-line-mode is described.
Eli Zaretskii <eliz@gnu.org>
parents: 38541
diff changeset
508 Enable or disable highlighting of the current line. @xref{Cursor
65fd4c8a6447 (Position Info): Add a cross-reference to where hl-line-mode is described.
Eli Zaretskii <eliz@gnu.org>
parents: 38541
diff changeset
509 Display}.
52462
b118cda42fa3 (Position Info): Mention `size-indication-mode'.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
510 @item M-x size-indication-mode
b118cda42fa3 (Position Info): Mention `size-indication-mode'.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
511 Toggle automatic display of the size of the buffer.
b118cda42fa3 (Position Info): Mention `size-indication-mode'.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
512 @xref{Optional Mode Line}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
513 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
514
Dave Love <fx@gnu.org>
parents:
diff changeset
515 @findex what-page
Dave Love <fx@gnu.org>
parents:
diff changeset
516 @findex what-line
Dave Love <fx@gnu.org>
parents:
diff changeset
517 @cindex line number commands
Dave Love <fx@gnu.org>
parents:
diff changeset
518 @cindex location of point
Dave Love <fx@gnu.org>
parents:
diff changeset
519 @cindex cursor location
Dave Love <fx@gnu.org>
parents:
diff changeset
520 @cindex point location
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
521 @kbd{M-x what-line} displays the current line number
62338
9d25647627a1 (Moving Point): Mention `M-g g' binding for goto-line.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62207
diff changeset
522 in the echo area. You can also see the current line number in the
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
523 mode line; see @ref{Mode Line}; but if you narrow the buffer, the
62338
9d25647627a1 (Moving Point): Mention `M-g g' binding for goto-line.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62207
diff changeset
524 line number in the mode line is relative to the accessible portion
9d25647627a1 (Moving Point): Mention `M-g g' binding for goto-line.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62207
diff changeset
525 (@pxref{Narrowing}). By contrast, @code{what-line} shows both the
9d25647627a1 (Moving Point): Mention `M-g g' binding for goto-line.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62207
diff changeset
526 line number relative to the narrowed region and the line number
9d25647627a1 (Moving Point): Mention `M-g g' binding for goto-line.
Luc Teirlinck <teirllm@auburn.edu>
parents: 62207
diff changeset
527 relative to the whole buffer.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
528
37152
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
529 @kbd{M-x what-page} counts pages from the beginning of the file, and
38870
d44abb4e68b2 Don't use "print" for displaying a message.
Richard M. Stallman <rms@gnu.org>
parents: 38767
diff changeset
530 counts lines within the page, showing both numbers in the echo area.
d44abb4e68b2 Don't use "print" for displaying a message.
Richard M. Stallman <rms@gnu.org>
parents: 38767
diff changeset
531 @xref{Pages}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
532
Dave Love <fx@gnu.org>
parents:
diff changeset
533 @kindex M-=
Dave Love <fx@gnu.org>
parents:
diff changeset
534 @findex count-lines-region
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
535 Use @kbd{M-=} (@code{count-lines-region}) to displays the number of
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
536 lines in the region (@pxref{Mark}). @xref{Pages}, for the command
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
537 @kbd{C-x l} which counts the lines in the current page.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
538
Dave Love <fx@gnu.org>
parents:
diff changeset
539 @kindex C-x =
Dave Love <fx@gnu.org>
parents:
diff changeset
540 @findex what-cursor-position
46040
3c219fd68a91 Update info on C-u C-x =.
Richard M. Stallman <rms@gnu.org>
parents: 45721
diff changeset
541 The command @kbd{C-x =} (@code{what-cursor-position}) shows what
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
542 cursor's column position, and other information about point and the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
543 character after it. It displays a line in the echo area that looks
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
544 like this:
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
545
Dave Love <fx@gnu.org>
parents:
diff changeset
546 @smallexample
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
547 Char: c (99, #o143, #x63) point=28062 of 36168 (78%) column=53
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
548 @end smallexample
Dave Love <fx@gnu.org>
parents:
diff changeset
549
Dave Love <fx@gnu.org>
parents:
diff changeset
550 The four values after @samp{Char:} describe the character that follows
Dave Love <fx@gnu.org>
parents:
diff changeset
551 point, first by showing it and then by giving its character code in
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
552 decimal, octal and hex. For a non-@acronym{ASCII} multibyte character, these are
66051
ef089f655621 (Position Info): Describe the case that Emacs shows
Kenichi Handa <handa@m17n.org>
parents: 64890
diff changeset
553 followed by @samp{file} and the character's representation, in hex, in
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
554 the buffer's coding system, if that coding system encodes the character
Dave Love <fx@gnu.org>
parents:
diff changeset
555 safely and with a single byte (@pxref{Coding Systems}). If the
66051
ef089f655621 (Position Info): Describe the case that Emacs shows
Kenichi Handa <handa@m17n.org>
parents: 64890
diff changeset
556 character's encoding is longer than one byte, Emacs shows @samp{file ...}.
ef089f655621 (Position Info): Describe the case that Emacs shows
Kenichi Handa <handa@m17n.org>
parents: 64890
diff changeset
557
ef089f655621 (Position Info): Describe the case that Emacs shows
Kenichi Handa <handa@m17n.org>
parents: 64890
diff changeset
558 However, if the character displayed is in the range 0200 through
66061
7fb814227358 (Position Info): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 66051
diff changeset
559 0377 octal, it may actually stand for an invalid UTF-8 byte read from
7fb814227358 (Position Info): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 66051
diff changeset
560 a file. In Emacs, that byte is represented as a sequence of 8-bit
7fb814227358 (Position Info): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 66051
diff changeset
561 characters, but all of them together display as the original invalid
7fb814227358 (Position Info): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 66051
diff changeset
562 byte, in octal code. In this case, @kbd{C-x =} shows @samp{part of
7fb814227358 (Position Info): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 66051
diff changeset
563 display ...} instead of @samp{file}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
564
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
565 @samp{point=} is followed by the position of point expressed as a
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
566 character count. The start of the buffer is position 1, one character
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
567 later is position 2, and so on. The next, larger, number is the total
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
568 number of characters in the buffer. Afterward in parentheses comes
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
569 the position expressed as a percentage of the total size.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
570
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
571 @samp{column=} is followed by the horizontal position of point, in
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
572 columns from the left edge of the window.
Dave Love <fx@gnu.org>
parents:
diff changeset
573
Dave Love <fx@gnu.org>
parents:
diff changeset
574 If the buffer has been narrowed, making some of the text at the
38870
d44abb4e68b2 Don't use "print" for displaying a message.
Richard M. Stallman <rms@gnu.org>
parents: 38767
diff changeset
575 beginning and the end temporarily inaccessible, @kbd{C-x =} displays
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
576 additional text describing the currently accessible range. For example, it
Dave Love <fx@gnu.org>
parents:
diff changeset
577 might display this:
Dave Love <fx@gnu.org>
parents:
diff changeset
578
Dave Love <fx@gnu.org>
parents:
diff changeset
579 @smallexample
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
580 Char: C (67, #o103, #x43) point=252 of 889 (28%) <231-599> column=0
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
581 @end smallexample
Dave Love <fx@gnu.org>
parents:
diff changeset
582
Dave Love <fx@gnu.org>
parents:
diff changeset
583 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
584 where the two extra numbers give the smallest and largest character
Dave Love <fx@gnu.org>
parents:
diff changeset
585 position that point is allowed to assume. The characters between those
Dave Love <fx@gnu.org>
parents:
diff changeset
586 two positions are the accessible ones. @xref{Narrowing}.
Dave Love <fx@gnu.org>
parents:
diff changeset
587
Dave Love <fx@gnu.org>
parents:
diff changeset
588 If point is at the end of the buffer (or the end of the accessible
Dave Love <fx@gnu.org>
parents:
diff changeset
589 part), the @w{@kbd{C-x =}} output does not describe a character after
Dave Love <fx@gnu.org>
parents:
diff changeset
590 point. The output might look like this:
Dave Love <fx@gnu.org>
parents:
diff changeset
591
Dave Love <fx@gnu.org>
parents:
diff changeset
592 @smallexample
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
593 point=36169 of 36168 (EOB) column=0
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
594 @end smallexample
Dave Love <fx@gnu.org>
parents:
diff changeset
595
44875
cc99f1248f49 (Position Info): Add text properties to the example. Add index entries.
Eli Zaretskii <eliz@gnu.org>
parents: 43468
diff changeset
596 @cindex character set of character at point
45313
39adae4ad3df (Position Info): Add an index entry for font at point.
Eli Zaretskii <eliz@gnu.org>
parents: 44875
diff changeset
597 @cindex font of character at point
44875
cc99f1248f49 (Position Info): Add text properties to the example. Add index entries.
Eli Zaretskii <eliz@gnu.org>
parents: 43468
diff changeset
598 @cindex text properties at point
82432
dc09c3d8a304 (Position Info): Add index entry for face at point.
Eli Zaretskii <eliz@gnu.org>
parents: 75348
diff changeset
599 @cindex face at point
62193
598f5ebd4f94 Various typo and grammar fixes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61100
diff changeset
600 @w{@kbd{C-u C-x =}} displays the following additional information about a
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
601 character.
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
602
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
603 @itemize @bullet
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
604 @item
61100
9d57acce20e8 (Position Info): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 61066
diff changeset
605 The character set name, and the codes that identify the character
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
606 within that character set; @acronym{ASCII} characters are identified
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
607 as belonging to the @code{ascii} character set.
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
608
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
609 @item
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
610 The character's syntax and categories.
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
611
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
612 @item
61100
9d57acce20e8 (Position Info): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 61066
diff changeset
613 The character's encodings, both internally in the buffer, and externally
9d57acce20e8 (Position Info): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 61066
diff changeset
614 if you were to save the file.
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
615
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
616 @item
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
617 What keys to type to input the character in the current input method
61100
9d57acce20e8 (Position Info): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 61066
diff changeset
618 (if it supports the character).
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
619
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
620 @item
68685
4bb94c09a47d (Position Info): "Graphical displays", rather than window systems.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
621 If you are running Emacs on a graphical display, the font name and
4bb94c09a47d (Position Info): "Graphical displays", rather than window systems.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
622 glyph code for the character. If you are running Emacs on a text-only
4bb94c09a47d (Position Info): "Graphical displays", rather than window systems.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
623 terminal, the code(s) sent to the terminal.
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
624
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
625 @item
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
626 The character's text properties (@pxref{Text Properties,,,
82432
dc09c3d8a304 (Position Info): Add index entry for face at point.
Eli Zaretskii <eliz@gnu.org>
parents: 75348
diff changeset
627 elisp, the Emacs Lisp Reference Manual}), including any non-default
dc09c3d8a304 (Position Info): Add index entry for face at point.
Eli Zaretskii <eliz@gnu.org>
parents: 75348
diff changeset
628 faces used to display the character, and any overlays containing it
46040
3c219fd68a91 Update info on C-u C-x =.
Richard M. Stallman <rms@gnu.org>
parents: 45721
diff changeset
629 (@pxref{Overlays,,, elisp, the same manual}).
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
630 @end itemize
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
631
42364
c66f34e7d2cd Update C-u C-x = output format.
Richard M. Stallman <rms@gnu.org>
parents: 39287
diff changeset
632 Here's an example showing the Latin-1 character A with grave accent,
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
633 in a buffer whose coding system is @code{iso-latin-1}, whose
42364
c66f34e7d2cd Update C-u C-x = output format.
Richard M. Stallman <rms@gnu.org>
parents: 39287
diff changeset
634 terminal coding system is @code{iso-latin-1} (so the terminal actually
44875
cc99f1248f49 (Position Info): Add text properties to the example. Add index entries.
Eli Zaretskii <eliz@gnu.org>
parents: 43468
diff changeset
635 displays the character as @samp{@`A}), and which has font-lock-mode
cc99f1248f49 (Position Info): Add text properties to the example. Add index entries.
Eli Zaretskii <eliz@gnu.org>
parents: 43468
diff changeset
636 (@pxref{Font Lock}) enabled:
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
637
37152
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
638 @smallexample
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
639 character: @`A (2240, #o4300, #x8c0, U+00C0)
67918
c14267a3323d (Position Info): Update example.
Juri Linkov <juri@jurta.org>
parents: 67040
diff changeset
640 charset: latin-iso8859-1
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
641 (Right-Hand Part of Latin Alphabet 1@dots{}
67918
c14267a3323d (Position Info): Update example.
Juri Linkov <juri@jurta.org>
parents: 67040
diff changeset
642 code point: #x40
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
643 syntax: w which means: word
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
644 category: l:Latin
67918
c14267a3323d (Position Info): Update example.
Juri Linkov <juri@jurta.org>
parents: 67040
diff changeset
645 to input: type "`A" with latin-1-prefix
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
646 buffer code: #x81 #xC0
67918
c14267a3323d (Position Info): Update example.
Juri Linkov <juri@jurta.org>
parents: 67040
diff changeset
647 file code: #xC0 (encoded by coding system iso-latin-1)
67040
4c99ea8adc42 (Position Info): Update examples of the output.
Juri Linkov <juri@jurta.org>
parents: 66061
diff changeset
648 display: terminal code #xC0
44875
cc99f1248f49 (Position Info): Add text properties to the example. Add index entries.
Eli Zaretskii <eliz@gnu.org>
parents: 43468
diff changeset
649
61066
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
650 There are text properties here:
bf195b369bc1 (Position Info): Update the description about the
Kenichi Handa <handa@m17n.org>
parents: 60788
diff changeset
651 fontified t
37152
693e61ce18ff Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 37120
diff changeset
652 @end smallexample
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
653
Dave Love <fx@gnu.org>
parents:
diff changeset
654 @node Arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
655 @section Numeric Arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
656 @cindex numeric arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
657 @cindex prefix arguments
36263
11db0318031d Remove redundant index entries.
Eli Zaretskii <eliz@gnu.org>
parents: 36209
diff changeset
658 @cindex arguments to commands
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
659
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
660 In mathematics and computer usage, @dfn{argument} means
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
661 ``data provided to a function or operation.'' You can give any Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
662 command a @dfn{numeric argument} (also called a @dfn{prefix argument}).
Dave Love <fx@gnu.org>
parents:
diff changeset
663 Some commands interpret the argument as a repetition count. For
Dave Love <fx@gnu.org>
parents:
diff changeset
664 example, @kbd{C-f} with an argument of ten moves forward ten characters
Dave Love <fx@gnu.org>
parents:
diff changeset
665 instead of one. With these commands, no argument is equivalent to an
Dave Love <fx@gnu.org>
parents:
diff changeset
666 argument of one. Negative arguments tell most such commands to move or
Dave Love <fx@gnu.org>
parents:
diff changeset
667 act in the opposite direction.
Dave Love <fx@gnu.org>
parents:
diff changeset
668
Dave Love <fx@gnu.org>
parents:
diff changeset
669 @kindex M-1
Dave Love <fx@gnu.org>
parents:
diff changeset
670 @kindex M-@t{-}
Dave Love <fx@gnu.org>
parents:
diff changeset
671 @findex digit-argument
Dave Love <fx@gnu.org>
parents:
diff changeset
672 @findex negative-argument
59947
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
673 If your terminal keyboard has a @key{META} key (labeled @key{ALT} on
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
674 PC keyboards), the easiest way to specify a numeric argument is to
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
675 type digits and/or a minus sign while holding down the @key{META} key.
801aa21b27e9 (Inserting Text): Cleanup wording.
Richard M. Stallman <rms@gnu.org>
parents: 59883
diff changeset
676 For example,
38729
7d62f0684e99 (Arguments): Say explicitly that M-- is -1. Fix spacing in an @example.
Eli Zaretskii <eliz@gnu.org>
parents: 38660
diff changeset
677
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
678 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
679 M-5 C-n
Dave Love <fx@gnu.org>
parents:
diff changeset
680 @end example
38729
7d62f0684e99 (Arguments): Say explicitly that M-- is -1. Fix spacing in an @example.
Eli Zaretskii <eliz@gnu.org>
parents: 38660
diff changeset
681
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
682 @noindent
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
683 moves down five lines. The characters @kbd{Meta-1}, @kbd{Meta-2},
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
684 and so on, as well as @kbd{Meta--}, do this because they are keys bound
Dave Love <fx@gnu.org>
parents:
diff changeset
685 to commands (@code{digit-argument} and @code{negative-argument}) that
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
686 are defined to set up an argument for the next command.
38729
7d62f0684e99 (Arguments): Say explicitly that M-- is -1. Fix spacing in an @example.
Eli Zaretskii <eliz@gnu.org>
parents: 38660
diff changeset
687 @kbd{Meta--} without digits normally means @minus{}1. Digits and
7d62f0684e99 (Arguments): Say explicitly that M-- is -1. Fix spacing in an @example.
Eli Zaretskii <eliz@gnu.org>
parents: 38660
diff changeset
688 @kbd{-} modified with Control, or Control and Meta, also specify numeric
7d62f0684e99 (Arguments): Say explicitly that M-- is -1. Fix spacing in an @example.
Eli Zaretskii <eliz@gnu.org>
parents: 38660
diff changeset
689 arguments.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
690
Dave Love <fx@gnu.org>
parents:
diff changeset
691 @kindex C-u
Dave Love <fx@gnu.org>
parents:
diff changeset
692 @findex universal-argument
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
693 You can also specify a numeric argument by typing @kbd{C-u}
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
694 (@code{universal-argument}) followed by the digits. The advantage of
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
695 @kbd{C-u} is that you can type the digits without modifier keys; thus,
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
696 @kbd{C-u} works on all terminals. For a negative argument, type a
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
697 minus sign after @kbd{C-u}. A minus sign without digits normally
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
698 means @minus{}1.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
699
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
700 @kbd{C-u} alone has the special meaning of
68452
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
701 ``four times'': it multiplies the argument for the next command by
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
702 four. @kbd{C-u C-u} multiplies it by sixteen. Thus, @kbd{C-u C-u
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
703 C-f} moves forward sixteen characters. This is a good way to move
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
704 forward ``fast,'' since it moves about 1/5 of a line in the usual size
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
705 screen. Other useful combinations are @kbd{C-u C-n}, @kbd{C-u C-u
b3bbd1af21eb Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68190
diff changeset
706 C-n} (move down a good fraction of a screen), @kbd{C-u C-u C-o} (make
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
707 ``a lot'' of blank lines), and @kbd{C-u C-k} (kill four lines).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
708
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
709 Some commands care whether there is an argument, but ignore its
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
710 value. For example, the command @kbd{M-q} (@code{fill-paragraph})
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
711 fills text; with an argument, it justifies the text as well.
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
712 (@xref{Filling}, for more information on @kbd{M-q}.) Plain @kbd{C-u}
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
713 is a handy way of providing an argument for such commands.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
714
Dave Love <fx@gnu.org>
parents:
diff changeset
715 Some commands use the value of the argument as a repeat count, but do
Dave Love <fx@gnu.org>
parents:
diff changeset
716 something peculiar when there is no argument. For example, the command
Dave Love <fx@gnu.org>
parents:
diff changeset
717 @kbd{C-k} (@code{kill-line}) with argument @var{n} kills @var{n} lines,
Dave Love <fx@gnu.org>
parents:
diff changeset
718 including their terminating newlines. But @kbd{C-k} with no argument is
Dave Love <fx@gnu.org>
parents:
diff changeset
719 special: it kills the text up to the next newline, or, if point is right at
Dave Love <fx@gnu.org>
parents:
diff changeset
720 the end of the line, it kills the newline itself. Thus, two @kbd{C-k}
Dave Love <fx@gnu.org>
parents:
diff changeset
721 commands with no arguments can kill a nonblank line, just like @kbd{C-k}
Dave Love <fx@gnu.org>
parents:
diff changeset
722 with an argument of one. (@xref{Killing}, for more information on
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
723 @kbd{C-k}.)
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
724
Dave Love <fx@gnu.org>
parents:
diff changeset
725 A few commands treat a plain @kbd{C-u} differently from an ordinary
Dave Love <fx@gnu.org>
parents:
diff changeset
726 argument. A few others may treat an argument of just a minus sign
Dave Love <fx@gnu.org>
parents:
diff changeset
727 differently from an argument of @minus{}1. These unusual cases are
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
728 described when they come up; they exist to make an individual command
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
729 more convenient, and they are documented in that command's
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
730 documentation string.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
731
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
732 You can use a numeric argument before a self-inserting character to
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
733 insert multiple copies of it. This is straightforward when the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
734 character is not a digit; for example, @kbd{C-u 6 4 a} inserts 64
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
735 copies of the character @samp{a}. But this does not work for
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
736 inserting digits; @kbd{C-u 6 4 1} specifies an argument of 641. You
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
737 can separate the argument from the digit to insert with another
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
738 @kbd{C-u}; for example, @kbd{C-u 6 4 C-u 1} does insert 64 copies of
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
739 the character @samp{1}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
740
72101
c7e4f78b81a6 Move periods and commas inside quotes.
Richard M. Stallman <rms@gnu.org>
parents: 71114
diff changeset
741 We use the term ``prefix argument'' as well as ``numeric argument,''
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
742 to emphasize that you type these argument before the command, and to
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
743 distinguish them from minibuffer arguments that come after the
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
744 command.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
745
Dave Love <fx@gnu.org>
parents:
diff changeset
746 @node Repeating
Dave Love <fx@gnu.org>
parents:
diff changeset
747 @section Repeating a Command
Dave Love <fx@gnu.org>
parents:
diff changeset
748 @cindex repeating a command
Dave Love <fx@gnu.org>
parents:
diff changeset
749
38738
bffa96512ce4 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 38729
diff changeset
750 Many simple commands, such as those invoked with a single key or
bffa96512ce4 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 38729
diff changeset
751 with @kbd{M-x @var{command-name} @key{RET}}, can be repeated by
bffa96512ce4 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 38729
diff changeset
752 invoking them with a numeric argument that serves as a repeat count
bffa96512ce4 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 38729
diff changeset
753 (@pxref{Arguments}). However, if the command you want to repeat
71045
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
754 prompts for input, or uses a numeric argument in another way, that
ddc3087f4c41 Many simplifications and improvements in wording.
Richard M. Stallman <rms@gnu.org>
parents: 68685
diff changeset
755 method won't work.
38541
2540b694650b (Repeating): Mention the numeric argument as another form of repetition,
Eli Zaretskii <eliz@gnu.org>
parents: 38172
diff changeset
756
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
757 @kindex C-x z
Dave Love <fx@gnu.org>
parents:
diff changeset
758 @findex repeat
Dave Love <fx@gnu.org>
parents:
diff changeset
759 The command @kbd{C-x z} (@code{repeat}) provides another way to repeat
Dave Love <fx@gnu.org>
parents:
diff changeset
760 an Emacs command many times. This command repeats the previous Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
761 command, whatever that was. Repeating a command uses the same arguments
Dave Love <fx@gnu.org>
parents:
diff changeset
762 that were used before; it does not read new arguments each time.
Dave Love <fx@gnu.org>
parents:
diff changeset
763
Dave Love <fx@gnu.org>
parents:
diff changeset
764 To repeat the command more than once, type additional @kbd{z}'s: each
Dave Love <fx@gnu.org>
parents:
diff changeset
765 @kbd{z} repeats the command one more time. Repetition ends when you
Dave Love <fx@gnu.org>
parents:
diff changeset
766 type a character other than @kbd{z}, or press a mouse button.
Dave Love <fx@gnu.org>
parents:
diff changeset
767
Dave Love <fx@gnu.org>
parents:
diff changeset
768 For example, suppose you type @kbd{C-u 2 0 C-d} to delete 20
Dave Love <fx@gnu.org>
parents:
diff changeset
769 characters. You can repeat that command (including its argument) three
Dave Love <fx@gnu.org>
parents:
diff changeset
770 additional times, to delete a total of 80 characters, by typing @kbd{C-x
Dave Love <fx@gnu.org>
parents:
diff changeset
771 z z z}. The first @kbd{C-x z} repeats the command once, and each
Dave Love <fx@gnu.org>
parents:
diff changeset
772 subsequent @kbd{z} repeats it once again.
Dave Love <fx@gnu.org>
parents:
diff changeset
773
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
774 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
775 arch-tag: cda8952a-c439-41c1-aecf-4bc0d6482956
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
776 @end ignore