annotate man/new-users-guide/edit.texi @ 5295:2474dce7304e

Make sure (format "%b" 0) is non-zero length, print.c src/ChangeLog addition: 2010-10-25 Aidan Kehoe <kehoea@parhasard.net> * print.c (ulong_to_bit_string): If printing zero, actually print a zero, don't return the empty string. tests/ChangeLog addition: 2010-10-25 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test format strings with %b, too.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 25 Oct 2010 13:15:53 +0100
parents e43d0da85762
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 @node Edit, Customization Basics, Windows and Menus, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 @chapter Basic Editing Commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 @kindex C-h t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 @findex help-with-tutorial
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 This chapter will introduce you to some basic editing commands. You
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 can also learn the basic editing commands by typing @kbd{Control-h t}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 (@code{help-with-tutorial} OR by selecting @b{Emacs Tutorial} from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 @b{Help} menu on the menu bar. Most of the Emacs commands will use the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 @key{CONTROL} key or the @key{META} key. The following abbreviations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 will be used for the @key{CONTROL} and @key{META} key in this manual:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 @item C-<chr>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 This means that you should hold down the @key{CONTROL} key while typing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 @kbd{<chr>}. For example, if the command is @kbd{C-g}, you should hold
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the @key{CONTROL} key and type @key{g}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 @item M-<chr>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 This means that you should hold down the @kbd{META} key while typing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 @kbd{<chr>}. If there is no @kbd{META} key on your keyboard, use the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 @kbd{ESC} key instead. For example, if the command is @kbd{M-x}, then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 type @kbd{ESC}, release it and type @kbd{x}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 The following abbreviations will be used for some other keys:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 @table @key
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 @item SPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 Space bar.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 @item RET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 Return key.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 @item LFD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 Linefeed key.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 @item TAB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 Tab.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 @item ESC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 Escape.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 @item SFT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 Shift.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 @menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 * Insert:: Insert text in Emacs by simply typing at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 the cursor position.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 * Cursor Position:: Moving Around the cursor in the buffer,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 * Erase:: Different commands for erasing text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 * Numeric Argument:: Giving Numeric Arguments to commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 * Undo:: Undoing Changes made by mistake
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 @end menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 @node Insert, Cursor Position, Edit, Edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 @section Inserting Text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 @cindex insertion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 @cindex overstrike
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 To insert printing characters into the text you are editing, just
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 type them. Emacs will automatically insert the characters that you type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 into the buffer at the cursor. The cursor moves forward, but if you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 prefer to have text characters replace (overwrite) existing text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 characters, you can enable the @b{Overstrike} option from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 @b{Options} menu in the menu bar.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 @kindex DEL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 @cindex deletion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 To @dfn{delete} text you have just inserted, use @key{DEL}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 @key{DEL} deletes the character @var{before} the cursor (not the one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 that the cursor is on top of or under; that is the character @var{after}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 the cursor). The cursor and all characters after it move backwards.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 Therefore, if you type a printing character and then type @key{DEL},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 they cancel out.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3516
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
74 Unfortunately, computer and keyboard manufacturers differ over the
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
75 name of the @key{DEL} key. This is the key at the far right of the row
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
76 of keys containing the digits, usually immediately above the @kbd{RET}
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
77 key. It is usually labelled ``Backspace'' or ``Delete'' or some
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
78 abbreviation. Modern keyboards will often have another key labelled
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
79 ``Del'' in the @emph{edit keypad} (along with an ``Ins'' key and perhaps
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
80 some others). This is not the @kbd{DEL} key referred to here. It
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
81 usually deletes @emph{forward} in Emacs.
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
82
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 @kindex RET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 @cindex newline
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 @findex auto-fill-mode
3516
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
86 To end a line and start typing a new one, type @key{RET}. On some
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
87 keyboards, this key is labelled ``Enter''. This
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 inserts a newline character in the buffer. If point is in the middle of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 a line, @key{RET} splits the line. Typing @key{DEL} when the cursor is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 at the beginning of a line rubs out the newline before the line, thus
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 joining the line with the preceding line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 Emacs automatically splits lines when they become too long, if you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 turn on a special mode called @dfn{Auto Fill} mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 @xref{Filling,,,xemacs,XEmacs User's Manual}, for information on using Auto Fill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 @node Cursor Position, Erase, Insert, Edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 @section Moving Around
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 @cindex cursor control
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 @cindex cursor position
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 The following commands will allow you to move the cursor around the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 screen. The actual function names corresponding to these commands are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 given in parenthesis. You can also invoke these commands by typing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 @kbd{M-x <function name>}. You can do this for any command in XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 @kindex C-a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 @kindex C-e
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 @kindex C-fx
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 @kindex C-b
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 @kindex C-n
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 @kindex C-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 @kindex C-v
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 @kindex M-v
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 @kindex C-t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 @kindex M->
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 @kindex M-<
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 @findex beginning-of-line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 @findex end-of-line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 @findex forward-char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 @findex backward-char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 @findex next-line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 @findex previous-line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 @findex transpose-chars
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 @findex beginning-of-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 @findex end-of-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 @findex goto-char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 @findex goto-line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 @item C-b
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 Move the cursor backward one character (@code{backward-char}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 @item C-f
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 Move the cursor forward one character (@code{forward-char}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 @item C-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 Move the cursor up one line vertically (@code{previous-line}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 @item C-n
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 Move the cursor down one line vertically (@code{next-line}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 @item C-a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 Move the cursor to the beginning of the line (@code{beginning-of-line}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 @item C-e
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 Move the cursor to the end of the line (@code{end-of-line}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 @item M-f
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 @findex forward-word
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 Move the cursor forward one word (@code{forward-word}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 @item M-b
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 @findex backward-word
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
150 Move the cursor backward one word (@code{backward-word}).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 @item M-<
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 Move the cursor to the top of the buffer (@code{beginning-of-buffer}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 @item M->
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 Move the cursor to the end of the buffer (@code{end-of-buffer}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 @item M-x goto-char RET <number> RET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 To enable this command type @kbd{M-x goto-char}, and hit @key{RETURN}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 key. In the @dfn{echo area} you will see:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 @example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 Goto char:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 You should then type in a number right after the colon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 and hit the @kbd{RETURN} key again. After reading a number @var{n} this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 command will move the cursor to character number @var{n}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 Position 1 is the beginning of the buffer. For example, if you type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 @kbd{M-x goto-char RET 200 RET}, then the cursor will move to the 200th
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 character starting from the beginning of the buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 @item M-x goto-line RET <number> RET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 @cindex goto-line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 To enable this command type @kbd{M-x goto-line}, and hit the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 @key{RETURN} key. After you see @kbd{Goto line:} in the @dfn{echo area},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 type in a number @var{n} and hit @key{RETURN} key again. This command will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 position the cursor on the nth line starting from the beginning of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 @item M-x what-line RET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 This command will display the current line number in the echo area.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 @node Erase, Numeric Argument, Cursor Position, Edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 @section Erasing Text
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 @cindex erasing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 @cindex deleting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 @kindex C-d
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 @kindex C-k
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 @kindex M-d
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 @kindex M-DEL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 @kindex M-k
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 @kindex M-z
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 @findex delete-backward-char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 @findex delete-char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 @findex kill-line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 @findex kill-word
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 @findex backward-kill-word
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 @findex kill-sentence
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 @findex zap-to-char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 @item @key{DEL}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 If you press @key{DEL} i.e. the @dfn{delete} key, it will delete the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 character before the cursor (@code{delete-backward-char}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 @item C-d
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 This will delete the character after the cursor (@code{delete-char}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 @item C-k
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 Kill to the end of the line (@code{kill-line}). If you kill the line by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 mistake you can @dfn{yank} or @samp{paste} it back by typing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 @kbd{C-y}. @xref{Moving Text}, for more information on yanking.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 @item M-d
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 Kill forward to the end of the next word (@code{kill-word}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 @item M-@key{DEL}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 Kill back to the beginning of the previous word
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 (@code{backward-kill-word}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 @item M-k
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 Kill to the end of current sentence (@code{kill-sentence}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 @item M-z @var{char}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 Kill up to next occurrence of @var{char} (@code{zap-to-char}). To use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 this command type @kbd{M-z}. You will see the following statement in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 echo area :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 @example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 Zap to char:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 Type any char and press the @key{RET} key. For example, if you type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 @samp{p} then the entire text starting from the position of the cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 until the first occurrence of @samp{p} is killed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 @node Numeric Argument, Undo, Erase, Edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 @section Giving Numeric Arguments
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 @cindex numeric argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 @cindex digit argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 @cindex negative argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 @kindex C-u
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 @kindex M-@t{-}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 Any Emacs command can be given a @dfn{numeric argument}. Some commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 interpret the argument as a repetition count. For example, if you want
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 to move forward ten characters, you could type @kbd{C-f} ten
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 times. However, a more efficient way to do this would be to give an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 argument of ten to the key @kbd{C-f} (the command @code{forward-char}, move
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 forward one character). Negative arguments are also allowed. Often they tell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 a command to move or act backwards. For example, if you want to move
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 down ten lines, type the following:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 @example
3516
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
254 C-u 10 C-n
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 @noindent
3516
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
257 After you press the @kbd{C-n} key, the cursor will move ten lines
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 downward. You can also type:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 @example
3516
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
260 M-10 C-n
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 Both @kbd{C-u} and @kbd{M-} allow you to give numeric arguments. If you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 want to move ten lines backward, you can also give negative arguments, like:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 @example
3516
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
266 C-u -10 C-n
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 OR you could also type:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 @example
3516
e43d0da85762 [xemacs-hg @ 2006-07-19 15:04:46 by stephent]
stephent
parents: 442
diff changeset
271 M--10 C-n
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 You can obviously use @kbd{C-b} to move backward rather than giving
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 negative arguments to @kbd{C-n}. @xref{Numeric Arguments,,,xemacs,XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 User's Manual}, for more information on numeric arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 @comment node-name, next, previous, up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 @node Undo, , Numeric Argument, Edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 @section Undoing Changes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 @cindex undo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 @cindex mistakes, correcting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 When you are editing a buffer, you might type something by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 mistake. Emacs allows you to undo all changes you make to a buffer (but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 not more than 8000 characters). Each buffer in Emacs keeps a record of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 the changes made to it individually, so the undo command applies to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 current buffer. There are two undo commands:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 @table @kbd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 @kindex C-x u
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 @item C-x u
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 Undo one batch of changes (usually, one command's worth).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 (@code{undo}).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 @item C-_
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 The same as above, but this command might not be obvious to type on some
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 keyboards so it might be better to use the above command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 @xref{Undoing Changes,,,xemacs,XEmacs User's Manual}, for more information on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 undoing changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311