comparison etc/TUTORIAL @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents abac34c62a39
children 137460151b27
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
1 Copyright (c) 1985, 1996 Free Software Foundation, Inc. See end for conditions. 1 You are looking at the XEmacs tutorial. See end for copyrights and conditions.
2 2
3 You are looking at the Emacs tutorial. 3 XEmacs commands generally involve the CONTROL key (sometimes labeled
4 4 CTRL or CTL) or the META key. "META" is a traditional Emacs term; on
5 Emacs commands generally involve the CONTROL key (sometimes labelled 5 most keyboards, the key is labelled "Alt". (On Sun keyboards, the META
6 CTRL or CTL) or the META key. On some keyboards, the META key is 6 key is labelled with a diamond, and is *NOT* the Alt key, which also
7 labelled ALT or EDIT or something else (for example, on Sun keyboards, 7 exists.) On some TTY's, there is no META key; in this case, use ESC.
8 the diamond key to the left of the spacebar is META). If you have no 8 Rather than write out META or CONTROL each time we want you to prefix a
9 META key, you can use ESC instead. Rather than write out META or 9 character, we'll use the following abbreviations:
10 CONTROL each time we want you to prefix a character, we'll use the
11 following abbreviations:
12 10
13 C-<chr> means hold the CONTROL key while typing the character <chr> 11 C-<chr> means hold the CONTROL key while typing the character <chr>
14 Thus, C-f would be: hold the CONTROL key and type f. 12 Thus, C-f would be: hold the CONTROL key and type f.
15 M-<chr> means hold the META key down while typing <chr>. If there 13 M-<chr> means hold the META (i.e. Alt) key down while typing <chr>.
16 is no META key, type <ESC>, release it, then type the 14 (See above for Sun keyboards and TTY's.)
17 character <chr>. 15
18 16 Important note: to end the XEmacs session, type C-x C-c. (Two characters.)
19 Important note: to end the Emacs session, type C-x C-c. (Two characters.) 17
18 To move to the next screen, type <Next> (often labeled PgDn). On TTY's,
19 you may not have such a key; use C-v instead. (Hold down the CONTROL key
20 while typing v.)
21
22 To move to the previous screen, type <Prior> (often labeled PgUp). On
23 TTY's, use M-v. (Remember, this means META + v; if you have no META or Alt
24 key that works, press and release ESC, then type v.)
25
20 The characters ">>" at the left margin indicate directions for you to 26 The characters ">>" at the left margin indicate directions for you to
21 try using a command. For instance: 27 try using a command. For instance:
22 <<Middle of page left blank for didactic purposes. Text continues below.>> 28
23 >> Now type C-v (View next screen) to move to the next screen. 29 >> Try typing <Next> and then <Prior>, a few times. (Or C-v and M-v,
24 (go ahead, do it by holding down the control key while typing v). 30 on TTY's.)
25 From now on, you should do this again whenever you finish 31
26 reading the screen. 32 Note that there is an overlap of two lines when you move from screen to
27 33 screen; this provides some continuity so you can continue reading the text.
28 Note that there is an overlap of two lines when you move from screen 34
29 to screen; this provides some continuity so you can continue reading 35 In general, every "cursor key" (the arrows and similar keys set off to the
30 the text. 36 right side of the keyboard) has an equivalent binding that uses only the
31 37 alphanumeric keys in combination with CONTROL and/or META, so that TTY
32 The first thing that you need to know is how to move around from place 38 users can use XEmacs.
33 to place in the text. You already know how to move forward one screen, 39
34 with C-v. To move backwards one screen, type M-v (hold down the META key 40 (In fact, in olden days, this "older way" was the only way to do things,
35 and type v, or type <ESC>v if you do not have a META, EDIT, or ALT key). 41 and you will still often see references to these keys as the "recommended"
36 42 way of doing things. We don't actually recommend that you use these older
37 >> Try typing M-v and then C-v, a few times. 43 bindings in preference to the more obvious cursor keys, since the cursor
44 keys are easier to remember and usually more convenient to use. However,
45 it's useful to know the older bindings, either in case you ever use a TTY
46 or so that you can make sense of references to them. From now on, we will
47 mention the TTY bindings in parentheses, and expect that TTY users will
48 subsitute them whenever we mention a cursor key.)
49
50 Now you may ask, what is a TTY? A TTY (or "TeleTYpe")is a text-only
51 connection, the kind you get when you use the "telnet" program to log into
52 a remote site. Up till 20 years ago or so, such text-only connections were
53 all that existed to communicate with a computer, usually via a "terminal"
54 (a combination keyboard and monochrome screen) connected directly to a
55 computer. Nowadays, such dedicated TTY's are increasingly rare, and most
56 people only run into them when using telnet. Emacs began in those olden
57 days, and it still carries some baggage from that time, but things have
58 greatly improved since then. Now, you are probably using XEmacs under MS
59 Windows or X Windows, collectively termed a "window system".
38 60
39 61
40 * SUMMARY 62 * SUMMARY
41 --------- 63 ---------
42 64
43 The following commands are useful for viewing screenfuls: 65 The following commands are useful for viewing screenfuls:
44 66
45 C-v Move forward one screenful 67 <Next> Move forward one screenful (C-v on TTY's)
46 M-v Move backward one screenful 68 <Prior> Move backward one screenful (M-v on TTY's)
47 C-l Clear screen and redisplay everything 69 C-l Clear frame and redisplay all the text,
48 putting the text near the cursor at the center. 70 moving the text around the cursor
49 (That's control-L, not control-1.) 71 to the center of the window.
72 (That's CONTROL-L, not CONTROL-1.)
50 73
51 >> Find the cursor, and note what text is near it. 74 >> Find the cursor, and note what text is near it.
52 Then type C-l. 75 Then type C-l.
53 Find the cursor again and notice that the same text 76 Find the cursor again and notice that the same text
54 is near the cursor now. 77 is near the cursor now.
55 78
56 79
80 * SOME TERMINOLOGY
81 ------------------
82
83 All aspects of computers have terminology associated with them, and until
84 you master the terminology, things can seem overwhelming. To add to this,
85 however, XEmacs has its own terminology, some of which of course includes
86 terms for concepts new to XEmacs. Some XEmacs terminology, however, is
87 just nonstandard terms for familiar objects and concepts. (This is because
88 Emacs began a long time ago, when many standard things in today's computers
89 didn't exist, and others that did exist had different names.)
90
91 To make things easier for you, the most common XEmacs terms that you will
92 find in this tutorial are defined here, even though some have already been
93 defined above and others aren't discussed in detail until later. This way,
94 if you come across an unfamiliar term, you know exactly where to look to
95 find the definition. Don't worry if you don't understand all the terms; if
96 you keep reading the tutorial, eventually all the terms will be explained
97 in detail.
98
99 Term Definition
100 --------------------------
101 C- A keystroke involving the CONTROL key. C-k is sometimes
102 indicated as CONTROL + k or (not in XEmacs) ^K, and means
103 to hold down the CONTROL key and hit the k key.
104 Info The name of XEmacs' online documentation, accessed through
105 C-h i.
106 M- A keystroke involving the META key. See META.
107 META An abstract name for a particular modifier key, which has
108 different correspondences depending on your keyboard. On
109 most keyboards, META is the Alt key, but on Sun keyboards it's
110 a key labelled with a diamond, and *NOT* the Alt key, which
111 also exists. META can also be simulated by pressing ESC before
112 the other key, but in reality this is just two separate keys,
113 not a modifier plus a key: If you want to do M-f M-f, normally
114 you can hold down (e.g.) Alt, hit f twice, and release the Alt,
115 but when using ESC as META, you'd have to type ESC f ESC f.
116 TTY A text-only connection to a computer, such as when you
117 telnet into a machine. See the previous section for more
118 explanation.
119 binding The command that's bound to a particular key sequence; you
120 can find out what the binding is and how the command works
121 using C-h k; it's also possible to change the bindings of
122 key sequences, but this isn't discussed in the tutorial
123 buffer A block of memory holding some text, such as the text of a
124 file, email message, list of files in a directory, etc. All
125 visible windows are always displaying the text of some buffer,
126 and more than one window can be displaying the same buffer.
127 In this case, each buffer has a different value for point
128 (see definition).
129 cursor A block or bar showing where in the text the current insertion
130 point is.
131 cursor key Any of the keys used for moving the cursor, such as the arrow
132 keys, <Next> and <Prior> (often labelled PgUp and PgDn),
133 <Home> and <End>, etc. Usually set off to the right of the
134 main part of the keyboard, often painted gray.
135 echo area A one-line area at the bottom of the frame where messages are
136 output. It shares the same space as the minibuffer, which
137 works because the minibuffer is not active most of the time
138 and is active only for short intervals. (Even then, if a
139 message needs to be displayed, the minibuffer will temporarily
140 disappear, the message will be displayed, and then the
141 minibuffer will appear again in a few seconds.)
142 frame Same as what's standardly called a "window" in a window system.
143 TTY's only have one visible frame, but it's possible to create
144 others and switch between them (sort of like if, in a window
145 system, all your windows were maximized to take up the whole
146 screen, so you could only see one at once).
147 isearch Incremental search. An Emacs invention that is a special,
148 extra-efficient way of searching. Each time you type a
149 character in a search string, XEmacs immediately finds the
150 next match for what you've typed so far. This way, you avoid
151 typing more keys than necessary to find what you're looking
152 for.
153 key sequence A sequence of one or more keystrokes that together make a
154 command. C-x C-f, C-x 5 0, C-l, and <Next> are all key
155 sequences. See also "binding".
156 keystroke A combination of a key and a modifier (e.g. CONTROL, SHIFT,
157 META).
158 kill Standardly known as "cut". Remove text and remember it, so
159 that it can be "yanked" (standardly, "pasted") later. Multiple
160 "kills" are remembered, not only the most recent, and can be
161 accessed using M-y. "kill" is also sometimes used in general
162 to refer to deleting anything other than text, e.g. buffers,
163 toolbar items, local variables, subprocesses, abbrevations,
164 or to terminating the XEmacs process.
165 minibuffer A small buffer (usually one line, but it may expand as
166 necessary) at the bottom of the frame, used when commands need
167 input such as file names.
168 modeline A status line, near the bottom of a window, showing the
169 current file being edited, the current mode, the line number,
170 etc. (If you split a frame into two windows, you get two
171 modelines.)
172 point The location in the text where the cursor is. (Technically,
173 the cursor is *BETWEEN* two text characters, not on one.
174 This is most obvious when you use the bar cursor.)
175 prefix argument An extra piece of information typed just before a command to
176 be executed, which changes how the command works. Prefix
177 arguments typically come in two types: Numeric arguments,
178 which specify repeat counts, screen lines to move to, etc.
179 are are specified using META plus a number before a command;
180 and flag arguments, which are just simple yes/no-type
181 indications to do something differently (e.g. put point at
182 the beginning of inserted text rather than at the end) and
183 are specified using C-u before the command.
184 recursive edit Used when you are in the middle of executing a long command
185 (e.g. a search and replace), and want to temporarily make
186 an edit to some text. Indicated with brackets around the
187 mode name. It's unlikely you'll use this much, if at all,
188 but it's useful to know how to get out if you accidentally
189 get into this mode: use ESC ESC.
190 screen The totality of everything that can be seen on the display.
191 Also used in some expressions: "on/off the screen" means
192 currently visible or invisible. A "screenful" is the amount
193 of text in a particular window that can be viewed at one time.
194 window Non-overlapping division of a frame, standardly called a
195 "pane". Most often, there is only one window in a frame, and
196 then the two terms become essentially synonymous. (Technically,
197 however, the window includes the modeline below it but not
198 the minibuffer.)
199 yank Standardly known as "paste". Insert text that was previously
200 removed and remembered, a process known as "killing", or more
201 standardly "cutting".
202
203
57 * BASIC CURSOR CONTROL 204 * BASIC CURSOR CONTROL
58 ---------------------- 205 ----------------------
59 206
60 Moving from screenful to screenful is useful, but how do you 207 The first thing that you need to know is how to move around from place
61 move to a specific place within the text on the screen? 208 to place in the text. You already know how to move forward and backward
209 one screen, but how do you move to a specific place within the text on
210 the screen?
62 211
63 There are several ways you can do this. The most basic way is to use 212 There are several ways you can do this. The most basic way is to use
64 the commands C-p, C-b, C-f, and C-n. Each of these commands moves the 213 the arrow keys, which we refer to as <Left>, <Right>, <Up>, and <Down>.
65 cursor one row or column in a particular direction on the screen. 214 Each of these commands moves the cursor one row or column in a
66 Here is a table showing these four commands and shows the directions 215 particular direction on the screen.
67 they move: 216
217 On a TTY, the arrow keys should, hopefully, work the same, but they
218 might not, since TTY's are easy to misconfigure. As mentioned above,
219 for all cursor-key bindings, there are equivalent alphanumeric ones. In
220 this case, the bindings are unfortunately not at all obvious, since they
221 were chosen mnemonically and not visually. Here is a table showing the
222 TTY bindings:
68 223
69 Previous line, C-p 224 Previous line, C-p
70 : 225 :
71 : 226 :
72 Backward, C-b .... Current cursor position .... Forward, C-f 227 Backward, C-b .... Current cursor position .... Forward, C-f
73 : 228 :
74 : 229 :
75 Next line, C-n 230 Next line, C-n
76 231
77 >> Move the cursor to the line in the middle of that diagram 232 >> Move the cursor to the line in the middle of that diagram using <Down>
78 using C-n or C-p. Then type C-l to see the whole diagram 233 or <Up>. Then type C-l to see the whole diagram centered in the window.
79 centered in the screen. 234 (Remember, TTY users should substitute the appropriate bindings whenever
80 235 necessary. In this case, use C-n and C-p.)
81 You'll probably find it easy to think of these by letter: P for 236
82 previous, N for next, B for backward and F for forward. These are the 237 Note the mnemonic significance of the TTY bindings: P for previous, N
83 basic cursor positioning commands, and you'll be using them ALL the 238 for next, B for backward and F for forward. If you're on a TTY, you
84 time, so it would be of great benefit if you learn them now. 239 really should spend some time now etching these cursor bindings into
85 240 your brain. These cursor positioning commands are the most fundamental
86 >> Do a few C-n's to bring the cursor down to this line. 241 way to move around and you'll be using them ALL the time, so you will be
87 242 completely lost without them.
88 >> Move into the line with C-f's and then up with C-p's. 243
89 See what C-p does when the cursor is in the middle of the line. 244 Even if you are on a window system and are not forced to learn these
90 245 bindings, you should try to memorize at least these four commands and in
91 Each of text line ends with a Newline character, which serves to 246 particular their associated words, since variations on them show up in
92 separate it from the following line. The last line in your file ought 247 many different keyboard commands, and knowing what they stand for can be
93 to have a Newline at the end (but Emacs does not require it to have 248 of tremendous help.
94 one). 249
95 250
96 >> Try to C-b at the beginning of a line. It should move to 251 >> Do a few <Down>'s to bring the cursor down to this line.
252
253 >> Move into the line with <Right>'s and then up with <Up>'s.
254 See what <Up> does when the cursor is in the middle of the line.
255
256 The location of the cursor in the text is also called "point". You will
257 often see such references to "point" in the documentation, so remember
258 this term.
259
260 Each line of text ends with a Newline character, which serves to separate
261 it from the following line. The last line in your file ought to have a
262 Newline at the end. XEmacs does not normally require it to have one, but
263 you can change this -- see the menu entry "Options->Editing->Newline at End
264 of File...". (More on menu entries later.)
265
266 >> Try to <Left> at the beginning of a line. It should move to
97 the end of the previous line. This is because it moves back 267 the end of the previous line. This is because it moves back
98 across the Newline character. 268 across the Newline character.
99 269
100 C-f can move across a Newline just like C-b. 270 <Right> can move across a Newline just like <Left>.
101 271
102 >> Do a few more C-b's, so you get a feel for where the cursor is. 272 >> Do a few more <Left>'s, so you get a feel for where the cursor is.
103 Then do C-f's to return to the end of the line. 273 Then do <Right>'s to return to the end of the line.
104 Then do one more C-f to move to the following line. 274 Then do one more <Right> to move to the following line.
105 275
106 When you move past the top or bottom of the screen, the text beyond 276 When you move past the top or bottom of the window, the text beyond
107 the edge shifts onto the screen. This is called "scrolling". It 277 the edge shifts onto the screen. This is called "scrolling". It
108 enables Emacs to move the cursor to the specified place in the text 278 enables XEmacs to move the cursor to the specified place in the text
109 without moving it off the screen. 279 without moving it off the screen.
110 280
111 >> Try to move the cursor off the bottom of the screen with C-n, and 281 >> Try to move the cursor off the bottom of the window with <Down>, and
112 see what happens. 282 see what happens.
113 283
114 If moving by characters is too slow, you can move by words. M-f 284 If moving by characters is too slow, you can move by words. C-<Right>
115 (Meta-f) moves forward a word and M-b moves back a word. 285 (CONTROL + right-arrow key) moves forward a word and C-<Left> moves back a
116 286 word. On TTY's, use M-f instead of C-<Right> and M-p instead of C-<Left>.
117 >> Type a few M-f's and M-b's. 287
118 288 >> Type a few C-<Right>'s and C-<Left>'s.
119 When you are in the middle of a word, M-f moves to the end of the word. 289
120 When you are in whitespace between words, M-f moves to the end of the 290 When you are in the middle of a word, C-<Right> moves to the end of the
121 following word. M-b works likewise in the opposite direction. 291 word. When you are in whitespace between words, C-<Right> moves to the
122 292 end of the following word. C-<Left> works likewise in the opposite
123 >> Type M-f and M-b a few times, interspersed with C-f's and C-b's 293 direction.
124 so that you can observe the action of M-f and M-b from various 294
125 places inside and between words. 295 >> Type C-<Right> and C-<Left> a few times, interspersed with <Right>'s and
126 296 <Left>'s so that you can observe the action of C-<Right> and C-<Left>
127 Notice the parallel between C-f and C-b on the one hand, and M-f and 297 from various places inside and between words.
128 M-b on the other hand. Very often Meta characters are used for 298
129 operations related to the units defined by language (words, sentences, 299 Notice the parallel between <Right> and <Left> on the one hand, and
130 paragraphs), while Control characters operate on basic units that are 300 C-<Right> and C-<Left> on the other hand. Also notice the parallel
131 independent of what you are editing (characters, lines, etc). 301 between C-f and C-p on the one hand, and M-f and M-p on the other hand.
132 302 XEmacs tries fairly hard to maintain parallelism in keyboard commands to
133 This parallel applies between lines and sentences: C-a and C-e move to 303 make them easier to remember, and generally adding CONTROL or META to an
134 the beginning or end of a line, and M-a and M-e move to the beginning 304 operation makes it "more so". META goes beyond CONTROL, often making
135 or end of a sentence. 305 the units of movement less basic in the process -- words vs. characters,
136 306 balanced parenthetical expressions vs. words, or sentences vs. lines.
137 >> Try a couple of C-a's, and then a couple of C-e's. 307
138 Try a couple of M-a's, and then a couple of M-e's. 308 Other important cursor motion commands are <Home> and <End> (beginning
139 309 and end of the line), and C-<Home> and C-<End> (beginning and end of the
140 See how repeated C-a's do nothing, but repeated M-a's keep moving one 310 whole text). Note again the parallelism just mentioned.
141 more sentence. Although these are not quite analogous, each one seems 311
142 natural. 312 On TTY's, use C-a and C-e for beginning and end of line, and M-< and M->
143 313 for beginning and end of text. (If it helps, think of A as the first
144 The location of the cursor in the text is also called "point". To 314 letter of the alphabet, and E as standing for "end".) Note that the <
145 paraphrase, the cursor shows on the screen where point is located in 315 and > chars (Less-than and Greater-than) are above the comma and period
146 the text. 316 on most keyboards, so you'll have to use the SHIFT key in conjunction
147 317 with META. If you have no META, the order is very important: Type ESC
148 Here is a summary of simple cursor-moving operations, including the 318 first, then type < or >.
149 word and sentence moving commands: 319
150 320 >> Move the cursor to this line, then try <Home> and <End> a few times.
151 C-f Move forward a character 321
152 C-b Move backward a character 322 >> (Read this entire entry before doing anything!) Try C-<Home> now, to
153 323 move to the beginning of the tutorial. Then use <Next> repeatedly to
154 M-f Move forward a word 324 move back here.
155 M-b Move backward a word
156
157 C-n Move to next line
158 C-p Move to previous line
159
160 C-a Move to beginning of line
161 C-e Move to end of line
162
163 M-a Move back to beginning of sentence
164 M-e Move forward to end of sentence
165 325
166 >> Try all of these commands now a few times for practice. 326 >> Try all of these commands now a few times for practice.
167 These are the most often used commands. 327 These are the most often used commands.
168 328
169 Two other important cursor motion commands are M-< (Meta Less-than), 329 Here is a summary of simple cursor-moving operations. Don't worry if you
170 which moves to the beginning of the whole text, and M-> (Meta 330 can't remember everything; you can always move back to this table for
171 Greater-than), which moves to the end of the whole text. 331 reference.
172 332
173 On most terminals, the "<" is above the comma, so you must use the 333 KEYSTROKE: SEQUENCE TTY:
174 shift key to type it. On these terminals you must use the shift key 334
175 to type M-< also; without the shift key, you would be typing M-comma. 335 <Prior> (PgUp) Move backward a screen M-v
176 336 <Next> (PgDn) Move forward a screen C-v
177 >> Try M-< now, to move to the beginning of the tutorial. 337
178 Then use C-v repeatedly to move back here. 338 <Left> Move backward a character C-b
179 339 <Right> Move forward a character C-f
180 >> Try M-> now, to move to the end of the tutorial. 340
181 Then use M-v repeatedly to move back here. 341 C-<Left> Move backward a word M-b
182 342 C-<Right> Move forward a word M-f
183 You can also move the cursor with the arrow keys, if your terminal has 343
184 arrow keys. We recommend learning C-b, C-f, C-n and C-p for three 344 <Up> Move to previous line C-p
185 reasons. First, they work on all kinds of terminals. Second, once 345 <Down> Move to next line C-n
186 you gain practice at using Emacs, you will find that typing these CTRL 346
187 characters is faster than typing the arrow keys (because you do not 347 C-<Up> Move 6 lines up
188 have to move your hands away from touch-typing position). Third, once 348 C-<Down> Move 6 lines down
189 you form the habit of using these CTRL character commands, you can 349
190 easily learn to use other advanced cursor motion commands as well. 350 <Home> Move to beginning of line C-a
191 351 <End> Move to end of line C-e
192 Most Emacs commands accept a numeric argument; for most commands, this 352
193 serves as a repeat-count. The way you give a command a repeat count 353 C-<Home> Move to beginning of text M-<
194 is by typing C-u and then the digits before you type the command. If 354 C-<End> Move to end of text M->
195 you have a META (or EDIT or ALT) key, there is another alternative way 355
196 to enter a numeric argument: type the digits while holding down the 356
197 META key. We recommend learning the C-u method because it works on 357 * PREFIX ARGUMENTS
198 any terminal. 358 ------------------
199 359
200 For instance, C-u 8 C-f moves forward eight characters. 360 Most XEmacs commands accept a numeric argument; for most commands, this
361 serves as a repeat-count. The way you give a command a repeat count is
362 by holding down the META key while typing the digits. You really only
363 need to hold down META for the first digit; for this reason, an
364 alternative method is to simply hit the ESC key once, then type the
365 digits. (This latter method works on TTY's as well.) The numeric
366 argument is also called a "prefix argument", because you type the
367 argument before the command it applies to.
368
369 For instance, M-8 <Right> moves forward eight characters.
201 370
202 >> Try using C-n or C-p with a numeric argument, to move the cursor 371 >> Try using <Down> or <Up> with a numeric argument, to move the cursor
203 to a line near this one with just one command. 372 to a line near this one with just one command.
204 373
205 Most commands use the numeric argument as a repeat count. Certain 374 Sometimes, commands use the term "prefix argument" to refer not to a
206 exceptional commands use it differently. C-v and M-v are among the 375 numeric argument, but to just a flag that makes the command do something
207 exceptions. When given an argument, they scroll the screen up or down 376 different if given. (We haven't encountered any such commands so far.)
208 by that many lines, rather than by a screenfuls. For example, C-u 4 377 For such commands, the flag is normally given by typing C-u before the
209 C-v scrolls the screen by 4 lines. 378 command, but generally you can also specify any numeric argument -- the
210 379 actual number makes no difference.
211 >> Try typing C-u 8 C-v now. 380
212 381
213 This should have scrolled the screen up by 8 lines. If you would like 382 * SCROLLBARS
214 to scroll it down again, you can give an argument to M-v. 383 ------------
215 384
216 If you are using the X Window system, there is probably a rectangular 385 Unless you are on a TTY, there is probably a rectangular area called a
217 area called a scroll bar at the right hand side of the Emacs window. 386 scroll bar at the right hand side of the XEmacs window. You can scroll the
218 You can scroll the text by manipulating the scroll bar with the mouse. 387 text by manipulating the scrollbar with the mouse.
219 388
220 >> Try pressing the middle button at the top of the highlighted area 389 The scrollbar has a button in the middle of it, called a thumb. The
221 within the scroll bar. This should scroll the text to a position 390 relative position of this thumb within the rectangle indicates where you
222 determined by how high or low you click. 391 are within the file. As you scroll up or down with the cursor keys, the
223 392 thumb will follow.
224 >> Move the mouse to a point in the scroll bar about three lines from 393
225 the top, and click the left button a couple of times. 394 >> Try holding down the left button on the thumb and moving the mouse up
226 395 and down. You'll see that the text scrolls up and down as you move the
227 396 mouse. (NOTE: Some scrollbars, such as the Athena scrollbars under X
228 * CURSOR CONTROL WITH AN X TERMINAL 397 Windows, work differently. On these, you will have to use the middle
229 ----------------------------------- 398 button, not the left one.)
230 399
231 If you have an X terminal, you will probably find it easier to use 400 >> Try clicking the left button in the area above the thumb. This should
232 the keys on the keypad to control the cursor. The left, right, up, 401 scroll the text up by a screenful. Similarly, clicking the button below
233 and down arrow keys move in the expected direction; they function 402 the thumb will scroll down by a screenful. (NOTE: Under Athena, things
234 exactly like C-b, C-f, C-p, and C-n, but are easier to type and to 403 work differently.) Holding the button down will cause the text to
235 remember. You can also use C-left and C-right to move by words, and 404 repeatedly scroll by a screenful.
236 C-up and C-down to move by blocks (e.g. paragraphs, if you're 405
237 editing text). If you have keys labelled HOME (or BEGIN) and END, 406 >> Most scrollbars have arrows at the top and bottom of the rectangle.
238 they will take you to the beginning and end of a line, respectively, 407 Clicking on these will scroll the text up or down by a line, and holding
239 and C-home and C-end will move to the beginning and end of the file. 408 the button down will cause the text to repeatedly scroll by a line.
240 If your keyboard has PgUp and PgDn keys, you can use them to move up 409
241 and down a screenful at a time, like M-v and C-v. 410
242 411 * USING THE MENU
243 All of these commands can take numeric arguments, as described above. 412 ----------------
244 You can use a shortcut to enter these arguments: just hold down the 413
245 CONTROL or META key and type the number. For example, to move 12 414 Unless you are on a TTY, you will notice a menubar at the top of the
246 words to the right, type C-1 C-2 C-right. Note that it is very easy 415 XEmacs frame. You can use this menubar to access all the most common
247 to type this because you do not have to release the CONTROL key 416 XEmacs commands, such as "open a file". You will find this easier at
248 between keystrokes. 417 first, because you don't need to remember the keystrokes necessary to
249 418 access any particular command. Once you are comfortable with XEmacs, it
250 419 will be easy to begin using the keyboard commands because each menu item
251 * WHEN EMACS IS HUNG 420 with a corresponding keyboard command has the command listed next to it.
252 -------------------- 421
253 422 Note that there are many items in the menubar that have no exact
254 If Emacs stops responding to your commands, you can stop it safely by 423 keyboard equivalents. For example, the Buffers menu lists all of the
424 available buffers in most-recently used order. You can switch to any
425 buffer by simply findings its name in the Buffers menu and selecting it.
426
427 You can also configure XEmacs so that you can use the META key to access
428 menu items -- the "accelerator" functionality that is standard under MS
429 Windows. One easy way to do this in XEmacs is using the menu item
430 "Options->Menubars->Alt/Meta Selects Menu Items".
431
432 When this feature is on, you can select a menu or menu item using the
433 combination of META (i.e. Alt) plus the underlined letter of the menu item.
434 For example, to exit XEmacs, use M-f M-x. We currently don't turn this on
435 by default because it interferes with the traditional usage of META in
436 XEmacs. However, we may do this in the future: Only commands for which
437 there are top-level menus are shadowed by accelerator bindings, and for all
438 those commands, there are equivalents either using cursor keys or on the
439 menus.
440
441 When we mention a menu selection, it will be specified as just shown --
442 i.e. a string, with an arrow ("->") separating different submenus or items.
443 In this case, the menu entry just mentioned means "Click the Options menu
444 on the menubar, then the Menubars submenu, the the entry off of that
445 labeled "Alt/Meta Selects Menu Items". In general, XEmacs is highly
446 customizable, and one of the easiest ways to make such customizations is
447 through the Options menu.
448
449 IMPORTANT: If you want a change on the Options menu to last beyond the
450 current XEmacs session, use "Options->Save Options to Init File". This
451 way, it will be permanent. Otherwise, all Options changes made in the
452 current session will be lost.
453
454
455 * WHEN XEMACS IS HUNG OR IN SOME STRANGE MODE
456 ---------------------------------------------
457
458 If XEmacs stops responding to your commands, you can stop it safely by
255 typing C-g. You can use C-g to stop a command which is taking too 459 typing C-g. You can use C-g to stop a command which is taking too
256 long to execute. 460 long to execute.
257 461
258 You can also use C-g to discard a numeric argument or the beginning of 462 You can also use C-g to discard a numeric argument or the beginning of
259 a command that you do not want to finish. 463 a command that you do not want to finish.
260 464
261 >> Type C-u 100 to make a numeric arg of 100, then type C-g. 465 >> Type M-100 to make a numeric arg of 100 (remember, this means hold
262 Now type C-f. It should move just one character, 466 down META and type 100, or type ESC 1 0 0), then type C-g. Now type
263 because you canceled the argument with C-g. 467 <Right>. It should move just one character, because you canceled the
264 468 argument with C-g.
265 If you have typed an <ESC> by mistake, you can get rid of it 469
266 with a C-g. 470 If XEmacs is in some strange mode and C-g isn't getting out of it, you
471 can use the all-purpose escape mechanism: ESC ESC. (On TTY's, you have
472 to use ESC ESC ESC. The reasons for this are a bit complicated.)
473
474 Hitting ESC ESC will get you out of almost any weird mode, including
475 selected text, split windows, the minibuffer, recursive edits, "stranded
476 minibuffer requests", and the like. If you have many problems at once,
477 each invokation of ESC ESC will get rid of one, so keep repeating until
478 everything's fixed. REMEMBER: ESC ESC does not work if XEmacs is hung
479 doing some time-consuming operation or running broken code. Use C-g for
480 that.
267 481
268 482
269 * DISABLED COMMANDS 483 * DISABLED COMMANDS
270 ------------------- 484 -------------------
271 485
272 Some Emacs commands are "disabled" so that beginning users cannot use 486 Some XEmacs commands are "disabled" so that beginning users cannot use
273 them by accident. 487 them by accident.
274 488
275 If you type one of the disabled commands, Emacs displays a message 489 If you type one of the disabled commands, XEmacs displays a message
276 saying what the command was, and asking you whether you want to go 490 saying what the command was, and asking you whether you want to go
277 ahead and execute the command. 491 ahead and execute the command.
278 492
279 If you really want to try the command, type Space in answer to the 493 If you really want to try the command, type <Space> in answer to the
280 question. Normally, if you do not want to execute the disabled 494 question. Normally, if you do not want to execute the disabled
281 command, answer the question with "n". 495 command, answer the question with "n".
282 496
283 >> Type `C-x n p' (which is a disabled command), 497 >> Type `C-x n p' (which is a disabled command),
284 then type n to answer the question. 498 then type n to answer the question.
285 499
286 500
287 * WINDOWS 501 * "WINDOWS", I.E. PANES
288 --------- 502 -----------------------
289 503
290 Emacs can have several windows, each displaying its own text. 504 XEmacs can have several panes (i.e. non-overlapping divisions of a window
291 Note that "window" as used by Emacs does not refer to separate 505 or a TTY screen), each displaying its own text. For historical reasons,
292 overlapping windows in the window system, but to separate panes 506 these panes are called "windows", and what we normally think of as a
293 within a single X window. (Emacs can also have multiple X 507 window is called a "frame". XEmacs can also have multiple "frames"; this
294 windows, or "frames" in Emacs terminology. This is described 508 is described later. From now on, we omit the quotes around the XEmacs
295 later.) 509 terms, and if we need to use "window" in the standard sense, we will say
296 510 "window-system window".
297 At this stage it is better not to go into the techniques of 511
298 using multiple windows. But you do need to know how to get 512 At this stage it is better not to go too deeply into the techniques of
299 rid of extra windows that may appear to display help or 513 using multiple windows. But you do need to know how to get rid of extra
300 output from certain commands. It is simple: 514 windows that may appear to display help or output from certain commands.
301 515 Most of the time, your cursor will be in the new window; if this is the
302 C-x 1 One window (i.e., kill all other windows). 516 case, simply type q. Alternatively, you can type
303 517
304 That is Control-x followed by the digit 1. C-x 1 expands the window 518 C-x 0 Delete window.
305 which contains the cursor, to occupy the full screen. It deletes all 519
306 other windows. 520 That is, CONTROL-x followed by the digit 0. This command is unlike the
307 521 other commands you have learned in that it consists of two characters. It
308 >> Move the cursor to this line and type C-u 0 C-l. 522 starts with the character CONTROL-x. There is a whole series of commands
309 523 that start with CONTROL-x; many of them have to do with windows, files,
310 (Remember that C-l redraws the screen. If you give a 524 buffers, and related things. These commands are two, three or four
311 numeric argument to this command, it means "redraw the 525 characters long.
312 screen and put the current line that many lines from the 526
313 top of the screen." So C-u 0 C-l means "redraw the 527 >> Move the cursor to this line and type M-0 C-l.
314 screen, putting the current line at the top.") 528 (That's a zero, not an Oh.)
315 529 >> Type CONTROL-h k CONTROL-f.
316 >> Type Control-x 2
317 See how this window shrinks, while a new one appears 530 See how this window shrinks, while a new one appears
318 to display contents of this buffer. 531 to display documentation on the CONTROL-f command.
319 532
320 >> Type C-x 1 and see the new window disappear. 533 >> Type q and see the documentation listing window disappear.
534
535 (Remember that C-l redraws the frame. If you give a numeric argument to
536 this command, it means "redraw the frame and put the current line that
537 many lines from the top of the window." So M-0 C-l means "redraw the
538 frame, putting the current line at the top.")
321 539
322 540
323 * INSERTING AND DELETING 541 * INSERTING AND DELETING
324 ------------------------ 542 ------------------------
325 543
326 If you want to insert text, just type the text. Characters which you 544 If you want to insert text, just type the text. Characters which you can
327 can see, such as A, 7, *, etc. are taken by Emacs as text and inserted 545 see, such as A, 7, *, etc. are taken by XEmacs as text and inserted
328 immediately. Type <Return> (the carriage-return key) to insert a 546 immediately. Type <Return> (the carriage-return key) to insert a Newline
329 Newline character. 547 character.
330 548
331 You can delete the last character you typed by typing <Delete>. 549 You can delete the last character you typed by typing <Backspace>.
332 <Delete> is a key on the keyboard, which may be labeled "Del". In 550 <Backspace> is a key on the keyboard, which may be labeled simply with a
333 some cases, the "Backspace" key serves as <Delete>, but not always! 551 left arrow sign.
334 552
335 More generally, <Delete> deletes the character immediately before the 553 (NOTE: On a few misconfigured TTY's, typing <Backspace> may try to invoke
554 the help system; the symptom of this is a line like "C-h (Type ? for
555 further options)" at the bottom of the frame. If this is the case, type
556 C-g to get out of this, and try using <Delete> from now on in place of
557 <Backspace>.)
558
559 More generally, <Backspace> deletes the character immediately before the
336 current cursor position. 560 current cursor position.
337 561
338 >> Do this now--type a few characters, then delete them 562 >> Do this now--type a few characters, then delete them
339 by typing <Delete> a few times. Don't worry about this file 563 by typing <Backspace> a few times. Don't worry about this file
340 being changed; you will not alter the master tutorial. This is 564 being changed; you will not alter the master tutorial. This is
341 your personal copy of it. 565 your personal copy of it.
342 566
343 When a line of text gets too big for one line on the screen, the line 567 When a line of text gets too big for one line on the window, the line of
344 of text is "continued" onto a second screen line. A backslash ("\") 568 text is "continued" onto a second window line. An arrow at the right
345 at the right margin indicates a line which has been continued. 569 margin that hooks down and to the left (or a backslash ("\") on TTY's)
570 indicates a line which has been continued.
346 571
347 >> Insert text until you reach the right margin, and keep on inserting. 572 >> Insert text until you reach the right margin, and keep on inserting.
348 You'll see a continuation line appear. 573 You'll see a continuation line appear.
349 574
350 >> Use <Delete>s to delete the text until the line fits on one screen 575 >> Use <Backspace>s to delete the text until the line fits on one window
351 line again. The continuation line goes away. 576 line again. The continuation line goes away.
352 577
353 You can delete a Newline character just like any other character. 578 You can delete a Newline character just like any other character.
354 Deleting the Newline character between two lines merges them into 579 Deleting the Newline character between two lines merges them into
355 one line. If the resulting combined line is too long to fit in the 580 one line. If the resulting combined line is too long to fit in the
356 screen width, it will be displayed with a continuation line. 581 window width, it will be displayed with a continuation line.
357 582
358 >> Move the cursor to the beginning of a line and type <Delete>. This 583 >> Move the cursor to the beginning of a line and type <Backspace>. This
359 merges that line with the previous line. 584 merges that line with the previous line.
360 585
361 >> Type <Return> to reinsert the Newline you deleted. 586 >> Type <Return> to reinsert the Newline you deleted.
362 587
363 Remember that most Emacs commands can be given a repeat count; 588 Remember that most XEmacs commands can be given a repeat count;
364 this includes text characters. Repeating a text character inserts 589 this includes text characters. Repeating a text character inserts
365 it several times. 590 it several times.
366 591
367 >> Try that now -- type C-u 8 * to insert ********. 592 >> Try that now -- type M-8 * to insert ********.
368 593
369 You've now learned the most basic way of typing something in 594 You've now learned the most basic way of typing something in
370 Emacs and correcting errors. You can delete by words or lines 595 XEmacs and correcting errors. You can delete by words or lines
371 as well. Here is a summary of the delete operations: 596 as well. Here is a summary of the delete operations:
372 597
373 <Delete> delete the character just before the cursor 598 <Backspace> delete the character just before the cursor
374 C-d delete the next character after the cursor 599 <Delete> delete the next character after the cursor
375 600 C-d same as <Delete> but works on TTY's
376 M-<Delete> kill the word immediately before the cursor 601
377 M-d kill the next word after the cursor 602 M-<Backspace> cut ("kill") the word immediately before the cursor
378 603 M-<Delete> cut ("kill") the next word after the cursor
379 C-k kill from the cursor position to end of line 604 M-d same as M-<Delete> but works on TTY's
380 M-k kill to the end of the current sentence 605
381 606 C-k cut ("kill") from the cursor position to end of line
382 Notice that <Delete> and C-d vs M-<Delete> and M-d extend the parallel 607 M-k cut ("kill") to the end of the current sentence
383 started by C-f and M-f (well, <Delete> is not really a control 608
384 character, but let's not worry about that). C-k and M-k are like C-e 609 Notice again the parallelism with no modifier vs. CONTROL vs. META that
385 and M-e, sort of, in that lines are opposite sentences. 610 was mentioned earlier -- although the parallels are not perfect.
386 611
387 When you delete more than one character at a time, Emacs saves the 612 (In the violent old days when Emacs first began, removing text that
388 deleted text so that you can bring it back. Bringing back killed text 613 could later be re-inserted was called "killing", and re-inserting was
389 is called "yanking". You can yank the killed text either at the same 614 called "yanking" -- evidently the designers of Emacs must have been
390 place where it was killed, or at some other place in the text. You 615 thinking of role-playing games, where killed characters could be easily
391 can yank the text several times in order to make multiple copies of 616 resurrected with the wave [yank?] of a magic wand. In the more genteel
392 it. The command to yank is C-y. 617 [and realistic] times we live in, the preferred terms are "cut" and
393 618 "paste".)
394 Note that the difference between "Killing" and "Deleting" something is 619
395 that "Killed" things can be yanked back, and "Deleted" things cannot. 620 You can also kill any part of the buffer with one uniform method. Under
396 Generally, the commands that can remove a lot of text save the text, 621 window systems, the preferred method is to move to one end of that part,
397 while the commands that delete just one character, or just blank lines 622 hold the SHIFT key down, and use the cursor keys to move to the other
398 and spaces, do not save the deleted text. 623 end. Then release the SHIFT key and type C-w. That kills all the text
624 between the two positions.
625
626 An alternative method, which also works on TTY's, is to move to one end of
627 the text, and type C-@ or C-<Space> (either one).
628 Move to the other end and type C-w.
629
630 >> Move the cursor to the A at the start of the previous paragraph.
631 >> Hold the SHIFT key down.
632 >> Move the cursor to the n in "end", on the third line of the
633 paragraph.
634 >> Release the SHIFT key and type C-w. This will kill the text starting
635 from the A, and ending just before the n.
636
637 Now try it the other way.
638
639 >> Type C-/ to undo the killing, or C-_ or C-x u on TTY's.
640 >> Move the cursor to the same A again.
641 >> Type C-<Space>. XEmacs should display a message "Mark set"
642 at the bottom of the frame.
643 >> Move the cursor to the n in "end", on the third line of the
644 paragraph.
645 >> Type C-w. You will get the same result as previously.
646
647 The difference between "killing" and "deleting" is that "killed" text
648 can be reinserted, whereas "deleted" things cannot be reinserted.
649 Reinsertion of killed text is called "yanking". Generally, the
650 commands that can remove a lot of text kill the text (they set up so
651 that you can yank the text), while the commands that remove just one
652 character, or just blank lines and spaces, do deletion (so you cannot
653 yank that text).
654
655 Normally, on a window system "killing" text stores it internally but
656 also puts it on the clipboard, just like Cut in a word processor, and
657 "yanking" takes text from the clipboard if available, just like Paste.
658 (This connection to the clipboard can be turned off from the Options
659 menu.) There are also menu items, "Edit->Cut" and "Edit->Paste", that
660 always connect with the clipboard, and equivalent Cut and Paste keys on
661 Sun keyboards.
399 662
400 >> Move the cursor to the beginning of a line which is not empty. 663 >> Move the cursor to the beginning of a line which is not empty.
401 Then type C-k to kill the text on that line. 664 Then type C-k to kill the text on that line.
402 >> Type C-k a second time. You'll see that it kills the Newline 665 >> Type C-k a second time. You'll see that it kills the Newline
403 which follows that line. 666 which follows that line.
404 667
405 Note that a single C-k kills the contents of the line, and a second 668 Note that a single C-k kills the contents of the line, and a second
406 C-k kills the line itself, and make all the other lines move up. C-k 669 C-k kills the line itself, and makes all the other lines move up. C-k
407 treats a numeric argument specially: it kills that many lines AND 670 treats a numeric argument specially: it kills that many lines AND
408 their contents. This is not mere repetition. C-u 2 C-k kills two 671 their contents. This is not mere repetition. M-2 C-k kills two
409 lines and their newlines; typing C-k twice would not do that. 672 lines and their newlines; typing C-k twice would not do that.
410 673
411 To retrieve the last killed text and put it where the cursor currently 674 Bringing back killed text is called "yanking". (Think of it as
412 is, type C-y. 675 yanking back, or pulling back, some text that was taken away.) You
676 can yank the killed text either at the same place where it was killed,
677 or at some other place in the buffer, or even in a different file.
678 You can yank the text several times, which makes multiple copies of
679 it.
680
681 The command for yanking is C-y. It reinserts the last killed text,
682 after the current cursor position.
413 683
414 >> Try it; type C-y to yank the text back. 684 >> Try it; type C-y to yank the text back.
415 685
416 Think of C-y as if you were yanking something back that someone took 686 If you do several C-k's in a row, all of the killed text is saved
417 away from you. Notice that if you do several C-k's in a row, all of 687 together, so that one C-y will yank all of the lines at once.
418 the killed text is saved together, so that one C-y will yank all of
419 the lines.
420 688
421 >> Do this now, type C-k several times. 689 >> Do this now, type C-k several times.
422 690
423 Now to retrieve that killed text: 691 Now to retrieve that killed text:
424 692
448 716
449 717
450 * UNDO 718 * UNDO
451 ------ 719 ------
452 720
453 If you make a change to the text, and then decide that it was a 721 If you make a change to the text, and then decide that it was a mistake,
454 mistake, you can undo the change with the undo command, C-x u. 722 you can undo the change with the undo command, C-/. (On TTY's, use C-_,
455 723 i.e. CONTROL + underscore, which is normally above the minus sign;
456 Normally, C-x u undoes the changes made by one command; if you repeat 724 i.e. you will have to hold the SHIFT key down, as in CONTROL + SHIFT +
457 the C-x u several times in a row, each repetition undoes one 725 minus. If that doesn't work, you can fall back to C-x u; but that has
726 the unfortunate property that it's difficult to execute several times in
727 a row.)
728
729 Normally, C-/ undoes the changes made by one command; if you repeat
730 the C-/ several times in a row, each repetition undoes one
458 additional command. 731 additional command.
459 732
460 But there are two exceptions: commands that do not change the text do 733 But there are two exceptions: commands that do not change the text do
461 not count (this includes cursor motion commands and scrolling 734 not count (this includes cursor motion commands and scrolling
462 command), and self-inserting characters are usually handled in groups 735 command), and self-inserting characters are usually handled in groups
463 of up to 20. (This is to reduce the number of C-x u's you have to 736 of up to 20. (This is to reduce the number of C-/'s you have to
464 type to undo insertion of text.) 737 type to undo insertion of text.)
465 738
466 >> Kill this line with C-k, then type C-x u and it should reappear. 739 >> Kill this line with C-k, then type C-/ and it should reappear.
467 740
468 C-_ is an alternative undo command; it works just the same as C-x u, 741 A numeric argument to C-/ acts as a repeat count.
469 but it is easier to type several times in a row. The disadvantage of 742
470 C-_ is that on some keyboards it is not obvious how to type it. That 743 If you change your mind and want to redo changes that you've undone,
471 is why we provide C-x u as well. On some terminals, you can type C-_ 744 issue any command other than Undo (usually people move the cursor), and
472 by typing / while holding down CTRL. 745 then start undoing again. This will undo your Undo changes; keep
473 746 hitting Undo, and you will eventually undo all the Undo's, and start
474 A numeric argument to C-_ or C-x u acts as a repeat count. 747 undoing your original changes. Essentially, XEmacs treats each Undo as
748 a further change, and records them for undoing just like regular
749 commands; but as long as you keeping issuing Undo commands directly
750 after previous ones, XEmacs remembers where you are in the Undo history
751 so it can keep undoing. Once you issue another command, XEmacs
752 "forgets" and resets its internal pointer to the end of the Undo
753 history. This may seem confusing, so try it out:
754
755 >> Type a line of text above this one.
756 >> Move to the end of the line you just typed, and hit <Backspace>
757 until you've deleted all characters.
758 >> Type C-/ a number of times to undo some of your deletions.
759 >> Move the cursor left.
760 >> Start typing C-/ again, and it will redo your deletions until there's
761 no text left, then it will start undoing the original deletions.
762 When all the text appears again, further C-/'s will undo the text you
763 originally typed, in groups of up to 20 (see above).
764
765 As you just saw, you can undo deletion of text just as you can undo
766 killing of text. The distinction between killing something and deleting
767 it affects whether you can yank it with C-y; it makes no difference for
768 undo.
769
770
771 * USING THE MOUSE
772 -----------------
773
774 On window systems, XEmacs is fully integrated with the mouse. You can
775 position the text cursor by clicking the left button at the desired
776 location, and you can select text by dragging the left mouse button
777 across the text you want to select. (Or alternatively, click the left
778 mouse button at one end of the text, then move to the other end and use
779 Shift-click to select the text.)
780
781 The middle mouse button is commonly used to choose items that are
782 visible on the screen. For example, if you enter Info (the on-line
783 XEmacs documentation) using C-h i or the Help menu, you can follow a
784 highlighted link by clicking the middle mouse button on it. Similarly,
785 if you are typing a file name in (e.g. when prompted by "Find File") and
786 you hit <Tab> to show the possible completions, you can click the middle
787 mouse button on one of the completions to select it. If you have a
788 two-button mouse, such as some MS Windows systems, you can click both
789 buttons simultaneously to simulate the middle button.
790
791 The right mouse button brings up a popup menu, called a "context menu"
792 because the contents vary depending on what context you're in, such as
793 the mode of the window you click in or the text under the mouse. The
794 menu usually contains the commands most relevant to where you clicked,
795 so they're easier to access.
796
797 >> Press the right mouse button now.
798
799 Under X Windows, you may have to hold the button down in order to keep
800 the menu up.
475 801
476 802
477 * FILES 803 * FILES
478 ------- 804 -------
479 805
480 In order to make the text you edit permanent, you must put it in a 806 In order to make the text you edit permanent, you must put it in a
481 file. Otherwise, it will go away when your invocation of Emacs goes 807 file. Otherwise, it will go away when your invocation of XEmacs goes
482 away. You put your editing in a file by "finding" the file. (This is 808 away. In order to put your text in a file, you must "find" the file
483 also called "visiting" the file.) 809 before you enter the text. (This is also called "visiting" the file.)
484 810
485 Finding a file means that you see the contents of the file within 811 Finding a file means that you see the contents of the file within
486 Emacs. In many ways, it is as if you were editing the file itself. 812 XEmacs. In many ways, it is as if you were editing the file itself.
487 However, the changes you make using Emacs do not become permanent 813 However, the changes you make using XEmacs do not become permanent
488 until you "save" the file. This is so you can avoid leaving a 814 until you "save" the file. This is so you can avoid leaving a
489 half-changed file on the system when you do not want to. Even when 815 half-changed file on the system when you do not want to. Even when
490 you save, Emacs leaves the original file under a changed name in case 816 you save, XEmacs leaves the original file under a changed name in case
491 you later decide that your changes were a mistake. 817 you later decide that your changes were a mistake.
492 818
493 If you look near the bottom of the screen you will see a line that 819 If you look near the bottom of the frame you will see a line that begins
494 begins and ends with dashes, and contains the string "Emacs: 820 and ends with dashes, and contains the string "XEmacs: TUTORIAL" or
495 TUTORIAL". This part of the screen always shows the name of the file 821 something like that. This part of the frame normally shows the name of
496 that you are visiting. Right now, you are visiting a file called 822 the file that you are visiting. Right now, you are visiting a file called
497 "TUTORIAL" which is your personal scratch copy of the Emacs tutorial. 823 "TUTORIAL" which is your personal scratch copy of the XEmacs tutorial.
498 Whatever file you find, that file's name will appear in that precise 824 When you find a file with XEmacs, that file's name will appear in that
499 spot. 825 precise spot.
500 826
501 The commands for finding and saving files are unlike the other 827 One special thing about the command for finding a file is that you
502 commands you have learned in that they consist of two characters. 828 have to say what file name you want. We say the command "reads an
503 They both start with the character Control-x. There is a whole series 829 argument from the terminal" (in this case, the argument is the name of
504 of commands that start with Control-x; many of them have to do with 830 the file). After you type the command
505 files, buffers, and related things. These commands are two, three or
506 four characters long.
507
508 Another thing about the command for finding a file is that you have
509 to say what file name you want. We say the command "reads an argument
510 from the terminal" (in this case, the argument is the name of the
511 file). After you type the command
512 831
513 C-x C-f Find a file 832 C-x C-f Find a file
514 833
515 Emacs asks you to type the file name. The file name you type appears 834 XEmacs asks you to type the file name. The file name you type appears
516 on the bottom line of the screen. The bottom line is called the 835 on the bottom line of the frame. The bottom line is called the
517 minibuffer when it is used for this sort of input. You can use 836 minibuffer when it is used for this sort of input. You can use
518 ordinary Emacs editing commands to edit the file name. 837 ordinary XEmacs editing commands to edit the file name.
519 838
520 While you are entering the file name (or any minibuffer input), 839 While you are entering the file name (or any minibuffer input),
521 you can cancel the command with C-g. 840 you can cancel the command with C-g.
522 841
523 >> Type C-x C-f, then type C-g. This cancels the minibuffer, 842 >> Type C-x C-f, then type C-g. This cancels the minibuffer,
533 edit the contents. When you wish to make your changes permanent, 852 edit the contents. When you wish to make your changes permanent,
534 type the command 853 type the command
535 854
536 C-x C-s Save the file 855 C-x C-s Save the file
537 856
538 This copies the text within Emacs into the file. The first time you 857 This copies the text within XEmacs into the file. The first time you
539 do this, Emacs renames the original file to a new name so that it is 858 do this, XEmacs renames the original file to a new name so that it is
540 not lost. The new name is made by adding "~" to the end of the 859 not lost. The new name is made by adding "~" to the end of the
541 original file's name. 860 original file's name.
542 861
543 When saving is finished, Emacs prints the name of the file written. 862 When saving is finished, XEmacs displays the name of the file written.
544 You should save fairly often, so that you will not lose very much 863 You should save fairly often, so that you will not lose very much
545 work if the system should crash. 864 work if the system should crash.
546 865
547 >> Type C-x C-s, saving your copy of the tutorial. 866 >> Type C-x C-s, saving your copy of the tutorial.
548 This should print "Wrote ...TUTORIAL" at the bottom of the screen. 867 This should show "Wrote ...TUTORIAL" at the bottom of the frame.
549 868
550 NOTE: On some systems, typing C-x C-s will freeze the screen and you 869 NOTE: On some older TTY connections, typing C-s will freeze the screen
551 will see no further output from Emacs. This indicates that an 870 and you will see no further output from XEmacs. This indicates that an
552 operating system "feature" called "flow control" is intercepting the 871 operating system "feature" called "flow control" is intercepting the C-s
553 C-s and not letting it get through to Emacs. To unfreeze the screen, 872 and not letting it get through to XEmacs. To unfreeze the screen, type
554 type C-q. Then see the section "Spontaneous Entry to Incremental 873 C-q. Then see the section "Spontaneous Entry to Incremental Search" in
555 Search" in the Emacs manual for advice on dealing with this "feature". 874 the XEmacs manual for advice on dealing with this "feature".
556 875
557 You can find an existing file, to view it or edit it. You can also 876 You can find an existing file, to view it or edit it. You can also
558 find a file which does not already exist. This is the way to create a 877 find a file which does not already exist. This is the way to create a
559 file with Emacs: find the file, which will start out empty, and then 878 file with XEmacs: find the file, which will start out empty, and then
560 begin inserting the text for the file. When you ask to "save" the 879 begin inserting the text for the file. When you ask to "save" the
561 file, Emacs will really create the file with the text that you have 880 file, XEmacs will really create the file with the text that you have
562 inserted. From then on, you can consider yourself to be editing an 881 inserted. From then on, you can consider yourself to be editing an
563 already existing file. 882 already existing file.
564 883
565 884
566 * BUFFERS 885 * BUFFERS
567 --------- 886 ---------
568 887
569 If you find a second file with C-x C-f, the first file remains 888 If you find a second file with C-x C-f, the first file remains
570 inside Emacs. You can switch back to it by finding it again with 889 inside XEmacs. You can switch back to it by finding it again with
571 C-x C-f. This way you can get quite a number of files inside Emacs. 890 C-x C-f. This way you can get quite a number of files inside XEmacs.
572 891
573 >> Create a file named "foo" by typing C-x C-f foo <Return>. 892 >> Create a file named "foo" by typing C-x C-f foo <Return>.
574 Then insert some text, edit it, and save "foo" by typing C-x C-s. 893 Then insert some text, edit it, and save "foo" by typing C-x C-s.
575 Finally, type C-x C-f TUTORIAL <Return> 894 Finally, type C-x C-f TUTORIAL <Return>
576 to come back to the tutorial. 895 to come back to the tutorial.
577 896
578 Emacs stores each file's text inside an object called a "buffer." 897 XEmacs stores each file's text inside an object called a "buffer".
579 Finding a file makes a new buffer inside Emacs. To see a list of the 898 Finding a file makes a new buffer inside XEmacs. To see a list of the
580 buffers that current exist in your Emacs job, type 899 buffers that currently exist in your XEmacs job, type
581 900
582 C-x C-b List buffers 901 C-x C-b List buffers
583 902
584 >> Try C-x C-b now. 903 >> Try C-x C-b now.
585 904
586 See how each buffer has a name, and it may also have a file name 905 See how each buffer has a name, and it may also have a file name
587 for the file whose contents it holds. Some buffers do not correspond 906 for the file whose contents it holds. Some buffers do not correspond
588 to files. For example, the buffer named "*Buffer List*" does 907 to files. For example, the buffer named "*Buffer List*" does
589 not have any file. It is the buffer which contains the buffer 908 not have any file. It is the buffer which contains the buffer
590 list that was made by C-x C-b. ANY text you see in an Emacs window 909 list that was made by C-x C-b. ANY text you see in an XEmacs window
591 is always part of some buffer. 910 is always part of some buffer.
592 911
593 >> Type C-x 1 to get rid of the buffer list. 912 >> Type ESC ESC to get rid of the buffer list. (Remember, three ESC's
913 under TTY's.)
594 914
595 If you make changes to the text of one file, then find another file, 915 If you make changes to the text of one file, then find another file,
596 this does not save the first file. Its changes remain inside Emacs, 916 this does not save the first file. Its changes remain inside XEmacs,
597 in that file's buffer. The creation or editing of the second file's 917 in that file's buffer. The creation or editing of the second file's
598 buffer has no effect on the first file's buffer. This is very useful, 918 buffer has no effect on the first file's buffer. This is very useful,
599 but it also means that you need a convenient way to save the first 919 but it also means that you need a convenient way to save the first
600 file's buffer. It would be a nuisance to have to switch back to 920 file's buffer. It would be a nuisance to have to switch back to
601 it with C-x C-f in order to save it with C-x C-s. So we have 921 it with C-x C-f in order to save it with C-x C-s. So we have
608 928
609 >> Insert a line of text, then type C-x s. 929 >> Insert a line of text, then type C-x s.
610 It should ask you whether to save the buffer named TUTORIAL. 930 It should ask you whether to save the buffer named TUTORIAL.
611 Answer yes to the question by typing "y". 931 Answer yes to the question by typing "y".
612 932
613 * USING THE MENU
614 ----------------
615
616 If you are on an X terminal, you will notice a menubar at the
617 top of the Emacs screen. You can use this menubar to access all
618 the most common Emacs commands, such as "find file". You will
619 find this easier at first, because you don't need to remember
620 the keystrokes necessary to access any particular command. Once
621 you are comfortable with Emacs, it will be easy to begin using
622 the keyboard commands because each menu item with a
623 corresponding keyboard command has the command listed next to
624 it.
625
626 Note that there are many items in the menubar that have no exact
627 keyboard equivalents. For example, the Buffers menu lists all
628 of the available buffers in most-recently used order. You can
629 switch to any buffer by simply findings its name in the Buffers
630 menu and selecting it.
631
632
633 * USING THE MOUSE
634 -----------------
635
636 When running under X, Emacs is fully integrated with the mouse.
637 You can position the text cursor by clicking the left button at
638 the desired location, and you can select text by dragging the
639 left mouse button across the text you want to select. (Or
640 alternatively, click the left mouse button at one end of the
641 text, then move to the other end and use Shift-click to select
642 the text.)
643
644 To kill some selected text, you can use C-w or choose the Cut
645 item from the Edit menu. Note that these are *not* equivalent:
646 C-w only saves the text internally within Emacs (similar to C-k
647 as described above), whereas Cut does this and also puts the
648 text into the X clipboard, where it can be accessed by other
649 applications.
650
651 To retrieve text from the X clipboard, use the Paste item from
652 the Edit menu.
653
654 The middle mouse button is commonly used to choose items that
655 are visible on the screen. For example, if you enter Info (the
656 on-line Emacs documentation) using C-h i or the Help menu, you
657 can follow a highlighted link by clicking the middle mouse
658 button on it. Similarly, if you are typing a file name in
659 (e.g. when prompted by "Find File") and you hit TAB to show the
660 possible completions, you can click the middle mouse button on
661 one of the completions to select it.
662
663 The right mouse button brings up a popup menu. The contents of
664 this menu vary depending on what mode you're in, and usually
665 contain a few commonly used commands, so they're easier to
666 access.
667
668 >> Press the right mouse button now.
669
670 You will have to hold the button down in order to keep the
671 menu up.
672
673 933
674 * EXTENDING THE COMMAND SET 934 * EXTENDING THE COMMAND SET
675 --------------------------- 935 ---------------------------
676 936
677 There are many, many more Emacs commands than could possibly be put 937 There are many, many more XEmacs commands than could possibly be put
678 on all the control and meta characters. Emacs gets around this with 938 on all the control and meta characters. XEmacs gets around this with
679 the X (eXtend) command. This comes in two flavors: 939 the X (eXtend) command. This comes in two flavors:
680 940
681 C-x Character eXtend. Followed by one character. 941 C-x Character eXtend. Followed by one character.
682 M-x Named command eXtend. Followed by a long name. 942 M-x Named command eXtend. Followed by a long name.
683 943
684 These are commands that are generally useful but used less than the 944 These are commands that are generally useful but used less than the
685 commands you have already learned about. You have already seen two of 945 commands you have already learned about. You have already seen two of
686 them: the file commands C-x C-f to Find and C-x C-s to Save. Another 946 them: the file commands C-x C-f to Find and C-x C-s to Save. Another
687 example is the command to end the Emacs session--this is the command 947 example is the command to end the XEmacs session--this is the command
688 C-x C-c. (Do not worry about losing changes you have made; C-x C-c 948 C-x C-c. (Do not worry about losing changes you have made; C-x C-c
689 offers to save each changed file before it kills the Emacs.) 949 offers to save each changed file before it kills the XEmacs.)
690 950
691 C-z is the command to exit Emacs *temporarily*--so that you can go 951 If you have installed the sample init.el file (we highly recommend this,
692 back to the same Emacs session afterward. 952 once you've gotten some familiarity with XEmacs; see "Help->Samples->View
693 953 Sample init.el"), you will find that C-x C-c does not exit XEmacs, but
694 On systems which allow it, C-z "suspends" Emacs; that is, it returns 954 instead outputs a message. This is intentional, since C-x C-c is easy to
695 to the shell but does not destroy the Emacs. In the most common 955 hit accidentally. Instead, use the "File->Exit XEmacs" menu item to exit.
696 shells, you can resume Emacs with the `fg' command or with `%emacs'. 956
697 957 If you are on a TTY, and you want to exit temporarily to execute a shell
698 On systems which do not implement suspending, C-z creates a subshell 958 command, you should use C-z instead of C-x C-c. Under TTY's, C-z
699 running under Emacs to give you the chance to run other programs and 959 "suspends" XEmacs; that is, it returns to the shell but does not destroy
700 return to Emacs afterward; it does not truly "exit" from Emacs. In 960 the XEmacs. In the most common shells, you can resume XEmacs with the
701 this case, the shell command `exit' is the usual way to get back to 961 `fg' command or with `%xemacs'. (On systems which do not implement
702 Emacs from the subshell. 962 suspending, C-z creates a subshell running under XEmacs to give you the
703 963 chance to run other programs and return to XEmacs afterward; it does not
704 The time to use C-x C-c is when you are about to log out. It's also 964 truly "exit" from XEmacs. In this case, the shell command `exit' is the
705 the right thing to use to exit an Emacs invoked under mail handling 965 usual way to get back to XEmacs from the subshell.)
706 programs and other miscellaneous utilities, since they may not know
707 how to cope with suspension of Emacs. In ordinary circumstances,
708 though, if you are not about to log out, it is better to suspend Emacs
709 with C-z instead of exiting Emacs.
710 966
711 There are many C-x commands. Here is a list of the ones you have learned: 967 There are many C-x commands. Here is a list of the ones you have learned:
712 968
713 C-x C-f Find file. 969 C-x C-f Find file.
714 C-x C-s Save file. 970 C-x C-s Save file.
715 C-x C-b List buffers. 971 C-x C-b List buffers.
716 C-x C-c Quit Emacs. 972 C-x C-c Quit XEmacs.
717 C-x u Undo. 973 C-x 0 Delete the current window.
974 C-x u Undo (TTY version).
718 975
719 Named eXtended commands are commands which are used even less 976 Named eXtended commands are commands which are used even less
720 frequently, or commands which are used only in certain modes. An 977 frequently, or commands which are used only in certain modes. An
721 example is the command replace-string, which globally replaces one 978 example is the command replace-string, which globally replaces one
722 string with another. When you type M-x, Emacs prompts you at the 979 string with another. When you type M-x, XEmacs prompts you at the
723 bottom of the screen with M-x and you should type the name of the 980 bottom of the frame with M-x and you should type the name of the
724 command; in this case, "replace-string". Just type "repl s<TAB>" and 981 command; in this case, "replace-string". Just type "repl s<Tab>" and
725 Emacs will complete the name. End the command name with <Return>. 982 XEmacs will complete the name. (<Tab> is the Tab key, usually found
983 above the CapsLock or Shift key near the left edge of the keyboard.)
984 End the command name with <Return>.
726 985
727 The replace-string command requires two arguments--the string to be 986 The replace-string command requires two arguments--the string to be
728 replaced, and the string to replace it with. You must end each 987 replaced, and the string to replace it with. You must end each
729 argument with <Return>. 988 argument with <Return>.
730 989
738 997
739 * AUTO SAVE 998 * AUTO SAVE
740 ----------- 999 -----------
741 1000
742 When you have made changes in a file, but you have not saved them yet, 1001 When you have made changes in a file, but you have not saved them yet,
743 they could be lost if your computer crashes. To protect you from 1002 they could be lost if your computer crashes. To protect you from this,
744 this, Emacs periodically writes an "auto save" file for each file that 1003 XEmacs periodically writes an "auto save" file for each file that you
745 you are editing. The auto save file name has a # at the beginning and 1004 are editing. The auto save file name has a # at the beginning and the
746 the end; for example, if your file is named "hello.c", its auto save 1005 end; for example, if your file is named "hello.c", its auto save file's
747 file's name is "#hello.c#". When you save the file in the normal way, 1006 name is usually "#hello.c#". When you save the file in the normal way,
748 Emacs deletes its auto save file. 1007 XEmacs deletes its auto save file.
749 1008
750 If the computer crashes, you can recover your auto-saved editing by 1009 If the computer crashes, you can recover your auto-saved editing by
751 finding the file normally (the file you were editing, not the auto 1010 finding the file normally (the file you were editing, not the auto
752 save file) and then typing M-x recover file<return>. When it asks for 1011 save file) and then typing M-x recover file<Return>. When it asks for
753 confirmation, type yes<return> to go ahead and recover the auto-save 1012 confirmation, type yes<Return> to go ahead and recover the auto-save
754 data. 1013 data.
755 1014
756 1015
757 * ECHO AREA 1016 * ECHO AREA
758 ----------- 1017 -----------
759 1018
760 If Emacs sees that you are typing commands slowly it shows them to you 1019 If XEmacs sees that you are typing multicharacter commands slowly, it
761 at the bottom of the screen in an area called the "echo area." The echo 1020 shows them to you at the bottom of the frame in an area called the
762 area contains the bottom line of the screen. 1021 "echo area". The echo area contains the bottom line of the frame.
763 1022
764 1023
765 * MODELINE 1024 * MODELINE
766 ----------- 1025 ----------
767 1026
768 The line immediately above the echo area it is called the "modeline". 1027 The line immediately above the echo area it is called the "modeline".
769 The mode line says something like this: 1028 The mode line says something like this:
770 1029
771 --**-XEmacs: TUTORIAL (Fundamental)--L670--58%---------------- 1030 --**-XEmacs: TUTORIAL (Fundamental)--L670--58%----------------
772 1031
773 This line gives useful information about the status of Emacs and 1032 This line gives useful information about the status of XEmacs and
774 the text you are editing. 1033 the text you are editing.
775 1034
776 You already know what the filename means--it is the file you have 1035 You already know what the filename means--it is the file you have
777 found. -NN%-- indicates your current position in the text; it means 1036 found. -NN%-- indicates your current position in the text; it means
778 that NN percent of the text is above the top of the screen. If the 1037 that NN percent of the text is above the top of the window. If the
779 top of the file is on the screen, it will say --Top-- instead of 1038 top of the file is on the screen, it will say --Top-- instead of
780 --00%--. If the bottom of the text is on the screen, it will say 1039 --00%--. If the bottom of the text is on the screen, it will say
781 --Bot--. If you are looking at text so small that all of it fits on 1040 --Bot--. If you are looking at text so small that all of it fits on
782 the screen, the mode line says --All--. 1041 the screen, the mode line says --All--.
783 1042
1043 The L and digits indicate position in another way: they give the
1044 current line number of point.
1045
784 The stars near the front mean that you have made changes to the text. 1046 The stars near the front mean that you have made changes to the text.
785 Right after you visit or save a file, that part of the mode line shows 1047 Right after you visit or save a file, that part of the mode line shows
786 no stars, just dashes. 1048 no stars, just dashes.
787 1049
788 The part of the mode line inside the parentheses is to tell you what 1050 The part of the mode line inside the parentheses is to tell you what
789 editing modes you are in. The default mode is Fundamental which is 1051 editing modes you are in. The default mode is Fundamental which is
790 what you are using now. It is an example of a "major mode". 1052 what you are using now. It is an example of a "major mode".
791 1053
792 Emacs has many different major modes. Some of them are meant for 1054 XEmacs has many different major modes. Some of them are meant for
793 editing different languages and/or kinds of text, such as Lisp mode, 1055 editing different languages and/or kinds of text, such as Lisp mode,
794 Text mode, etc. At any time one and only one major mode is active, 1056 Text mode, etc. At any time one and only one major mode is active,
795 and its name can always be found in the mode line just where 1057 and its name can always be found in the mode line just where
796 "Fundamental" is now. 1058 "Fundamental" is now.
797 1059
805 1067
806 If you are going to be editing English text, such as this file, you 1068 If you are going to be editing English text, such as this file, you
807 should probably use Text Mode. 1069 should probably use Text Mode.
808 >> Type M-x text-mode<Return>. 1070 >> Type M-x text-mode<Return>.
809 1071
810 Don't worry, none of the commands you have learned changes Emacs in 1072 Don't worry, none of the XEmacs commands you have learned changes in
811 any great way. But you can observe that M-f and M-b now treat 1073 any great way. But you can observe that C-<Right> and C-<Left> now treat
812 apostrophes as part of words. Previously, in Fundamental mode, 1074 apostrophes as part of words. Previously, in Fundamental mode,
813 M-f and M-b treated apostrophes as word-separators. 1075 C-<Right> and C-<Left> treated apostrophes as word-separators.
814 1076
815 Major modes usually make subtle changes like that one: most commands 1077 Major modes usually make subtle changes like that one: most commands
816 do "the same job" in each major mode, but they work a little bit 1078 do "the same job" in each major mode, but they work a little bit
817 differently. 1079 differently.
818 1080
819 To view documentation on your current major mode, type C-h m. 1081 To view documentation on your current major mode, type C-h m.
820 1082
821 >> Use C-u C-v once or more to bring this line near the top of screen. 1083 >> Use M-4 C-l to bring this line near the top of the window.
822 >> Type C-h m, to see how Text mode differs from Fundamental mode. 1084 >> Type C-h m, to see how Text mode differs from Fundamental mode.
823 >> Type q to remove the documentation from the screen. 1085 >> Type q to remove the documentation from the screen.
824 1086
825 Major modes are called major because there are also minor modes. 1087 Major modes are called major because there are also minor modes.
826 Minor modes are alternatives not to the major modes, just minor 1088 Minor modes are not alternatives to the major modes, just minor
827 modifications of them. Each minor mode can be turned on or off by 1089 modifications of them. Each minor mode can be turned on or off by
828 itself, independent of all other minor modes, and independent of your 1090 itself, independent of all other minor modes, and independent of your
829 major mode. So you can use no minor modes, or one minor mode, or any 1091 major mode. So you can use no minor modes, or one minor mode, or any
830 combination of several minor modes. 1092 combination of several minor modes.
831 1093
832 One minor mode which is very useful, especially for editing English 1094 One minor mode which is very useful, especially for editing English
833 text, is Auto Fill mode. When this mode is on, Emacs breaks the line 1095 text, is Auto Fill mode. When this mode is on, XEmacs breaks the line
834 in between words automatically whenever you insert text and make a 1096 in between words automatically whenever you insert text and make a
835 line that is too wide. 1097 line that is too wide.
836 1098
837 You can turn Auto Fill mode on by doing M-x auto-fill-mode<Return>. 1099 You can turn Auto Fill mode on by doing M-x auto-fill-mode<Return>.
838 When the mode is on, you can turn it off by doing M-x 1100 When the mode is on, you can turn it off again by doing M-x
839 auto-fill-mode<Return>. If the mode is off, this command turns it on, 1101 auto-fill-mode<Return>. If the mode is off, this command turns it on,
840 and if the mode is on, this command turns it off. We say that the 1102 and if the mode is on, this command turns it off. We say that the
841 command "toggles the mode". 1103 command "toggles the mode".
842 1104
843 >> Type M-x auto-fill-mode<Return> now. Then insert a line of "asdf " 1105 >> Type M-x auto-fill-mode<Return> now. Then insert a line of "asdf "
846 1108
847 The margin is usually set at 70 characters, but you can change it 1109 The margin is usually set at 70 characters, but you can change it
848 with the C-x f command. You should give the margin setting you want 1110 with the C-x f command. You should give the margin setting you want
849 as a numeric argument. 1111 as a numeric argument.
850 1112
851 >> Type C-x f with an argument of 20. (C-u 2 0 C-x f). 1113 >> Type C-x f with an argument of 20. (M-20 C-x f).
852 Then type in some text and see Emacs fill lines of 20 1114 Then type in some text and see XEmacs fill lines of 20
853 characters with it. Then set the margin back to 70 using 1115 characters with it. Then set the margin back to 70 using
854 C-x f again. 1116 C-x f again.
855 1117
856 If you makes changes in the middle of a paragraph, Auto Fill mode 1118 If you make changes in the middle of a paragraph, Auto Fill mode
857 does not re-fill it for you. 1119 does not re-fill it for you.
858 To re-fill the paragraph, type M-q (Meta-q) with the cursor inside 1120 To re-fill the paragraph, type M-q (META-q) with the cursor inside
859 that paragraph. 1121 that paragraph.
860 1122
861 >> Move the cursor into the previous paragraph and type M-q. 1123 >> Move the cursor into the previous paragraph and type M-q.
862 1124
863 1125
864 * SEARCHING 1126 * SEARCHING
865 ----------- 1127 -----------
866 1128
867 Emacs can do searches for strings (these are groups of contiguous 1129 XEmacs can do searches for strings (these are groups of contiguous
868 characters or words) either forward through the text or backward 1130 characters or words) either forward through the text or backward
869 through it. Searching for a string is a cursor motion command; 1131 through it. Searching for a string is a cursor motion command;
870 it moves the cursor to the next place where that string appears. 1132 it moves the cursor to the next place where that string appears.
871 1133
872 The Emacs search command is different from the search commands 1134 The XEmacs search command is different from the search commands
873 of most editors, in that it is "incremental". This means that the 1135 of most editors, in that it is "incremental". This means that the
874 search happens while you type in the string to search for. 1136 search happens while you type in the string to search for.
875 1137
876 The command to initiate a search is C-s for forward search, and C-r 1138 The command to initiate a search is C-s for forward search, and C-r
877 for reverse search. BUT WAIT! Don't try them now. 1139 for reverse search. BUT WAIT! Don't try them now.
878 1140
879 When you type C-s you'll notice that the string "I-search" appears as 1141 When you type C-s you'll notice that the string "I-search" appears as
880 a prompt in the echo area. This tells you that Emacs is in what is 1142 a prompt in the echo area. This tells you that XEmacs is in what is
881 called an incremental search waiting for you to type the thing that 1143 called an incremental search waiting for you to type the thing that
882 you want to search for. <Return> terminates a search. 1144 you want to search for. <Return> terminates a search.
883 1145
884 >> Now type C-s to start a search. SLOWLY, one letter at a time, 1146 >> Now type C-s to start a search. SLOWLY, one letter at a time,
885 type the word 'cursor', pausing after you type each 1147 type the word 'cursor', pausing after you type each
886 character to notice what happens to the cursor. 1148 character to notice what happens to the cursor.
887 Now you have searched for "cursor", once. 1149 Now you have searched for "cursor", once.
888 >> Type C-s again, to search for the next occurrence of "cursor". 1150 >> Type C-s again, to search for the next occurrence of "cursor".
889 >> Now type <Delete> four times and see how the cursor moves. 1151 >> Now type <Backspace> four times and see how the cursor moves.
890 >> Type <RET> to terminate the search. 1152 >> Type <Return> to terminate the search.
891 1153
892 Did you see what happened? Emacs, in an incremental search, tries to 1154 Did you see what happened? XEmacs, in an incremental search, tries to
893 go to the occurrence of the string that you've typed out so far, 1155 go to the occurrence of the string that you've typed out so far,
894 highlighting it for your convenience. To go to the next occurrence of 1156 highlighting it for your convenience. To go to the next occurrence of
895 'cursor' just type C-s again. If no such occurrence exists Emacs 1157 'cursor' just type C-s again. If no such occurrence exists XEmacs
896 beeps and tells you the search is currently "failing", C-g would also 1158 beeps and tells you the search is currently "failing", C-g would also
897 terminate the search. 1159 terminate the search.
898 1160
899 NOTE: On some systems, typing C-s will freeze the screen and you will 1161 NOTE: On some older TTY connections, typing C-s will freeze the screen
900 see no further output from Emacs. This indicates that an operating 1162 and you will see no further output from XEmacs. This indicates that an
901 system "feature" called "flow control" is intercepting the C-s and not 1163 operating system "feature" called "flow control" is intercepting the C-s
902 letting it get through to Emacs. To unfreeze the screen, type C-q. 1164 and not letting it get through to XEmacs. To unfreeze the screen, type
903 Then see the section "Spontaneous Entry to Incremental Search" in the 1165 C-q. Then see the section "Spontaneous Entry to Incremental Search" in
904 Emacs manual for advice on dealing with this "feature". 1166 the XEmacs manual for advice on dealing with this "feature".
905 1167
906 If you are in the middle of an incremental search and type <Delete>, 1168 If you are in the middle of an incremental search and type <Backspace>,
907 you'll notice that the last character in the search string is erased 1169 you'll notice that the last character in the search string is erased
908 and the search backs up to the last place of the search. For 1170 and the search backs up to the last place of the search. For
909 instance, suppose you have typed "c", to search for the first 1171 instance, suppose you have typed "c", to search for the first
910 occurrence of "c". Now if you type "u", the cursor will move 1172 occurrence of "c". Now if you type "u", the cursor will move
911 to the first occurrence of "cu". Now type <Delete>. This erases 1173 to the first occurrence of "cu". Now type <Backspace>. This erases
912 the "u" from the search string, and the cursor moves back to 1174 the "u" from the search string, and the cursor moves back to
913 the first occurrence of "c". 1175 the first occurrence of "c".
914 1176
915 If you are in the middle of a search and type a control or meta 1177 If you are in the middle of a search and type a control or meta
916 character (with a few exceptions--characters that are special in 1178 character (with a few exceptions--characters that are special in
921 something earlier in the text, type C-r instead. Everything that we 1183 something earlier in the text, type C-r instead. Everything that we
922 have said about C-s also applies to C-r, except that the direction of 1184 have said about C-s also applies to C-r, except that the direction of
923 the search is reversed. 1185 the search is reversed.
924 1186
925 1187
926 * MULTIPLE WINDOWS 1188 * MULTIPLE "WINDOWS" (I.E. PANES)
927 ------------------ 1189 ---------------------------------
928 1190
929 One of the nice features of Emacs is that you can display more than one 1191 One of the nice features of XEmacs is that you can split the current
930 window on the screen at the same time. 1192 frame (i.e. window-system window) into more than one pane, or "window"
931 1193 in XEmacs parlance.
932 >> Move the cursor to this line and type C-u 0 C-l. 1194
933 1195 >> Move the cursor to this line and type M-0 C-l (that's zero, not Oh,
934 >> Now type C-x 2 which splits the screen into two windows. 1196 and CONTROL-L, not CONTROL-1).
1197
1198 >> Now type C-x 2 which splits the frame into two windows.
935 Both windows display this tutorial. The cursor stays in the top window. 1199 Both windows display this tutorial. The cursor stays in the top window.
936 1200
937 >> Type C-M-v to scroll the bottom window. 1201 >> Type M-<Next> to scroll the bottom window.
938 (If you do not have a real Meta key, type ESC C-v.) 1202 (C-M-v on TTY's. If you do not have a real META key, type ESC C-v.)
939 1203
940 >> Type C-x o ("o" for "other") to move the cursor to the bottom window. 1204 >> Type C-<Tab> to move the cursor to the bottom window. (Use C-x o -- "o"
941 >> Use C-v and M-v in the bottom window to scroll it. 1205 for "other" -- on TTY's.)
1206
1207 >> Use <Next> and <Prior> in the bottom window to scroll it.
942 Keep reading these directions in the top window. 1208 Keep reading these directions in the top window.
943 1209
944 >> Type C-x o again to move the cursor back to the top window. 1210 >> Type C-<Tab> again to move the cursor back to the top window.
945 The cursor in the top window is just where it was before. 1211 The cursor in the top window is just where it was before.
946 1212
947 You can keep using C-x o to switch between the windows. Each 1213 You can keep using C-<Tab> to switch between the windows. Each
948 window has its own cursor position, but only one window actually 1214 window has its own cursor position, but only one window actually
949 shows the cursor. All the ordinary editing commands apply to the 1215 shows the cursor. All the ordinary editing commands apply to the
950 window that the cursor is in. We call this the "selected window". 1216 window that the cursor is in. We call this the "selected window".
951 1217
952 The command C-M-v is very useful when you are editing text in one 1218 If you have more than two windows, C-<Tab> cycles between them, and
953 window and using the other window just for reference. You can keep 1219 C-Sh-<Tab> (i.e. CONTROL-SHIFT-TAB) in the opposite direction. (There is
954 the cursor always in the window where you are editing, and advance 1220 no TTY equivalent for C-Sh-<Tab>.)
955 through the other window sequentially with C-M-v. 1221
956 1222 The commands M-<Prior> and M-<Next> are very useful when you are editing
957 C-M-v is an example of a CONTROL-META character. If you have a real 1223 text in one window and using the other window just for reference. You
958 META key, you can type C-M-v by holding down both CTRL and META while 1224 can keep the cursor always in the window where you are editing, and
959 typing v. It does not matter whether CTRL or META "comes first," 1225 scroll forward or back through the other window with these commands.
960 because both of these keys act by modifying the characters you type. 1226
961 1227 On TTY's, use C-M-v in place of M-<Next>, and there's no equivalent of
962 If you do not have a real META key, and you use ESC instead, the order 1228 M-<Prior>. C-M-v is an example of a CONTROL-META character. If you
963 does matter: you must type ESC followed by CTRL-v; CTRL-ESC v will not 1229 have a real META key, you can type C-M-v by holding down both CONTROL
964 work. This is because ESC is a character in its own right, not a 1230 and META while typing v. It does not matter whether CONTROL or META
965 modifier key. 1231 "comes first," because both of these keys act by modifying the
1232 characters you type. If you do not have a real META key, and you use
1233 ESC instead, the order does matter: you must type ESC followed by
1234 CONTROL-v, because CONTROL-ESC v will not work. This is because ESC is
1235 a character in its own right, not a modifier key.
966 1236
967 >> Type C-x 1 (in the top window) to get rid of the bottom window. 1237 >> Type C-x 1 (in the top window) to get rid of the bottom window.
968 1238
969 (If you had typed C-x 1 in the bottom window, that would get rid 1239 (If you had typed C-x 1 in the bottom window, that would get rid
970 of the top one. Think of this command as "Keep just one 1240 of the top one. Think of this command as "Keep just one
975 change. You can find a file in each window independently. 1245 change. You can find a file in each window independently.
976 1246
977 Here is another way to use two windows to display two different 1247 Here is another way to use two windows to display two different
978 things: 1248 things:
979 1249
980 >> Type C-x 4 C-f followed by the name of one of your files. 1250 >> Type C-x 4 f followed by the name of one of your files.
981 End with <Return>. See the specified file appear in the bottom 1251 End with <Return>. See the specified file appear in the bottom
982 window. The cursor goes there, too. 1252 window. The cursor goes there, too.
983 1253
984 >> Type C-x o to go back to the top window, and C-x 1 to delete 1254 >> Type C-<Tab> to go back to the top window, and C-x 1 to delete
985 the bottom window. 1255 the bottom window.
1256
1257
1258 * MULTIPLE "FRAMES" (I.E. WINDOW-SYSTEM WINDOWS)
1259 ------------------------------------------------
1260
1261 On window systems, you can also create multiple "frames", or
1262 window-system windows. These exist independently of each other at the
1263 top level, just like separate programs. (There is no support for the MS
1264 Windows feature called MDI, or Multiple Document Interface, where
1265 multiple overlapping child windows exist inside of a single top-level
1266 window.)
1267
1268 The commands for frames are similar to those for windows, but begin with
1269 "C-x 5".
1270
1271 >> Type C-x 5 2 to create a new frame.
1272
1273 >> Move the mouse into it, and click. (On X Windows, you may not need
1274 to click; this depends on the window manager.)
1275
1276 >> Scroll up or down. Note that, just like for XEmacs windows, two frames
1277 can be showing the same buffer but in different positions.
1278
1279 >> Type C-x 2. Note that each frame can have separate windows,
1280 independently of other frames.
1281
1282 >> Type C-x 5 o (or Alt-Tab under MS Windows) to go back to the first frame.
1283 (That's a small Oh, for "other".)
1284
1285 >> Type C-x 5 0 to kill the old frame. (That's a zero.)
1286
1287 >> Note that we're still here! XEmacs will not exit until all frames
1288 are deleted, no matter what order they were created in.
1289
1290 >> Type C-x 1 to get back to one window.
1291
1292 You can also use C-x 5 f to open a file in a new frame, just like C-x 4
1293 f opens a file in a new window in the same frame.
986 1294
987 1295
988 * RECURSIVE EDITING LEVELS 1296 * RECURSIVE EDITING LEVELS
989 -------------------------- 1297 --------------------------
990 1298
991 Sometimes you will get into what is called a "recursive editing 1299 Sometimes you will get into what is called a "recursive editing
992 level". This is indicated by square brackets in the mode line, 1300 level". This is indicated by square brackets in the mode line,
993 surrounding the parentheses around the major mode name. For 1301 surrounding the parentheses around the major mode name. For
994 example, you might see [(Fundamental)] instead of (Fundamental). 1302 example, you might see [(Fundamental)] instead of (Fundamental).
995 1303
996 To get out of the recursive editing level, type ESC ESC ESC. That is 1304 To get out of the recursive editing level, use the all-purpose escape
997 an all-purpose "get out" command. You can also use it for eliminating 1305 mechanism mentioned earlier: ESC ESC. (Remember, it's ESC ESC ESC on
998 extra windows, and getting out of the minibuffer. 1306 TTY's.) You can also use it for eliminating extra windows, canceling a
999 1307 selection, and getting out of the minibuffer.
1000 >> Type M-x to get into a minibuffer; then type ESC ESC ESC to get out. 1308
1309 >> Type M-x to get into a minibuffer; then type ESC ESC to get out.
1001 1310
1002 You cannot use C-g to get out of a recursive editing level. This is 1311 You cannot use C-g to get out of a recursive editing level. This is
1003 because C-g is used for canceling commands and arguments WITHIN the 1312 because C-g is used for canceling commands and arguments WITHIN the
1004 recursive editing level. 1313 recursive editing level.
1005 1314
1006 1315
1007 * GETTING MORE HELP 1316 * GETTING MORE HELP
1008 ------------------- 1317 -------------------
1009 1318
1010 In this tutorial we have tried to supply just enough information to 1319 In this tutorial we have tried to supply just enough information to
1011 get you started using Emacs. There is so much available in Emacs that 1320 get you started using XEmacs. There is so much available in XEmacs that
1012 it would be impossible to explain it all here. However, you may want 1321 it would be impossible to explain it all here. However, you may want
1013 to learn more about Emacs since it has many other useful features. 1322 to learn more about XEmacs since it has many other useful features.
1014 Emacs provides commands for reading documentation about Emacs 1323 XEmacs provides commands for reading documentation about XEmacs
1015 commands. These "help" commands all start with the character 1324 commands. These "help" commands all start with the character
1016 Control-h, which is called "the Help character". 1325 CONTROL-h, which is called "the Help character".
1017 1326
1018 To use the Help features, type the C-h character, and then a 1327 To use the Help features, type the C-h character, and then a
1019 character saying what kind of help you want. If you are REALLY lost, 1328 character saying what kind of help you want. If you are REALLY lost,
1020 type C-h ? and Emacs will tell you what kinds of help it can give. 1329 type C-h ? ? and XEmacs will tell you what kinds of help it can give.
1021 If you have typed C-h and decide you do not want any help, just 1330 If you have typed C-h and decide you do not want any help, just
1022 type C-g to cancel it. 1331 type C-g to cancel it.
1023 1332
1024 (Some sites rebind the character C-h. They really should not do this 1333 (Note for TTY users: Some sites change the meaning of the character C-h.
1025 as a blanket measure, so complain to the system administrator. 1334 They really should not do this as a blanket measure for all users, so you
1026 Meanwhile, if C-h does not display a message about help at the bottom 1335 have grounds to complain to the system administrator. Meanwhile, if C-h
1027 of the screen, try typing M-x help RET instead.) 1336 does not display a message about help at the bottom of the frame, try
1028 1337 typing the F1 key or M-? instead.)
1029 The most basic HELP feature is C-h c. Type C-h, a c, and a 1338
1030 command character or sequence, and Emacs displays a very brief 1339 The most basic HELP feature is C-h c. Type C-h, the character c, and
1340 a command character or sequence; then XEmacs displays a very brief
1031 description of the command. 1341 description of the command.
1032 1342
1033 >> Type C-h c Control-p. 1343 >> Type C-h c <Up>.
1034 The message should be something like 1344 The message should be something like
1035 1345
1036 C-p runs the command previous-line 1346 up runs the command previous-line
1037 1347
1038 This tells you the "name of the function". Function names are used 1348 This tells you the "name of the function". Function names are used
1039 mainly for customizing and extending Emacs. But since function names 1349 mainly for customizing and extending XEmacs. But since function names
1040 are chosen to indicate what the command does, they can serve also as 1350 are chosen to indicate what the command does, they can serve also as
1041 very brief documentation--sufficient to remind you of commands you 1351 very brief documentation--sufficient to remind you of commands you
1042 have already learned. 1352 have already learned.
1043 1353
1044 Multi-character commands such as C-x C-s and (if you have no META or 1354 Multi-character commands such as C-x C-s and <ESC>v are also allowed
1045 EDIT or ALT key) <ESC>v are also allowed after C-h c. 1355 after C-h c.
1046 1356
1047 To get more information about a command, use C-h k instead of C-h c. 1357 To get more information about a command, use C-h k instead of C-h c.
1048 1358
1049 >> Type C-h k Control-p. 1359 >> Type C-h k <Up>.
1050 1360
1051 This displays the documentation of the function, as well as its 1361 This displays the documentation of the function, as well as its
1052 name, in an Emacs window. When you are finished reading the 1362 name, in an XEmacs window. When you are finished reading the
1053 output, type q to get rid of the help text. 1363 output, type q to get rid of the help text.
1054 1364
1055 Here are some other useful C-h options: 1365 Here are some other useful C-h options:
1056 1366
1057 C-h f Describe a function. You type in the name of the 1367 C-h f Describe a function. You type in the name of the
1058 function. 1368 function.
1059 1369
1060 >> Try typing C-h f previous-line<Return>. 1370 >> Try typing C-h f previous-line<Return>.
1061 This prints all the information Emacs has about the 1371 This displays all the information XEmacs has about the
1062 function which implements the C-p command. 1372 function which implements the <Up> command.
1063 1373
1064 C-h a Hyper Apropos. Type in a keyword and Emacs will list 1374 A similar command C-h v displays the documentation of variables whose
1375 values you can set to customize XEmacs behavior. You need to type in
1376 the name of the variable when XEmacs prompts for it.
1377
1378 C-h a Hyper Apropos. Type in a keyword and XEmacs will list
1065 all the functions and variables whose names contain 1379 all the functions and variables whose names contain
1066 that keyword. For commands that can be invoked with 1380 that keyword. For commands that can be invoked with
1067 Meta-x, an asterisk will be displayed to the left. 1381 META-x, an asterisk will be displayed to the left.
1068 1382
1069 >> Type C-h a newline<Return>. 1383 >> Type C-h a newline<Return>.
1070 1384
1071 This displays a list of all functions and variables with "newline" in 1385 This displays a list of all functions and variables with "newline" in
1072 their names. Press <Return> or click the middle mouse button to find 1386 their names. Press <Return> or click the middle mouse button to find
1073 out more about a function or variable. Type `q' to exit hyper-apropos. 1387 out more about a function or variable. Type `q' to exit hyper-apropos.
1074 1388
1389 C-h i Read On-line Manuals (a.k.a. Info). This command puts
1390 you into a special buffer called `*info*' where you can
1391 read on-line manuals for the XEmacs packages installed
1392 on your system. Type m xemacs <Return> to read the
1393 XEmacs manual. If you have never before used Info, type
1394 ? and XEmacs will take you on a guided tour of Info mode
1395 facilities. Once you are through with this tutorial,
1396 you should consult the XEmacs Info manual as your
1397 primary documentation.
1075 1398
1076 * CONCLUSION 1399 * CONCLUSION
1077 ------------ 1400 ------------
1078 1401
1079 Remember, to exit Emacs permanently use C-x C-c. To exit to a shell 1402 Remember, to exit XEmacs permanently use the menu item "File->Exit XEmacs",
1080 temporarily, so that you can come back in, use C-z. (under X, this 1403 or type C-x C-c. On TTY's, to temporarily exit to a shell, so that you can
1081 iconifies the current Emacs frame.) 1404 come back in, use C-z.
1082 1405
1083 This tutorial is meant to be understandable to all new users, so if 1406 This tutorial is meant to be understandable to all new users, so if you
1084 you found something unclear, don't sit and blame yourself - complain! 1407 found something unclear, don't sit and blame yourself - complain!
1085 1408
1086 1409
1087 COPYING 1410 COPYRIGHTS, COPYING, ORIGINS
1088 ------- 1411 ----------------------------
1089 1412
1090 This tutorial descends from a long line of Emacs tutorials 1413 Copyright (c) 1985, 1996 Free Software Foundation.
1091 starting with the one written by Stuart Cracraft for the original Emacs. 1414 Copyright (c) 2001 Ben Wing.
1092 Ben Wing updated the tutorial for X Windows. Martin Buchholz and 1415 This tutorial is synched with FSF 21.0.106.
1093 Hrvoje Niksic added more corrections for XEmacs. 1416
1094 1417 This tutorial descends from a long line of Emacs tutorials starting with
1095 This version of the tutorial, like GNU Emacs, is copyrighted, and 1418 the one written by Stuart Cracraft for the original Emacs. Ben Wing
1419 updated the tutorial for X Windows. Martin Buchholz and Hrvoje Niksic
1420 added more corrections for XEmacs. Ben Wing later synched up to FSF
1421 21.0.105 and rehashed many sections to match the current XEmacs norms.
1422
1423 This version of the tutorial, like XEmacs, is copyrighted, and
1096 comes with permission to distribute copies on certain conditions: 1424 comes with permission to distribute copies on certain conditions:
1097
1098 Copyright (c) 1985, 1996 Free Software Foundation
1099 1425
1100 Permission is granted to anyone to make or distribute verbatim copies 1426 Permission is granted to anyone to make or distribute verbatim copies
1101 of this document as received, in any medium, provided that the 1427 of this document as received, in any medium, provided that the
1102 copyright notice and permission notice are preserved, 1428 copyright notice and permission notice are preserved,
1103 and that the distributor grants the recipient permission 1429 and that the distributor grants the recipient permission
1106 Permission is granted to distribute modified versions 1432 Permission is granted to distribute modified versions
1107 of this document, or of portions of it, 1433 of this document, or of portions of it,
1108 under the above conditions, provided also that they 1434 under the above conditions, provided also that they
1109 carry prominent notices stating who last altered them. 1435 carry prominent notices stating who last altered them.
1110 1436
1111 The conditions for copying Emacs itself are more complex, but in the 1437 The conditions for copying XEmacs itself are more complex, but in the
1112 same spirit. Please read the file COPYING and then do give copies of 1438 same spirit. Please read the file COPYING and then do give copies of
1113 GNU Emacs to your friends. Help stamp out software obstructionism 1439 XEmacs to your friends. Help stamp out software obstructionism
1114 ("ownership") by using, writing, and sharing free software! 1440 ("ownership") by using, writing, and sharing free software!