Mercurial > hg > xemacs-beta
annotate etc/TUTORIAL @ 5936:574f0cded429 cygwin
try to replace all nnnL or nnnUL constants with EMACS_[U]INT
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sun, 13 Dec 2015 13:22:58 +0000 |
parents | c6b1500299a7 |
children |
rev | line source |
---|---|
771 | 1 You are looking at the XEmacs tutorial. See end for copyrights and conditions. |
428 | 2 |
771 | 3 XEmacs commands generally involve the CONTROL key (sometimes labeled |
4 CTRL or CTL) or the META key. "META" is a traditional Emacs term; on | |
2679 | 5 most keyboards, the key is labeled "Alt". (On Sun keyboards, the META |
6 key is labeled with a diamond, and is *NOT* the Alt key, which also | |
771 | 7 exists.) On some TTY's, there is no META key; in this case, use ESC. |
8 Rather than write out META or CONTROL each time we want you to prefix a | |
9 character, we'll use the following abbreviations: | |
428 | 10 |
11 C-<chr> means hold the CONTROL key while typing the character <chr> | |
12 Thus, C-f would be: hold the CONTROL key and type f. | |
771 | 13 M-<chr> means hold the META (i.e. Alt) key down while typing <chr>. |
14 (See above for Sun keyboards and TTY's.) | |
15 | |
16 Important note: to end the XEmacs session, type C-x C-c. (Two characters.) | |
428 | 17 |
771 | 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 | |
428 | 26 The characters ">>" at the left margin indicate directions for you to |
27 try using a command. For instance: | |
771 | 28 |
29 >> Try typing <Next> and then <Prior>, a few times. (Or C-v and M-v, | |
30 on TTY's.) | |
31 | |
32 Note that there is an overlap of two lines when you move from screen to | |
33 screen; this provides some continuity so you can continue reading the text. | |
34 | |
35 In general, every "cursor key" (the arrows and similar keys set off to the | |
36 right side of the keyboard) has an equivalent binding that uses only the | |
37 alphanumeric keys in combination with CONTROL and/or META, so that TTY | |
38 users can use XEmacs. | |
428 | 39 |
771 | 40 (In fact, in olden days, this "older way" was the only way to do things, |
41 and you will still often see references to these keys as the "recommended" | |
42 way of doing things. We don't actually recommend that you use these older | |
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 | |
2679 | 48 substitute them whenever we mention a cursor key.) |
428 | 49 |
771 | 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". | |
428 | 60 |
61 | |
62 * SUMMARY | |
63 --------- | |
64 | |
65 The following commands are useful for viewing screenfuls: | |
66 | |
771 | 67 <Next> Move forward one screenful (C-v on TTY's) |
68 <Prior> Move backward one screenful (M-v on TTY's) | |
69 C-l Clear frame and redisplay all the text, | |
70 moving the text around the cursor | |
71 to the center of the window. | |
72 (That's CONTROL-L, not CONTROL-1.) | |
428 | 73 |
5686
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
2679
diff
changeset
|
74 >> Find the cursor, and note what text is near it. Then type C-l. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
2679
diff
changeset
|
75 Find the cursor again and notice that the same text is still near |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
2679
diff
changeset
|
76 the cursor, but now it is in the center of the screen. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
2679
diff
changeset
|
77 If you press C-l again, this piece of text will move to the top of |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
2679
diff
changeset
|
78 the screen. Press C-l again, and it moves to the bottom. |
428 | 79 |
771 | 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 | |
2679 | 110 a key labeled with a diamond, and *NOT* the Alt key, which |
771 | 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 | |
2679 | 132 keys, <Next> and <Prior> (often labeled PgUp and PgDn), |
771 | 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, | |
2679 | 163 toolbar items, local variables, subprocesses, abbreviations, |
771 | 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 | |
428 | 204 * BASIC CURSOR CONTROL |
205 ---------------------- | |
206 | |
771 | 207 The first thing that you need to know is how to move around from place |
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? | |
428 | 211 |
212 There are several ways you can do this. The most basic way is to use | |
771 | 213 the arrow keys, which we refer to as <Left>, <Right>, <Up>, and <Down>. |
214 Each of these commands moves the cursor one row or column in a | |
215 particular direction on the screen. | |
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: | |
428 | 223 |
224 Previous line, C-p | |
225 : | |
226 : | |
227 Backward, C-b .... Current cursor position .... Forward, C-f | |
228 : | |
229 : | |
230 Next line, C-n | |
231 | |
771 | 232 >> Move the cursor to the line in the middle of that diagram using <Down> |
233 or <Up>. Then type C-l to see the whole diagram centered in the window. | |
234 (Remember, TTY users should substitute the appropriate bindings whenever | |
235 necessary. In this case, use C-n and C-p.) | |
428 | 236 |
771 | 237 Note the mnemonic significance of the TTY bindings: P for previous, N |
238 for next, B for backward and F for forward. If you're on a TTY, you | |
239 really should spend some time now etching these cursor bindings into | |
240 your brain. These cursor positioning commands are the most fundamental | |
241 way to move around and you'll be using them ALL the time, so you will be | |
242 completely lost without them. | |
243 | |
244 Even if you are on a window system and are not forced to learn these | |
245 bindings, you should try to memorize at least these four commands and in | |
246 particular their associated words, since variations on them show up in | |
247 many different keyboard commands, and knowing what they stand for can be | |
248 of tremendous help. | |
428 | 249 |
771 | 250 |
251 >> Do a few <Down>'s to bring the cursor down to this line. | |
428 | 252 |
771 | 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. | |
428 | 255 |
771 | 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. | |
428 | 259 |
771 | 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 | |
428 | 267 the end of the previous line. This is because it moves back |
268 across the Newline character. | |
269 | |
771 | 270 <Right> can move across a Newline just like <Left>. |
428 | 271 |
771 | 272 >> Do a few more <Left>'s, so you get a feel for where the cursor is. |
273 Then do <Right>'s to return to the end of the line. | |
274 Then do one more <Right> to move to the following line. | |
428 | 275 |
771 | 276 When you move past the top or bottom of the window, the text beyond |
428 | 277 the edge shifts onto the screen. This is called "scrolling". It |
771 | 278 enables XEmacs to move the cursor to the specified place in the text |
428 | 279 without moving it off the screen. |
280 | |
771 | 281 >> Try to move the cursor off the bottom of the window with <Down>, and |
428 | 282 see what happens. |
283 | |
771 | 284 If moving by characters is too slow, you can move by words. C-<Right> |
285 (CONTROL + right-arrow key) moves forward a word and C-<Left> moves back a | |
2679 | 286 word. On TTY's, use M-f instead of C-<Right> and M-b instead of C-<Left>. |
428 | 287 |
771 | 288 >> Type a few C-<Right>'s and C-<Left>'s. |
428 | 289 |
771 | 290 When you are in the middle of a word, C-<Right> moves to the end of the |
291 word. When you are in whitespace between words, C-<Right> moves to the | |
292 end of the following word. C-<Left> works likewise in the opposite | |
293 direction. | |
428 | 294 |
771 | 295 >> Type C-<Right> and C-<Left> a few times, interspersed with <Right>'s and |
296 <Left>'s so that you can observe the action of C-<Right> and C-<Left> | |
297 from various places inside and between words. | |
428 | 298 |
771 | 299 Notice the parallel between <Right> and <Left> on the one hand, and |
300 C-<Right> and C-<Left> on the other hand. Also notice the parallel | |
301 between C-f and C-p on the one hand, and M-f and M-p on the other hand. | |
302 XEmacs tries fairly hard to maintain parallelism in keyboard commands to | |
303 make them easier to remember, and generally adding CONTROL or META to an | |
304 operation makes it "more so". META goes beyond CONTROL, often making | |
305 the units of movement less basic in the process -- words vs. characters, | |
306 balanced parenthetical expressions vs. words, or sentences vs. lines. | |
428 | 307 |
771 | 308 Other important cursor motion commands are <Home> and <End> (beginning |
309 and end of the line), and C-<Home> and C-<End> (beginning and end of the | |
310 whole text). Note again the parallelism just mentioned. | |
428 | 311 |
771 | 312 On TTY's, use C-a and C-e for beginning and end of line, and M-< and M-> |
313 for beginning and end of text. (If it helps, think of A as the first | |
314 letter of the alphabet, and E as standing for "end".) Note that the < | |
315 and > chars (Less-than and Greater-than) are above the comma and period | |
316 on most keyboards, so you'll have to use the SHIFT key in conjunction | |
317 with META. If you have no META, the order is very important: Type ESC | |
318 first, then type < or >. | |
428 | 319 |
771 | 320 >> Move the cursor to this line, then try <Home> and <End> a few times. |
428 | 321 |
771 | 322 >> (Read this entire entry before doing anything!) Try C-<Home> now, to |
323 move to the beginning of the tutorial. Then use <Next> repeatedly to | |
324 move back here. | |
428 | 325 |
326 >> Try all of these commands now a few times for practice. | |
327 These are the most often used commands. | |
328 | |
771 | 329 Here is a summary of simple cursor-moving operations. Don't worry if you |
330 can't remember everything; you can always move back to this table for | |
331 reference. | |
332 | |
333 KEYSTROKE: SEQUENCE TTY: | |
334 | |
335 <Prior> (PgUp) Move backward a screen M-v | |
336 <Next> (PgDn) Move forward a screen C-v | |
428 | 337 |
771 | 338 <Left> Move backward a character C-b |
339 <Right> Move forward a character C-f | |
340 | |
341 C-<Left> Move backward a word M-b | |
342 C-<Right> Move forward a word M-f | |
428 | 343 |
771 | 344 <Up> Move to previous line C-p |
345 <Down> Move to next line C-n | |
428 | 346 |
771 | 347 C-<Up> Move 6 lines up |
348 C-<Down> Move 6 lines down | |
428 | 349 |
771 | 350 <Home> Move to beginning of line C-a |
351 <End> Move to end of line C-e | |
352 | |
353 C-<Home> Move to beginning of text M-< | |
354 C-<End> Move to end of text M-> | |
355 | |
356 | |
357 * PREFIX ARGUMENTS | |
358 ------------------ | |
428 | 359 |
771 | 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. | |
428 | 368 |
771 | 369 For instance, M-8 <Right> moves forward eight characters. |
428 | 370 |
771 | 371 >> Try using <Down> or <Up> with a numeric argument, to move the cursor |
428 | 372 to a line near this one with just one command. |
373 | |
771 | 374 Sometimes, commands use the term "prefix argument" to refer not to a |
375 numeric argument, but to just a flag that makes the command do something | |
376 different if given. (We haven't encountered any such commands so far.) | |
377 For such commands, the flag is normally given by typing C-u before the | |
378 command, but generally you can also specify any numeric argument -- the | |
379 actual number makes no difference. | |
428 | 380 |
771 | 381 |
382 * SCROLLBARS | |
383 ------------ | |
428 | 384 |
771 | 385 Unless you are on a TTY, there is probably a rectangular area called a |
386 scroll bar at the right hand side of the XEmacs window. You can scroll the | |
387 text by manipulating the scrollbar with the mouse. | |
428 | 388 |
771 | 389 The scrollbar has a button in the middle of it, called a thumb. The |
390 relative position of this thumb within the rectangle indicates where you | |
391 are within the file. As you scroll up or down with the cursor keys, the | |
392 thumb will follow. | |
428 | 393 |
771 | 394 >> Try holding down the left button on the thumb and moving the mouse up |
395 and down. You'll see that the text scrolls up and down as you move the | |
396 mouse. (NOTE: Some scrollbars, such as the Athena scrollbars under X | |
397 Windows, work differently. On these, you will have to use the middle | |
398 button, not the left one.) | |
428 | 399 |
771 | 400 >> Try clicking the left button in the area above the thumb. This should |
401 scroll the text up by a screenful. Similarly, clicking the button below | |
402 the thumb will scroll down by a screenful. (NOTE: Under Athena, things | |
403 work differently.) Holding the button down will cause the text to | |
404 repeatedly scroll by a screenful. | |
405 | |
406 >> Most scrollbars have arrows at the top and bottom of the rectangle. | |
407 Clicking on these will scroll the text up or down by a line, and holding | |
408 the button down will cause the text to repeatedly scroll by a line. | |
428 | 409 |
410 | |
771 | 411 * USING THE MENU |
412 ---------------- | |
413 | |
414 Unless you are on a TTY, you will notice a menubar at the top of the | |
415 XEmacs frame. You can use this menubar to access all the most common | |
416 XEmacs commands, such as "open a file". You will find this easier at | |
417 first, because you don't need to remember the keystrokes necessary to | |
418 access any particular command. Once you are comfortable with XEmacs, it | |
419 will be easy to begin using the keyboard commands because each menu item | |
420 with a corresponding keyboard command has the command listed next to it. | |
421 | |
422 Note that there are many items in the menubar that have no exact | |
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". | |
428 | 431 |
771 | 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. | |
428 | 440 |
771 | 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. | |
428 | 453 |
454 | |
771 | 455 * WHEN XEMACS IS HUNG OR IN SOME STRANGE MODE |
456 --------------------------------------------- | |
428 | 457 |
771 | 458 If XEmacs stops responding to your commands, you can stop it safely by |
428 | 459 typing C-g. You can use C-g to stop a command which is taking too |
460 long to execute. | |
461 | |
462 You can also use C-g to discard a numeric argument or the beginning of | |
463 a command that you do not want to finish. | |
464 | |
771 | 465 >> Type M-100 to make a numeric arg of 100 (remember, this means hold |
466 down META and type 100, or type ESC 1 0 0), then type C-g. Now type | |
467 <Right>. It should move just one character, because you canceled the | |
468 argument with C-g. | |
428 | 469 |
771 | 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, | |
2679 | 477 each invocation of ESC ESC will get rid of one, so keep repeating until |
771 | 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. | |
428 | 481 |
482 | |
483 * DISABLED COMMANDS | |
484 ------------------- | |
485 | |
771 | 486 Some XEmacs commands are "disabled" so that beginning users cannot use |
428 | 487 them by accident. |
488 | |
771 | 489 If you type one of the disabled commands, XEmacs displays a message |
428 | 490 saying what the command was, and asking you whether you want to go |
491 ahead and execute the command. | |
492 | |
771 | 493 If you really want to try the command, type <Space> in answer to the |
428 | 494 question. Normally, if you do not want to execute the disabled |
495 command, answer the question with "n". | |
496 | |
497 >> Type `C-x n p' (which is a disabled command), | |
498 then type n to answer the question. | |
499 | |
500 | |
771 | 501 * "WINDOWS", I.E. PANES |
502 ----------------------- | |
428 | 503 |
771 | 504 XEmacs can have several panes (i.e. non-overlapping divisions of a window |
505 or a TTY screen), each displaying its own text. For historical reasons, | |
506 these panes are called "windows", and what we normally think of as a | |
507 window is called a "frame". XEmacs can also have multiple "frames"; this | |
508 is described later. From now on, we omit the quotes around the XEmacs | |
509 terms, and if we need to use "window" in the standard sense, we will say | |
510 "window-system window". | |
428 | 511 |
771 | 512 At this stage it is better not to go too deeply into the techniques of |
513 using multiple windows. But you do need to know how to get rid of extra | |
514 windows that may appear to display help or output from certain commands. | |
515 Most of the time, your cursor will be in the new window; if this is the | |
516 case, simply type q. Alternatively, you can type | |
428 | 517 |
771 | 518 C-x 0 Delete window. |
428 | 519 |
771 | 520 That is, CONTROL-x followed by the digit 0. This command is unlike the |
521 other commands you have learned in that it consists of two characters. It | |
522 starts with the character CONTROL-x. There is a whole series of commands | |
523 that start with CONTROL-x; many of them have to do with windows, files, | |
524 buffers, and related things. These commands are two, three or four | |
525 characters long. | |
428 | 526 |
771 | 527 >> Move the cursor to this line and type M-0 C-l. |
528 (That's a zero, not an Oh.) | |
529 >> Type CONTROL-h k CONTROL-f. | |
530 See how this window shrinks, while a new one appears | |
531 to display documentation on the CONTROL-f command. | |
532 | |
533 >> Type q and see the documentation listing window disappear. | |
428 | 534 |
771 | 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.") | |
428 | 539 |
540 | |
541 * INSERTING AND DELETING | |
542 ------------------------ | |
543 | |
771 | 544 If you want to insert text, just type the text. Characters which you can |
545 see, such as A, 7, *, etc. are taken by XEmacs as text and inserted | |
546 immediately. Type <Return> (the carriage-return key) to insert a Newline | |
547 character. | |
428 | 548 |
771 | 549 You can delete the last character you typed by typing <Backspace>. |
550 <Backspace> is a key on the keyboard, which may be labeled simply with a | |
551 left arrow sign. | |
428 | 552 |
771 | 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 | |
428 | 560 current cursor position. |
561 | |
562 >> Do this now--type a few characters, then delete them | |
771 | 563 by typing <Backspace> a few times. Don't worry about this file |
428 | 564 being changed; you will not alter the master tutorial. This is |
565 your personal copy of it. | |
566 | |
771 | 567 When a line of text gets too big for one line on the window, the line of |
568 text is "continued" onto a second window line. An arrow at the right | |
569 margin that hooks down and to the left (or a backslash ("\") on TTY's) | |
570 indicates a line which has been continued. | |
428 | 571 |
572 >> Insert text until you reach the right margin, and keep on inserting. | |
573 You'll see a continuation line appear. | |
574 | |
771 | 575 >> Use <Backspace>s to delete the text until the line fits on one window |
428 | 576 line again. The continuation line goes away. |
577 | |
578 You can delete a Newline character just like any other character. | |
579 Deleting the Newline character between two lines merges them into | |
580 one line. If the resulting combined line is too long to fit in the | |
771 | 581 window width, it will be displayed with a continuation line. |
428 | 582 |
771 | 583 >> Move the cursor to the beginning of a line and type <Backspace>. This |
428 | 584 merges that line with the previous line. |
585 | |
586 >> Type <Return> to reinsert the Newline you deleted. | |
587 | |
771 | 588 Remember that most XEmacs commands can be given a repeat count; |
428 | 589 this includes text characters. Repeating a text character inserts |
590 it several times. | |
591 | |
771 | 592 >> Try that now -- type M-8 * to insert ********. |
428 | 593 |
594 You've now learned the most basic way of typing something in | |
771 | 595 XEmacs and correcting errors. You can delete by words or lines |
428 | 596 as well. Here is a summary of the delete operations: |
597 | |
771 | 598 <Backspace> delete the character just before the cursor |
599 <Delete> delete the next character after the cursor | |
600 C-d same as <Delete> but works on TTY's | |
601 | |
602 M-<Backspace> cut ("kill") the word immediately before the cursor | |
603 M-<Delete> cut ("kill") the next word after the cursor | |
604 M-d same as M-<Delete> but works on TTY's | |
605 | |
606 C-k cut ("kill") from the cursor position to end of line | |
607 M-k cut ("kill") to the end of the current sentence | |
608 | |
609 Notice again the parallelism with no modifier vs. CONTROL vs. META that | |
610 was mentioned earlier -- although the parallels are not perfect. | |
428 | 611 |
771 | 612 (In the violent old days when Emacs first began, removing text that |
613 could later be re-inserted was called "killing", and re-inserting was | |
614 called "yanking" -- evidently the designers of Emacs must have been | |
615 thinking of role-playing games, where killed characters could be easily | |
616 resurrected with the wave [yank?] of a magic wand. In the more genteel | |
617 [and realistic] times we live in, the preferred terms are "cut" and | |
618 "paste".) | |
428 | 619 |
771 | 620 You can also kill any part of the buffer with one uniform method. Under |
621 window systems, the preferred method is to move to one end of that part, | |
622 hold the SHIFT key down, and use the cursor keys to move to the other | |
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. | |
428 | 629 |
771 | 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. | |
428 | 638 |
771 | 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. | |
428 | 646 |
771 | 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. | |
428 | 662 |
663 >> Move the cursor to the beginning of a line which is not empty. | |
664 Then type C-k to kill the text on that line. | |
665 >> Type C-k a second time. You'll see that it kills the Newline | |
666 which follows that line. | |
667 | |
668 Note that a single C-k kills the contents of the line, and a second | |
771 | 669 C-k kills the line itself, and makes all the other lines move up. C-k |
428 | 670 treats a numeric argument specially: it kills that many lines AND |
771 | 671 their contents. This is not mere repetition. M-2 C-k kills two |
428 | 672 lines and their newlines; typing C-k twice would not do that. |
673 | |
771 | 674 Bringing back killed text is called "yanking". (Think of it as |
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. | |
428 | 683 |
684 >> Try it; type C-y to yank the text back. | |
685 | |
771 | 686 If you do several C-k's in a row, all of the killed text is saved |
687 together, so that one C-y will yank all of the lines at once. | |
428 | 688 |
689 >> Do this now, type C-k several times. | |
690 | |
691 Now to retrieve that killed text: | |
692 | |
693 >> Type C-y. Then move the cursor down a few lines and type C-y | |
694 again. You now see how to copy some text. | |
695 | |
696 What do you do if you have some text you want to yank back, and then | |
697 you kill something else? C-y would yank the more recent kill. But | |
698 the previous text is not lost. You can get back to it using the M-y | |
699 command. After you have done C-y to get the most recent kill, typing | |
700 M-y replaces that yanked text with the previous kill. Typing M-y | |
701 again and again brings in earlier and earlier kills. When you have | |
702 reached the text you are looking for, you do not have to do anything to | |
703 keep it. Just go on with your editing, leaving the yanked text where | |
704 it is. | |
705 | |
706 If you M-y enough times, you come back to the starting point (the most | |
707 recent kill). | |
708 | |
709 >> Kill a line, move around, kill another line. | |
710 Then do C-y to get back the second killed line. | |
711 Then do M-y and it will be replaced by the first killed line. | |
712 Do more M-y's and see what you get. Keep doing them until | |
713 the second kill line comes back, and then a few more. | |
714 If you like, you can try giving M-y positive and negative | |
715 arguments. | |
716 | |
717 | |
718 * UNDO | |
719 ------ | |
720 | |
771 | 721 If you make a change to the text, and then decide that it was a mistake, |
722 you can undo the change with the undo command, C-/. (On TTY's, use C-_, | |
723 i.e. CONTROL + underscore, which is normally above the minus sign; | |
724 i.e. you will have to hold the SHIFT key down, as in CONTROL + SHIFT + | |
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.) | |
428 | 728 |
771 | 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 | |
428 | 731 additional command. |
732 | |
733 But there are two exceptions: commands that do not change the text do | |
734 not count (this includes cursor motion commands and scrolling | |
735 command), and self-inserting characters are usually handled in groups | |
771 | 736 of up to 20. (This is to reduce the number of C-/'s you have to |
428 | 737 type to undo insertion of text.) |
738 | |
771 | 739 >> Kill this line with C-k, then type C-/ and it should reappear. |
740 | |
741 A numeric argument to C-/ acts as a repeat count. | |
742 | |
743 If you change your mind and want to redo changes that you've undone, | |
744 issue any command other than Undo (usually people move the cursor), and | |
745 then start undoing again. This will undo your Undo changes; keep | |
746 hitting Undo, and you will eventually undo all the Undo's, and start | |
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. | |
428 | 769 |
771 | 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.) | |
428 | 780 |
771 | 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. | |
428 | 801 |
802 | |
803 * FILES | |
804 ------- | |
805 | |
806 In order to make the text you edit permanent, you must put it in a | |
771 | 807 file. Otherwise, it will go away when your invocation of XEmacs goes |
808 away. In order to put your text in a file, you must "find" the file | |
809 before you enter the text. (This is also called "visiting" the file.) | |
428 | 810 |
811 Finding a file means that you see the contents of the file within | |
771 | 812 XEmacs. In many ways, it is as if you were editing the file itself. |
813 However, the changes you make using XEmacs do not become permanent | |
428 | 814 until you "save" the file. This is so you can avoid leaving a |
815 half-changed file on the system when you do not want to. Even when | |
771 | 816 you save, XEmacs leaves the original file under a changed name in case |
428 | 817 you later decide that your changes were a mistake. |
818 | |
771 | 819 If you look near the bottom of the frame you will see a line that begins |
820 and ends with dashes, and contains the string "XEmacs: TUTORIAL" or | |
821 something like that. This part of the frame normally shows the name of | |
822 the file that you are visiting. Right now, you are visiting a file called | |
823 "TUTORIAL" which is your personal scratch copy of the XEmacs tutorial. | |
824 When you find a file with XEmacs, that file's name will appear in that | |
825 precise spot. | |
428 | 826 |
771 | 827 One special thing about the command for finding a file is that you |
828 have to say what file name you want. We say the command "reads an | |
829 argument from the terminal" (in this case, the argument is the name of | |
830 the file). After you type the command | |
428 | 831 |
832 C-x C-f Find a file | |
833 | |
771 | 834 XEmacs asks you to type the file name. The file name you type appears |
835 on the bottom line of the frame. The bottom line is called the | |
428 | 836 minibuffer when it is used for this sort of input. You can use |
771 | 837 ordinary XEmacs editing commands to edit the file name. |
428 | 838 |
839 While you are entering the file name (or any minibuffer input), | |
840 you can cancel the command with C-g. | |
841 | |
842 >> Type C-x C-f, then type C-g. This cancels the minibuffer, | |
843 and also cancels the C-x C-f command that was using the | |
844 minibuffer. So you do not find any file. | |
845 | |
846 When you have finished entering the file name, type <Return> to | |
847 terminate it. Then C-x C-f command goes to work, and finds the file | |
848 you chose. The minibuffer disappears when the C-x C-f command is | |
849 finished. | |
850 | |
851 In a little while the file contents appear on the screen, and you can | |
852 edit the contents. When you wish to make your changes permanent, | |
853 type the command | |
854 | |
855 C-x C-s Save the file | |
856 | |
771 | 857 This copies the text within XEmacs into the file. The first time you |
858 do this, XEmacs renames the original file to a new name so that it is | |
428 | 859 not lost. The new name is made by adding "~" to the end of the |
860 original file's name. | |
861 | |
771 | 862 When saving is finished, XEmacs displays the name of the file written. |
428 | 863 You should save fairly often, so that you will not lose very much |
864 work if the system should crash. | |
865 | |
866 >> Type C-x C-s, saving your copy of the tutorial. | |
771 | 867 This should show "Wrote ...TUTORIAL" at the bottom of the frame. |
428 | 868 |
771 | 869 NOTE: On some older TTY connections, typing C-s will freeze the screen |
870 and you will see no further output from XEmacs. This indicates that an | |
871 operating system "feature" called "flow control" is intercepting the C-s | |
872 and not letting it get through to XEmacs. To unfreeze the screen, type | |
873 C-q. Then see the section "Spontaneous Entry to Incremental Search" in | |
874 the XEmacs manual for advice on dealing with this "feature". | |
428 | 875 |
876 You can find an existing file, to view it or edit it. You can also | |
877 find a file which does not already exist. This is the way to create a | |
771 | 878 file with XEmacs: find the file, which will start out empty, and then |
428 | 879 begin inserting the text for the file. When you ask to "save" the |
771 | 880 file, XEmacs will really create the file with the text that you have |
428 | 881 inserted. From then on, you can consider yourself to be editing an |
882 already existing file. | |
883 | |
884 | |
885 * BUFFERS | |
886 --------- | |
887 | |
888 If you find a second file with C-x C-f, the first file remains | |
771 | 889 inside XEmacs. You can switch back to it by finding it again with |
890 C-x C-f. This way you can get quite a number of files inside XEmacs. | |
428 | 891 |
892 >> Create a file named "foo" by typing C-x C-f foo <Return>. | |
893 Then insert some text, edit it, and save "foo" by typing C-x C-s. | |
894 Finally, type C-x C-f TUTORIAL <Return> | |
895 to come back to the tutorial. | |
896 | |
771 | 897 XEmacs stores each file's text inside an object called a "buffer". |
898 Finding a file makes a new buffer inside XEmacs. To see a list of the | |
899 buffers that currently exist in your XEmacs job, type | |
428 | 900 |
901 C-x C-b List buffers | |
902 | |
903 >> Try C-x C-b now. | |
904 | |
905 See how each buffer has a name, and it may also have a file name | |
906 for the file whose contents it holds. Some buffers do not correspond | |
907 to files. For example, the buffer named "*Buffer List*" does | |
908 not have any file. It is the buffer which contains the buffer | |
771 | 909 list that was made by C-x C-b. ANY text you see in an XEmacs window |
428 | 910 is always part of some buffer. |
911 | |
771 | 912 >> Type ESC ESC to get rid of the buffer list. (Remember, three ESC's |
913 under TTY's.) | |
428 | 914 |
915 If you make changes to the text of one file, then find another file, | |
771 | 916 this does not save the first file. Its changes remain inside XEmacs, |
428 | 917 in that file's buffer. The creation or editing of the second file's |
918 buffer has no effect on the first file's buffer. This is very useful, | |
919 but it also means that you need a convenient way to save the first | |
920 file's buffer. It would be a nuisance to have to switch back to | |
921 it with C-x C-f in order to save it with C-x C-s. So we have | |
922 | |
923 C-x s Save some buffers | |
924 | |
925 C-x s asks you about each buffer which contains changes that you have | |
926 not saved. It asks you, for each such buffer, whether to save the | |
927 buffer. | |
928 | |
929 >> Insert a line of text, then type C-x s. | |
930 It should ask you whether to save the buffer named TUTORIAL. | |
931 Answer yes to the question by typing "y". | |
932 | |
933 | |
934 * EXTENDING THE COMMAND SET | |
935 --------------------------- | |
936 | |
771 | 937 There are many, many more XEmacs commands than could possibly be put |
938 on all the control and meta characters. XEmacs gets around this with | |
428 | 939 the X (eXtend) command. This comes in two flavors: |
940 | |
941 C-x Character eXtend. Followed by one character. | |
942 M-x Named command eXtend. Followed by a long name. | |
943 | |
944 These are commands that are generally useful but used less than the | |
945 commands you have already learned about. You have already seen two of | |
946 them: the file commands C-x C-f to Find and C-x C-s to Save. Another | |
771 | 947 example is the command to end the XEmacs session--this is the command |
428 | 948 C-x C-c. (Do not worry about losing changes you have made; C-x C-c |
771 | 949 offers to save each changed file before it kills the XEmacs.) |
428 | 950 |
771 | 951 If you have installed the sample init.el file (we highly recommend this, |
952 once you've gotten some familiarity with XEmacs; see "Help->Samples->View | |
953 Sample init.el"), you will find that C-x C-c does not exit XEmacs, but | |
954 instead outputs a message. This is intentional, since C-x C-c is easy to | |
955 hit accidentally. Instead, use the "File->Exit XEmacs" menu item to exit. | |
428 | 956 |
771 | 957 If you are on a TTY, and you want to exit temporarily to execute a shell |
958 command, you should use C-z instead of C-x C-c. Under TTY's, C-z | |
959 "suspends" XEmacs; that is, it returns to the shell but does not destroy | |
960 the XEmacs. In the most common shells, you can resume XEmacs with the | |
961 `fg' command or with `%xemacs'. (On systems which do not implement | |
962 suspending, C-z creates a subshell running under XEmacs to give you the | |
963 chance to run other programs and return to XEmacs afterward; it does not | |
964 truly "exit" from XEmacs. In this case, the shell command `exit' is the | |
965 usual way to get back to XEmacs from the subshell.) | |
428 | 966 |
967 There are many C-x commands. Here is a list of the ones you have learned: | |
968 | |
969 C-x C-f Find file. | |
970 C-x C-s Save file. | |
971 C-x C-b List buffers. | |
771 | 972 C-x C-c Quit XEmacs. |
973 C-x 0 Delete the current window. | |
974 C-x u Undo (TTY version). | |
428 | 975 |
976 Named eXtended commands are commands which are used even less | |
977 frequently, or commands which are used only in certain modes. An | |
978 example is the command replace-string, which globally replaces one | |
771 | 979 string with another. When you type M-x, XEmacs prompts you at the |
980 bottom of the frame with M-x and you should type the name of the | |
981 command; in this case, "replace-string". Just type "repl s<Tab>" and | |
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>. | |
428 | 985 |
986 The replace-string command requires two arguments--the string to be | |
987 replaced, and the string to replace it with. You must end each | |
988 argument with <Return>. | |
989 | |
990 >> Move the cursor to the blank line two lines below this one. | |
991 Then type M-x repl s<Return>changed<Return>altered<Return>. | |
992 | |
993 Notice how this line has changed: you've replaced | |
994 the word c-h-a-n-g-e-d with "altered" wherever it occurred, | |
995 after the initial position of the cursor. | |
996 | |
997 | |
998 * AUTO SAVE | |
999 ----------- | |
1000 | |
1001 When you have made changes in a file, but you have not saved them yet, | |
771 | 1002 they could be lost if your computer crashes. To protect you from this, |
1003 XEmacs periodically writes an "auto save" file for each file that you | |
1004 are editing. The auto save file name has a # at the beginning and the | |
1005 end; for example, if your file is named "hello.c", its auto save file's | |
1006 name is usually "#hello.c#". When you save the file in the normal way, | |
1007 XEmacs deletes its auto save file. | |
428 | 1008 |
1009 If the computer crashes, you can recover your auto-saved editing by | |
1010 finding the file normally (the file you were editing, not the auto | |
771 | 1011 save file) and then typing M-x recover file<Return>. When it asks for |
1012 confirmation, type yes<Return> to go ahead and recover the auto-save | |
428 | 1013 data. |
1014 | |
1015 | |
1016 * ECHO AREA | |
1017 ----------- | |
1018 | |
771 | 1019 If XEmacs sees that you are typing multicharacter commands slowly, it |
1020 shows them to you at the bottom of the frame in an area called the | |
1021 "echo area". The echo area contains the bottom line of the frame. | |
428 | 1022 |
1023 | |
1024 * MODELINE | |
771 | 1025 ---------- |
428 | 1026 |
1027 The line immediately above the echo area it is called the "modeline". | |
1028 The mode line says something like this: | |
1029 | |
1030 --**-XEmacs: TUTORIAL (Fundamental)--L670--58%---------------- | |
1031 | |
771 | 1032 This line gives useful information about the status of XEmacs and |
428 | 1033 the text you are editing. |
1034 | |
1035 You already know what the filename means--it is the file you have | |
1036 found. -NN%-- indicates your current position in the text; it means | |
771 | 1037 that NN percent of the text is above the top of the window. If the |
428 | 1038 top of the file is on the screen, it will say --Top-- instead of |
1039 --00%--. If the bottom of the text is on the screen, it will say | |
1040 --Bot--. If you are looking at text so small that all of it fits on | |
1041 the screen, the mode line says --All--. | |
1042 | |
771 | 1043 The L and digits indicate position in another way: they give the |
1044 current line number of point. | |
1045 | |
428 | 1046 The stars near the front mean that you have made changes to the text. |
1047 Right after you visit or save a file, that part of the mode line shows | |
1048 no stars, just dashes. | |
1049 | |
1050 The part of the mode line inside the parentheses is to tell you what | |
1051 editing modes you are in. The default mode is Fundamental which is | |
1052 what you are using now. It is an example of a "major mode". | |
1053 | |
771 | 1054 XEmacs has many different major modes. Some of them are meant for |
428 | 1055 editing different languages and/or kinds of text, such as Lisp mode, |
1056 Text mode, etc. At any time one and only one major mode is active, | |
1057 and its name can always be found in the mode line just where | |
1058 "Fundamental" is now. | |
1059 | |
1060 Each major mode makes a few commands behave differently. For example, | |
1061 there are commands for creating comments in a program, and since each | |
1062 programming language has a different idea of what a comment should | |
1063 look like, each major mode has to insert comments differently. Each | |
1064 major mode is the name of an extended command, which is how you can | |
1065 switch to that mode. For example, M-x fundamental-mode is a command to | |
1066 switch to Fundamental mode. | |
1067 | |
1068 If you are going to be editing English text, such as this file, you | |
1069 should probably use Text Mode. | |
1070 >> Type M-x text-mode<Return>. | |
1071 | |
771 | 1072 Don't worry, none of the XEmacs commands you have learned changes in |
1073 any great way. But you can observe that C-<Right> and C-<Left> now treat | |
428 | 1074 apostrophes as part of words. Previously, in Fundamental mode, |
771 | 1075 C-<Right> and C-<Left> treated apostrophes as word-separators. |
428 | 1076 |
1077 Major modes usually make subtle changes like that one: most commands | |
1078 do "the same job" in each major mode, but they work a little bit | |
1079 differently. | |
1080 | |
1081 To view documentation on your current major mode, type C-h m. | |
1082 | |
771 | 1083 >> Use M-4 C-l to bring this line near the top of the window. |
428 | 1084 >> Type C-h m, to see how Text mode differs from Fundamental mode. |
1085 >> Type q to remove the documentation from the screen. | |
1086 | |
1087 Major modes are called major because there are also minor modes. | |
771 | 1088 Minor modes are not alternatives to the major modes, just minor |
428 | 1089 modifications of them. Each minor mode can be turned on or off by |
1090 itself, independent of all other minor modes, and independent of your | |
1091 major mode. So you can use no minor modes, or one minor mode, or any | |
1092 combination of several minor modes. | |
1093 | |
1094 One minor mode which is very useful, especially for editing English | |
771 | 1095 text, is Auto Fill mode. When this mode is on, XEmacs breaks the line |
428 | 1096 in between words automatically whenever you insert text and make a |
1097 line that is too wide. | |
1098 | |
1099 You can turn Auto Fill mode on by doing M-x auto-fill-mode<Return>. | |
771 | 1100 When the mode is on, you can turn it off again by doing M-x |
428 | 1101 auto-fill-mode<Return>. If the mode is off, this command turns it on, |
1102 and if the mode is on, this command turns it off. We say that the | |
1103 command "toggles the mode". | |
1104 | |
1105 >> Type M-x auto-fill-mode<Return> now. Then insert a line of "asdf " | |
1106 over again until you see it divide into two lines. You must put in | |
1107 spaces between them because Auto Fill breaks lines only at spaces. | |
1108 | |
1109 The margin is usually set at 70 characters, but you can change it | |
1110 with the C-x f command. You should give the margin setting you want | |
1111 as a numeric argument. | |
1112 | |
771 | 1113 >> Type C-x f with an argument of 20. (M-20 C-x f). |
1114 Then type in some text and see XEmacs fill lines of 20 | |
428 | 1115 characters with it. Then set the margin back to 70 using |
1116 C-x f again. | |
1117 | |
771 | 1118 If you make changes in the middle of a paragraph, Auto Fill mode |
428 | 1119 does not re-fill it for you. |
771 | 1120 To re-fill the paragraph, type M-q (META-q) with the cursor inside |
428 | 1121 that paragraph. |
1122 | |
1123 >> Move the cursor into the previous paragraph and type M-q. | |
1124 | |
1125 | |
1126 * SEARCHING | |
1127 ----------- | |
1128 | |
771 | 1129 XEmacs can do searches for strings (these are groups of contiguous |
428 | 1130 characters or words) either forward through the text or backward |
1131 through it. Searching for a string is a cursor motion command; | |
1132 it moves the cursor to the next place where that string appears. | |
1133 | |
771 | 1134 The XEmacs search command is different from the search commands |
428 | 1135 of most editors, in that it is "incremental". This means that the |
1136 search happens while you type in the string to search for. | |
1137 | |
1138 The command to initiate a search is C-s for forward search, and C-r | |
1139 for reverse search. BUT WAIT! Don't try them now. | |
1140 | |
1141 When you type C-s you'll notice that the string "I-search" appears as | |
771 | 1142 a prompt in the echo area. This tells you that XEmacs is in what is |
428 | 1143 called an incremental search waiting for you to type the thing that |
1144 you want to search for. <Return> terminates a search. | |
1145 | |
1146 >> Now type C-s to start a search. SLOWLY, one letter at a time, | |
1147 type the word 'cursor', pausing after you type each | |
1148 character to notice what happens to the cursor. | |
1149 Now you have searched for "cursor", once. | |
1150 >> Type C-s again, to search for the next occurrence of "cursor". | |
771 | 1151 >> Now type <Backspace> four times and see how the cursor moves. |
1152 >> Type <Return> to terminate the search. | |
428 | 1153 |
771 | 1154 Did you see what happened? XEmacs, in an incremental search, tries to |
428 | 1155 go to the occurrence of the string that you've typed out so far, |
1156 highlighting it for your convenience. To go to the next occurrence of | |
771 | 1157 'cursor' just type C-s again. If no such occurrence exists XEmacs |
428 | 1158 beeps and tells you the search is currently "failing", C-g would also |
1159 terminate the search. | |
1160 | |
771 | 1161 NOTE: On some older TTY connections, typing C-s will freeze the screen |
1162 and you will see no further output from XEmacs. This indicates that an | |
1163 operating system "feature" called "flow control" is intercepting the C-s | |
1164 and not letting it get through to XEmacs. To unfreeze the screen, type | |
1165 C-q. Then see the section "Spontaneous Entry to Incremental Search" in | |
1166 the XEmacs manual for advice on dealing with this "feature". | |
428 | 1167 |
771 | 1168 If you are in the middle of an incremental search and type <Backspace>, |
428 | 1169 you'll notice that the last character in the search string is erased |
1170 and the search backs up to the last place of the search. For | |
1171 instance, suppose you have typed "c", to search for the first | |
1172 occurrence of "c". Now if you type "u", the cursor will move | |
771 | 1173 to the first occurrence of "cu". Now type <Backspace>. This erases |
428 | 1174 the "u" from the search string, and the cursor moves back to |
1175 the first occurrence of "c". | |
1176 | |
1177 If you are in the middle of a search and type a control or meta | |
1178 character (with a few exceptions--characters that are special in | |
1179 a search, such as C-s and C-r), the search is terminated. | |
1180 | |
1181 The C-s starts a search that looks for any occurrence of the search | |
1182 string AFTER the current cursor position. If you want to search for | |
1183 something earlier in the text, type C-r instead. Everything that we | |
1184 have said about C-s also applies to C-r, except that the direction of | |
1185 the search is reversed. | |
1186 | |
1187 | |
771 | 1188 * MULTIPLE "WINDOWS" (I.E. PANES) |
1189 --------------------------------- | |
428 | 1190 |
771 | 1191 One of the nice features of XEmacs is that you can split the current |
1192 frame (i.e. window-system window) into more than one pane, or "window" | |
1193 in XEmacs parlance. | |
428 | 1194 |
771 | 1195 >> Move the cursor to this line and type M-0 C-l (that's zero, not Oh, |
1196 and CONTROL-L, not CONTROL-1). | |
428 | 1197 |
771 | 1198 >> Now type C-x 2 which splits the frame into two windows. |
428 | 1199 Both windows display this tutorial. The cursor stays in the top window. |
1200 | |
771 | 1201 >> Type M-<Next> to scroll the bottom window. |
1202 (C-M-v on TTY's. If you do not have a real META key, type ESC C-v.) | |
428 | 1203 |
771 | 1204 >> Type C-<Tab> to move the cursor to the bottom window. (Use C-x o -- "o" |
1205 for "other" -- on TTY's.) | |
1206 | |
1207 >> Use <Next> and <Prior> in the bottom window to scroll it. | |
428 | 1208 Keep reading these directions in the top window. |
1209 | |
771 | 1210 >> Type C-<Tab> again to move the cursor back to the top window. |
428 | 1211 The cursor in the top window is just where it was before. |
1212 | |
771 | 1213 You can keep using C-<Tab> to switch between the windows. Each |
428 | 1214 window has its own cursor position, but only one window actually |
1215 shows the cursor. All the ordinary editing commands apply to the | |
1216 window that the cursor is in. We call this the "selected window". | |
1217 | |
771 | 1218 If you have more than two windows, C-<Tab> cycles between them, and |
1219 C-Sh-<Tab> (i.e. CONTROL-SHIFT-TAB) in the opposite direction. (There is | |
1220 no TTY equivalent for C-Sh-<Tab>.) | |
1221 | |
1222 The commands M-<Prior> and M-<Next> are very useful when you are editing | |
1223 text in one window and using the other window just for reference. You | |
1224 can keep the cursor always in the window where you are editing, and | |
1225 scroll forward or back through the other window with these commands. | |
428 | 1226 |
771 | 1227 On TTY's, use C-M-v in place of M-<Next>, and there's no equivalent of |
1228 M-<Prior>. C-M-v is an example of a CONTROL-META character. If you | |
1229 have a real META key, you can type C-M-v by holding down both CONTROL | |
1230 and META while typing v. It does not matter whether CONTROL or META | |
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. | |
428 | 1236 |
1237 >> Type C-x 1 (in the top window) to get rid of the bottom window. | |
1238 | |
1239 (If you had typed C-x 1 in the bottom window, that would get rid | |
1240 of the top one. Think of this command as "Keep just one | |
1241 window--the window I am already in.") | |
1242 | |
1243 You do not have to display the same buffer in both windows. If you | |
1244 use C-x C-f to find a file in one window, the other window does not | |
1245 change. You can find a file in each window independently. | |
1246 | |
1247 Here is another way to use two windows to display two different | |
1248 things: | |
1249 | |
771 | 1250 >> Type C-x 4 f followed by the name of one of your files. |
428 | 1251 End with <Return>. See the specified file appear in the bottom |
1252 window. The cursor goes there, too. | |
1253 | |
771 | 1254 >> Type C-<Tab> to go back to the top window, and C-x 1 to delete |
428 | 1255 the bottom window. |
1256 | |
1257 | |
771 | 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. | |
1294 | |
1295 | |
428 | 1296 * RECURSIVE EDITING LEVELS |
1297 -------------------------- | |
1298 | |
1299 Sometimes you will get into what is called a "recursive editing | |
1300 level". This is indicated by square brackets in the mode line, | |
1301 surrounding the parentheses around the major mode name. For | |
1302 example, you might see [(Fundamental)] instead of (Fundamental). | |
1303 | |
771 | 1304 To get out of the recursive editing level, use the all-purpose escape |
1305 mechanism mentioned earlier: ESC ESC. (Remember, it's ESC ESC ESC on | |
1306 TTY's.) You can also use it for eliminating extra windows, canceling a | |
1307 selection, and getting out of the minibuffer. | |
428 | 1308 |
771 | 1309 >> Type M-x to get into a minibuffer; then type ESC ESC to get out. |
428 | 1310 |
1311 You cannot use C-g to get out of a recursive editing level. This is | |
1312 because C-g is used for canceling commands and arguments WITHIN the | |
1313 recursive editing level. | |
1314 | |
1315 | |
1316 * GETTING MORE HELP | |
1317 ------------------- | |
1318 | |
1319 In this tutorial we have tried to supply just enough information to | |
771 | 1320 get you started using XEmacs. There is so much available in XEmacs that |
428 | 1321 it would be impossible to explain it all here. However, you may want |
771 | 1322 to learn more about XEmacs since it has many other useful features. |
1323 XEmacs provides commands for reading documentation about XEmacs | |
428 | 1324 commands. These "help" commands all start with the character |
771 | 1325 CONTROL-h, which is called "the Help character". |
428 | 1326 |
1327 To use the Help features, type the C-h character, and then a | |
1328 character saying what kind of help you want. If you are REALLY lost, | |
771 | 1329 type C-h ? ? and XEmacs will tell you what kinds of help it can give. |
428 | 1330 If you have typed C-h and decide you do not want any help, just |
1331 type C-g to cancel it. | |
1332 | |
771 | 1333 (Note for TTY users: Some sites change the meaning of the character C-h. |
1334 They really should not do this as a blanket measure for all users, so you | |
1335 have grounds to complain to the system administrator. Meanwhile, if C-h | |
1336 does not display a message about help at the bottom of the frame, try | |
1337 typing the F1 key or M-? instead.) | |
428 | 1338 |
771 | 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 | |
428 | 1341 description of the command. |
1342 | |
771 | 1343 >> Type C-h c <Up>. |
428 | 1344 The message should be something like |
1345 | |
771 | 1346 up runs the command previous-line |
428 | 1347 |
1348 This tells you the "name of the function". Function names are used | |
771 | 1349 mainly for customizing and extending XEmacs. But since function names |
428 | 1350 are chosen to indicate what the command does, they can serve also as |
1351 very brief documentation--sufficient to remind you of commands you | |
1352 have already learned. | |
1353 | |
771 | 1354 Multi-character commands such as C-x C-s and <ESC>v are also allowed |
1355 after C-h c. | |
428 | 1356 |
1357 To get more information about a command, use C-h k instead of C-h c. | |
1358 | |
771 | 1359 >> Type C-h k <Up>. |
428 | 1360 |
1361 This displays the documentation of the function, as well as its | |
771 | 1362 name, in an XEmacs window. When you are finished reading the |
428 | 1363 output, type q to get rid of the help text. |
1364 | |
1365 Here are some other useful C-h options: | |
1366 | |
1367 C-h f Describe a function. You type in the name of the | |
1368 function. | |
1369 | |
1370 >> Try typing C-h f previous-line<Return>. | |
771 | 1371 This displays all the information XEmacs has about the |
1372 function which implements the <Up> command. | |
428 | 1373 |
771 | 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 | |
428 | 1379 all the functions and variables whose names contain |
631 | 1380 that keyword. For commands that can be invoked with |
771 | 1381 META-x, an asterisk will be displayed to the left. |
428 | 1382 |
1383 >> Type C-h a newline<Return>. | |
1384 | |
1385 This displays a list of all functions and variables with "newline" in | |
1386 their names. Press <Return> or click the middle mouse button to find | |
1387 out more about a function or variable. Type `q' to exit hyper-apropos. | |
1388 | |
771 | 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. | |
428 | 1398 |
1399 * CONCLUSION | |
1400 ------------ | |
1401 | |
771 | 1402 Remember, to exit XEmacs permanently use the menu item "File->Exit XEmacs", |
1403 or type C-x C-c. On TTY's, to temporarily exit to a shell, so that you can | |
1404 come back in, use C-z. | |
428 | 1405 |
771 | 1406 This tutorial is meant to be understandable to all new users, so if you |
1407 found something unclear, don't sit and blame yourself - complain! | |
428 | 1408 |
1409 | |
771 | 1410 COPYRIGHTS, COPYING, ORIGINS |
1411 ---------------------------- | |
1412 | |
5686
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
2679
diff
changeset
|
1413 Copyright (c) 1985, 1996, 2012 Free Software Foundation. |
771 | 1414 Copyright (c) 2001 Ben Wing. |
1415 This tutorial is synched with FSF 21.0.106. | |
428 | 1416 |
771 | 1417 This tutorial descends from a long line of Emacs tutorials starting with |
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. | |
428 | 1422 |
771 | 1423 This version of the tutorial, like XEmacs, is copyrighted, and |
428 | 1424 comes with permission to distribute copies on certain conditions: |
1425 | |
1426 Permission is granted to anyone to make or distribute verbatim copies | |
1427 of this document as received, in any medium, provided that the | |
1428 copyright notice and permission notice are preserved, | |
1429 and that the distributor grants the recipient permission | |
1430 for further redistribution as permitted by this notice. | |
1431 | |
1432 Permission is granted to distribute modified versions | |
1433 of this document, or of portions of it, | |
1434 under the above conditions, provided also that they | |
1435 carry prominent notices stating who last altered them. | |
1436 | |
771 | 1437 The conditions for copying XEmacs itself are more complex, but in the |
428 | 1438 same spirit. Please read the file COPYING and then do give copies of |
771 | 1439 XEmacs to your friends. Help stamp out software obstructionism |
428 | 1440 ("ownership") by using, writing, and sharing free software! |