annotate man/basic.texi @ 60800:06251e15fd5e

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