annotate man/xemacs/basic.texi @ 370:bd866891f083

Added tag r21-1-14 for changeset 1d62742628b6
author cvs
date Mon, 13 Aug 2007 11:01:58 +0200
parents a4f53d9b3154
children cc15677e0335
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
367
a4f53d9b3154 Import from CVS: tag r21-1-13
cvs
parents: 296
diff changeset
1 @c This is part of the XEmacs manual.
a4f53d9b3154 Import from CVS: tag r21-1-13
cvs
parents: 296
diff changeset
2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
a4f53d9b3154 Import from CVS: tag r21-1-13
cvs
parents: 296
diff changeset
3 @c See file xemacs.texi for copying conditions.
a4f53d9b3154 Import from CVS: tag r21-1-13
cvs
parents: 296
diff changeset
4 @node Basic, Undo, Packages, Top
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @chapter Basic Editing Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @kindex C-h t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @findex help-with-tutorial
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 We now give the basics of how to enter text, make corrections, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 save the text in a file. If this material is new to you, you might
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 learn it more easily by running the Emacs learn-by-doing tutorial. To
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 do this, type @kbd{Control-h t} (@code{help-with-tutorial}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 @section Inserting Text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 @cindex insertion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 @cindex point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 @cindex cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 @cindex graphic characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 To insert printing characters into the text you are editing, just type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 them. This inserts the characters into the buffer at the cursor (that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 is, at @dfn{point}; @pxref{Point}). The cursor moves forward. Any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 characters after the cursor move forward too. If the text in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 is @samp{FOOBAR}, with the cursor before the @samp{B}, and you type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 @kbd{XX}, the result is @samp{FOOXXBAR}, with the cursor still before the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 @samp{B}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 @kindex DEL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 @cindex deletion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 To @dfn{delete} text you have just inserted, use @key{DEL}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 @key{DEL} deletes the character @var{before} the cursor (not the one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 that the cursor is on top of or under; that is the character @var{after}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 the cursor). The cursor and all characters after it move backwards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 Therefore, if you type a printing character and then type @key{DEL},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 they cancel out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 @kindex RET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 @cindex newline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 To end a line and start typing a new one, type @key{RET}. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 inserts a newline character in the buffer. If point is in the middle of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 a line, @key{RET} splits the line. Typing @key{DEL} when the cursor is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 at the beginning of a line rubs out the newline before the line, thus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 joining the line with the preceding line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 Emacs automatically splits lines when they become too long, if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 turn on a special mode called @dfn{Auto Fill} mode. @xref{Filling}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 information on using Auto Fill mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 @findex delete-backward-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 @findex newline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 @findex self-insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 Customization information: @key{DEL}, in most modes, runs the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 @code{delete-backward-char}; @key{RET} runs the command @code{newline},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 and self-inserting printing characters run the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 @code{self-insert}, which inserts whatever character was typed to invoke
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 it. Some major modes rebind @key{DEL} to other commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 @cindex quoting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 @kindex C-q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 @findex quoted-insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 Direct insertion works for printing characters and @key{SPC}, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 other characters act as editing commands and do not insert themselves.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 If you need to insert a control character or a character whose code is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 above 200 octal, you must @dfn{quote} it by typing the character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 @kbd{control-q} (@code{quoted-insert}) first. There are two ways to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 @kbd{C-q}:@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 @kbd{Control-q} followed by any non-graphic character (even @kbd{C-g})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 inserts that character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 @kbd{Control-q} followed by three octal digits inserts the character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 with the specified character code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 A numeric argument to @kbd{C-q} specifies how many copies of the quoted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 character should be inserted (@pxref{Arguments}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 If you prefer to have text characters replace (overwrite) existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 text instead of moving it to the right, you can enable Overwrite mode, a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 minor mode. @xref{Minor Modes}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 @section Changing the Location of Point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 To do more than insert characters, you have to know how to move point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (@pxref{Point}). Here are a few of the available commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 NOTE: Many of the following commands have two versions, one that uses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 the function keys (e.g. @key{LEFT} or @key{END}) and one that doesn't.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 The former versions may only be available on X terminals (i.e. not on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 TTY's), but the latter are available on all terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 @kindex C-a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 @kindex C-e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 @kindex C-f
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 @kindex C-b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 @kindex C-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 @kindex C-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @kindex C-l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 @kindex C-t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 @kindex C-v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 @kindex M-v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 @kindex M->
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 @kindex M-<
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @kindex M-r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 @kindex LEFT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 @kindex RIGHT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 @kindex UP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 @kindex DOWN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 @kindex HOME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 @kindex END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 @kindex PGUP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 @kindex PGDN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @kindex C-LEFT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 @kindex C-RIGHT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 @kindex C-HOME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 @kindex C-END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 @findex beginning-of-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 @findex end-of-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 @findex forward-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 @findex backward-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 @findex next-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 @findex previous-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 @findex recenter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 @findex transpose-chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @findex beginning-of-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 @findex end-of-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 @findex goto-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 @findex goto-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 @findex move-to-window-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 @item C-a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 @itemx HOME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 Move to the beginning of the line (@code{beginning-of-line}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 @item C-e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 @itemx END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 Move to the end of the line (@code{end-of-line}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 @item C-f
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 @itemx RIGHT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 Move forward one character (@code{forward-char}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 @item C-b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 @itemx LEFT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 Move backward one character (@code{backward-char}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 @item M-f
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 @itemx C-RIGHT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 Move forward one word (@code{forward-word}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 @item M-b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 @itemx C-LEFT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 Move backward one word (@code{backward-word}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 @item C-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 @itemx DOWN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 Move down one line, vertically (@code{next-line}). This command attempts to keep the horizontal position unchanged, so if you start in the middle of one line, you end in the middle of the next. When on the last line of text, @kbd{C-n} creates a new line and moves onto it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 @item C-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 @itemx UP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 Move up one line, vertically (@code{previous-line}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @item C-v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 @itemx PGDN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 Move down one page, vertically (@code{scroll-up}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 @item M-v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 @itemx PGUP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 Move up one page, vertically (@code{scroll-down}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 @item C-l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 Clear the frame and reprint everything (@code{recenter}). Text moves
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 on the frame to bring point to the center of the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 @item M-r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 Move point to left margin on the line halfway down the frame or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 window (@code{move-to-window-line}). Text does not move on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 frame. A numeric argument says how many screen lines down from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 top of the window (zero for the top). A negative argument counts from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 the bottom (@minus{}1 for the bottom).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 @item C-t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 Transpose two characters, the ones before and after the cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 @*(@code{transpose-chars}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 @item M-<
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 @itemx C-HOME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 Move to the top of the buffer (@code{beginning-of-buffer}). With
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 numeric argument @var{n}, move to @var{n}/10 of the way from the top.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 @xref{Arguments}, for more information on numeric arguments.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 @item M->
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 @itemx C-END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 Move to the end of the buffer (@code{end-of-buffer}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 @item M-x goto-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 Read a number @var{n} and move the cursor to character number @var{n}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 Position 1 is the beginning of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 @item M-g
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 Read a number @var{n} and move cursor to line number @var{n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (@code{goto-line}). Line 1 is the beginning of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 @item C-x C-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @findex set-goal-column
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 Use the current column of point as the @dfn{semi-permanent goal column} for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 @kbd{C-n} and @kbd{C-p} (@code{set-goal-column}). Henceforth, those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 commands always move to this column in each line moved into, or as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 close as possible given the contents of the line. This goal column remains
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 in effect until canceled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 @item C-u C-x C-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 Cancel the goal column. Henceforth, @kbd{C-n} and @kbd{C-p} once
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 again try to avoid changing the horizontal position, as usual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 @vindex track-eol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 If you set the variable @code{track-eol} to a non-@code{nil} value,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 @kbd{C-n} and @kbd{C-p} move to the end of the line when at the end of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 the starting line. By default, @code{track-eol} is @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 @section Erasing Text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 @item @key{DEL}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 Delete the character before the cursor (@code{delete-backward-char}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 @item C-d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 Delete the character after the cursor (@code{delete-char}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 @item C-k
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 Kill to the end of the line (@code{kill-line}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 @item M-d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 Kill forward to the end of the next word (@code{kill-word}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 @item M-@key{DEL}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 Kill back to the beginning of the previous word
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (@code{backward-kill-word}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 In contrast to the @key{DEL} key, which deletes the character before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 the cursor, @kbd{Control-d} deletes the character after the cursor,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 causing the rest of the text on the line to shift left. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 @kbd{Control-d} is typed at the end of a line, that line and the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 line are joined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 To erase a larger amount of text, use @kbd{Control-k}, which kills a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 line at a time. If you use @kbd{C-k} at the beginning or in the middle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 of a line, it kills all the text up to the end of the line. If you use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 @kbd{C-k} at the end of a line, it joins that line and the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 @xref{Killing}, for more flexible ways of killing text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 @section Files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 @cindex files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 The commands above are sufficient for creating and altering text in an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 Emacs buffer. More advanced Emacs commands just make things easier. But
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 to keep any text permanently you must put it in a @dfn{file}. Files are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 named units of text which are stored by the operating system and which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 you can retrieve by name. To look at or use the contents of a file in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 any way, including editing the file with Emacs, you must specify the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 Consider a file named @file{/usr/rms/foo.c}. To begin editing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 this file from Emacs, type:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 C-x C-f /usr/rms/foo.c @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 The file name is given as an @dfn{argument} to the command @kbd{C-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 C-f} (@code{find-file}). The command uses the @dfn{minibuffer} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 read the argument. You have to type @key{RET} to terminate the argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (@pxref{Minibuffer}).@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 You can also use the @b{Open...} menu item from the @b{File} menu, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 type the name of the file to the prompt.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 Emacs obeys the command by @dfn{visiting} the file: it creates a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 buffer, copies the contents of the file into the buffer, and then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 displays the buffer for you to edit. You can make changes in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 buffer, and then @dfn{save} the file by typing @kbd{C-x C-s}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (@code{save-buffer}) or choosing @b{Save Buffer} from the @b{File} menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 This makes the changes permanent by copying the altered contents of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 buffer back into the file @file{/usr/rms/foo.c}. Until then, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 changes are only inside your Emacs buffer, and the file @file{foo.c} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 not changed.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 To create a file, visit the file with @kbd{C-x C-f} as if it already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 existed or choose @b{Open...} from the @b{File} menu and provide the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 name for the new file in the minibuffer. Emacs will create an empty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 buffer in which you can insert the text you want to put in the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 When you save the buffer with @kbd{C-x C-s}, or by choosing @b{Save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 Buffer} from the @b{File} menu, the file is created.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 To learn more about using files, @pxref{Files}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 @section Help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 If you forget what a key does, you can use the Help character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (@kbd{C-h}) to find out: Type @kbd{C-h k} followed by the key you want
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 to know about. For example, @kbd{C-h k C-n} tells you what @kbd{C-n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 does. @kbd{C-h} is a prefix key; @kbd{C-h k} is just one of its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 subcommands (the command @code{describe-key}). The other subcommands of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 @kbd{C-h} provide different kinds of help. Type @kbd{C-h} three times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 to get a description of all the help facilities. @xref{Help}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 * Blank Lines:: Commands to make or delete blank lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 * Continuation Lines:: Lines too wide for the frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 * Position Info:: What page, line, row, or column is point on?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 * Arguments:: Numeric arguments for repeating a command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 @node Blank Lines, Continuation Lines, Basic, Basic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 @section Blank Lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 Here are special commands and techniques for entering and removing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 blank lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 @c widecommands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 @item C-o
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 Insert one or more blank lines after the cursor (@code{open-line}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 @item C-x C-o
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 Delete all but one of many consecutive blank lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (@code{delete-blank-lines}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 @kindex C-o
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 @kindex C-x C-o
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 @cindex blank lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 @findex open-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 @findex delete-blank-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 When you want to insert a new line of text before an existing line,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 you just type the new line of text, followed by @key{RET}. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 prefer to create a blank line first and then insert the desired text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 use the key @kbd{C-o} (@code{open-line}), which inserts a newline after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 point but leaves point in front of the newline. Then type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 the text into the new line. @kbd{C-o F O O} has the same effect as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 @kbd{F O O @key{RET}}, except for the final location of point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 To create several blank lines, type @kbd{C-o} several times, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 give @kbd{C-o} an argument indicating how many blank lines to create.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 @xref{Arguments}, for more information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 If you have many blank lines in a row and want to get rid of them, use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 @kbd{C-x C-o} (@code{delete-blank-lines}). If point is on a blank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 line which is adjacent to at least one other blank line, @kbd{C-x C-o}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 deletes all but one of the blank lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 If point is on a blank line with no other adjacent blank line, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 sole blank line is deleted. If point is on a non-blank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 line, @kbd{C-x C-o} deletes any blank lines following that non-blank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 @node Continuation Lines, Position Info, Blank Lines, Basic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 @section Continuation Lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 @cindex continuation line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 If you add too many characters to one line without breaking with a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 @key{RET}, the line grows to occupy two (or more) screen lines, with a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 curved arrow at the extreme right margin of all but the last line. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 curved arrow indicates that the following screen line is not really a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 distinct line in the text, but just the @dfn{continuation} of a line too
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 long to fit the frame. You can use Auto Fill mode (@pxref{Filling})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 to have Emacs insert newlines automatically when a line gets too long.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 @vindex truncate-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 @cindex truncation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 Instead of continuation, long lines can be displayed by @dfn{truncation}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 This means that all the characters that do not fit in the width of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 frame or window do not appear at all. They remain in the buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 temporarily invisible. Three diagonal dots in the last column (instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 the curved arrow inform you that truncation is in effect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 To turn off continuation for a particular buffer, set the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 variable @code{truncate-lines} to non-@code{nil} in that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 Truncation instead of continuation also happens whenever horizontal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 scrolling is in use, and optionally whenever side-by-side windows are in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 use (@pxref{Windows}). Altering the value of @code{truncate-lines} makes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 it local to the current buffer; until that time, the default value is in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 effect. The default is initially @code{nil}. @xref{Locals}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 @node Position Info, Arguments, Continuation Lines, Basic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 @section Cursor Position Information
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 If you are accustomed to other display editors, you may be surprised
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 that Emacs does not always display the page number or line number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 point in the mode line. In Emacs, this information is only rarely
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 needed, and a number of commands are available to compute and print it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 Since text is stored in a way that makes it difficult to compute the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 information, it is not displayed all the time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 @item M-x what-page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 Print page number of point, and line number within page.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 @item M-x what-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 Print line number of point in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 @item M-=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 Print number of lines and characters in the current region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (@code{count-lines-region}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 @item C-x =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 Print character code of character after point, character position of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 point, and column of point (@code{what-cursor-position}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 @findex what-page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 @findex what-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 @cindex line number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 @cindex page number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 @kindex M-=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 @findex count-lines-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 There are several commands for printing line numbers:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @kbd{M-x what-line} counts lines from the beginning of the file and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 prints the line number point is on. The first line of the file is line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 number 1. You can use these numbers as arguments to @kbd{M-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 goto-line}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 @kbd{M-x what-page} counts pages from the beginning of the file, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 counts lines within the page, printing both of them. @xref{Pages}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 the command @kbd{C-x l}, which counts the lines in the current page.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 @kbd{M-=} (@code{count-lines-region}) prints the number of lines in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 the region (@pxref{Mark}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 @kindex C-x =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 @findex what-cursor-position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 The command @kbd{C-x =} (@code{what-cursor-position}) provides
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 information about point and about the column the cursor is in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 It prints a line in the echo area that looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 Char: x (0170) point=65986 of 563027(12%) column 44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (In fact, this is the output produced when point is before @samp{column 44}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 in the example.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 The two values after @samp{Char:} describe the character following point,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 first by showing it and second by giving its octal character code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 @samp{point=} is followed by the position of point expressed as a character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 count. The front of the buffer counts as position 1, one character later
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 as 2, and so on. The next, larger number is the total number of characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 in the buffer. Afterward in parentheses comes the position expressed as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 percentage of the total size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 @samp{column} is followed by the horizontal position of point, in columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 from the left edge of the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 If the buffer has been narrowed, making some of the text at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 beginning and the end temporarily invisible, @kbd{C-x =} prints
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 additional text describing the current visible range. For example, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 might say:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 Char: x (0170) point=65986 of 563025(12%) <65102 - 68533> column 44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 where the two extra numbers give the smallest and largest character position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 that point is allowed to assume. The characters between those two positions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 are the visible ones. @xref{Narrowing}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 If point is at the end of the buffer (or the end of the visible part),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 @kbd{C-x =} omits any description of the character after point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 The output looks like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 point=563026 of 563025(100%) column 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 @node Arguments,, Position Info, Basic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 @section Numeric Arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 @cindex numeric arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 Any Emacs command can be given a @dfn{numeric argument}. Some commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 interpret the argument as a repetition count. For example, giving an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 argument of ten to the key @kbd{C-f} (the command @code{forward-char}, move
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 forward one character) moves forward ten characters. With these commands,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 no argument is equivalent to an argument of one. Negative arguments are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 allowed. Often they tell a command to move or act backwards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 @kindex M-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 @kindex M-@t{-}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 @findex digit-argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 @findex negative-argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 If your keyboard has a @key{META} key (labelled with a diamond on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 Sun-type keyboards and labelled @samp{Alt} on some other keyboards), the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 easiest way to specify a numeric argument is to type digits and/or a
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
482 minus sign while holding down the @key{META} key. For example,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 M-5 C-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 moves down five lines. The characters @kbd{Meta-1}, @kbd{Meta-2}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 so on, as well as @kbd{Meta--}, do this because they are keys bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 commands (@code{digit-argument} and @code{negative-argument}) that are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 defined to contribute to an argument for the next command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 @kindex C-u
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 @findex universal-argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 Another way of specifying an argument is to use the @kbd{C-u}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (@code{universal-argument}) command followed by the digits of the argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 With @kbd{C-u}, you can type the argument digits without holding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 down shift keys. To type a negative argument, start with a minus sign.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 Just a minus sign normally means @minus{}1. @kbd{C-u} works on all terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 @kbd{C-u} followed by a character which is neither a digit nor a minus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 sign has the special meaning of ``multiply by four''. It multiplies the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 argument for the next command by four. @kbd{C-u} twice multiplies it by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 sixteen. Thus, @kbd{C-u C-u C-f} moves forward sixteen characters. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 is a good way to move forward ``fast'', since it moves about 1/5 of a line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 in the usual size frame. Other useful combinations are @kbd{C-u C-n},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 @kbd{C-u C-u C-n} (move down a good fraction of a frame), @kbd{C-u C-u
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 C-o} (make ``a lot'' of blank lines), and @kbd{C-u C-k} (kill four
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 lines).@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 Some commands care only about whether there is an argument and not about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 its value. For example, the command @kbd{M-q} (@code{fill-paragraph}) with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 no argument fills text; with an argument, it justifies the text as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (@xref{Filling}, for more information on @kbd{M-q}.) Just @kbd{C-u} is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 handy way of providing an argument for such commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 Some commands use the value of the argument as a repeat count, but do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 something peculiar when there is no argument. For example, the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 @kbd{C-k} (@code{kill-line}) with argument @var{n} kills @var{n} lines,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 including their terminating newlines. But @kbd{C-k} with no argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 special: it kills the text up to the next newline, or, if point is right at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 the end of the line, it kills the newline itself. Thus, two @kbd{C-k}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 commands with no arguments can kill a non-blank line, just like @kbd{C-k}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 with an argument of one. (@xref{Killing}, for more information on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 @kbd{C-k}.)@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 A few commands treat a plain @kbd{C-u} differently from an ordinary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 argument. A few others may treat an argument of just a minus sign
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 differently from an argument of @minus{}1. These unusual cases will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 described when they come up; they are always to make the individual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 command more convenient to use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 @c section Autoarg Mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 @cindex autoarg mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 Users of ASCII keyboards may prefer to use Autoarg mode. Autoarg mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 means that you don't need to type @kbd{C-u} to specify a numeric argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 Instead, you type just the digits. Digits followed by an ordinary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 inserting character are themselves inserted, but digits followed by an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 Escape or Control character serve as an argument to it and are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 inserted. A minus sign can also be part of an argument, but only at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 beginning. If you type a minus sign following some digits, both the digits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 and the minus sign are inserted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 To use Autoarg mode, set the variable Autoarg Mode nonzero.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 @xref{Variables}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 Autoargument digits echo at the bottom of the frame; the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 nondigit causes them to be inserted or uses them as an argument. To
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 insert some digits and nothing else, you must follow them with a Space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 and then rub it out. @kbd{C-g} cancels the digits, while Delete inserts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 them all and then rubs out the last.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 @end ignore