Mercurial > emacs
annotate etc/TUTORIAL @ 16646:6aeaedabbb62
(Fend_of_line, Fbeginning_of_line): Declared.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Mon, 09 Dec 1996 00:51:15 +0000 |
| parents | 7a3398850d94 |
| children | 6cb6d2fe6999 |
| rev | line source |
|---|---|
| 13 | 1 Copyright (c) 1985 Free Software Foundation, Inc; See end for conditions. |
| 2 You are looking at the Emacs tutorial. | |
| 3 | |
| 14019 | 4 Emacs commands generally involve the CONTROL key (sometimes labeled |
| 5 CTRL or CTL) or the META key (sometimes labeled EDIT or ALT). Rather than | |
|
15291
22f9530a700e
Rephrase the first page to fit on a standard tty screen.
Karl Heuer <kwzh@gnu.org>
parents:
14019
diff
changeset
|
6 write that in full each time, we'll use the following abbreviations: |
| 13 | 7 |
| 8 C-<chr> means hold the CONTROL key while typing the character <chr> | |
| 9 Thus, C-f would be: hold the CONTROL key and type f. | |
|
12647
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
10 M-<chr> means hold the META or EDIT or ALT key down while typing <chr>. |
|
15291
22f9530a700e
Rephrase the first page to fit on a standard tty screen.
Karl Heuer <kwzh@gnu.org>
parents:
14019
diff
changeset
|
11 If there is no META, EDIT or ALT key, instead press and release the |
|
22f9530a700e
Rephrase the first page to fit on a standard tty screen.
Karl Heuer <kwzh@gnu.org>
parents:
14019
diff
changeset
|
12 ESC key and then type <chr>. We write <ESC> for the ESC key. |
| 13 | 13 |
| 14 Important note: to end the Emacs session, type C-x C-c. (Two characters.) | |
| 15 The characters ">>" at the left margin indicate directions for you to | |
| 16 try using a command. For instance: | |
| 17 <<Blank lines inserted here by startup of help-with-tutorial>> | |
| 18 >> Now type C-v (View next screen) to move to the next screen. | |
| 19 (go ahead, do it by depressing the control key and v together). | |
| 20 From now on, you'll be expected to do this whenever you finish | |
| 21 reading the screen. | |
| 22 | |
| 23 Note that there is an overlap when going from screen to screen; this | |
| 24 provides some continuity when moving through the file. | |
| 25 | |
| 26 The first thing that you need to know is how to move around from | |
| 27 place to place in the file. You already know how to move forward a | |
| 28 screen, with C-v. To move backwards a screen, type M-v (depress the | |
| 29 META key and type v, or type <ESC>v if you don't have a META or EDIT | |
| 30 key). | |
| 31 | |
| 32 >> Try typing M-v and then C-v to move back and forth a few times. | |
| 33 | |
| 34 | |
| 1375 | 35 * SUMMARY |
| 36 --------- | |
| 13 | 37 |
| 38 The following commands are useful for viewing screenfuls: | |
| 39 | |
| 40 C-v Move forward one screenful | |
| 41 M-v Move backward one screenful | |
| 42 C-l Clear screen and redisplay everything | |
| 43 putting the text near the cursor at the center. | |
|
4351
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
44 (That's control-L, not control-1.) |
| 13 | 45 |
| 46 >> Find the cursor and remember what text is near it. | |
| 47 Then type a C-l. | |
| 48 Find the cursor again and see what text is near it now. | |
| 49 | |
| 50 | |
| 1375 | 51 * BASIC CURSOR CONTROL |
| 52 ---------------------- | |
| 13 | 53 |
| 54 Getting from screenful to screenful is useful, but how do you | |
| 55 reposition yourself within a given screen to a specific place? | |
| 56 There are several ways you can do this. One way (not the best, but | |
| 57 the most basic) is to use the commands previous, backward, forward | |
| 58 and next. As you can imagine these commands (which are given to | |
| 59 Emacs as C-p, C-b, C-f, and C-n respectively) move the cursor from | |
| 60 where it currently is to a new place in the given direction. Here, | |
| 61 in a more graphical form are the commands: | |
| 62 | |
| 63 Previous line, C-p | |
| 64 : | |
| 65 : | |
| 66 Backward, C-b .... Current cursor position .... Forward, C-f | |
| 67 : | |
| 68 : | |
| 69 Next line, C-n | |
| 70 | |
| 71 >> Move the cursor to the line in the middle of that diagram | |
| 72 and type C-l to see the whole diagram centered in the screen. | |
| 73 | |
| 74 You'll probably find it easy to think of these by letter. P for | |
| 75 previous, N for next, B for backward and F for forward. These are | |
| 76 the basic cursor positioning commands and you'll be using them ALL | |
| 77 the time so it would be of great benefit if you learn them now. | |
| 78 | |
| 79 >> Do a few C-n's to bring the cursor down to this line. | |
| 80 | |
| 81 >> Move into the line with C-f's and then up with C-p's. | |
| 82 See what C-p does when the cursor is in the middle of the line. | |
| 83 | |
| 84 Lines are separated by Newline characters. For most applications | |
| 85 there should normally be a Newline character at the end of the text, | |
| 86 as well, but it is up to you to make sure of this. A file can | |
| 87 validly exist without a Newline at the end. | |
| 88 | |
| 89 >> Try to C-b at the beginning of a line. Do a few more C-b's. | |
| 90 Then do C-f's back to the end of the line and beyond. | |
| 91 | |
| 92 When you go off the top or bottom of the screen, the text beyond | |
| 93 the edge is shifted onto the screen so that your instructions can | |
| 94 be carried out while keeping the cursor on the screen. | |
| 95 | |
| 96 >> Try to move the cursor off the bottom of the screen with C-n and | |
| 97 see what happens. | |
| 98 | |
| 99 If moving by characters is too slow, you can move by words. M-f | |
| 100 (Meta-f) moves forward a word and M-b moves back a word. | |
| 101 | |
| 102 >> Type a few M-f's and M-b's. Intersperse them with C-f's and C-b's. | |
| 103 | |
| 104 Notice the parallel between C-f and C-b on the one hand, and M-f and | |
| 105 M-b on the other hand. Very often Meta characters are used for | |
| 106 operations related to English text whereas Control characters operate | |
| 107 on the basic textual units that are independent of what you are | |
| 108 editing (characters, lines, etc). There is a similar parallel between | |
| 109 lines and sentences: C-a and C-e move to the beginning or end of a | |
| 110 line, and M-a and M-e move to the beginning or end of a sentence. | |
| 111 | |
| 112 >> Try a couple of C-a's, and then a couple of C-e's. | |
| 113 Try a couple of M-a's, and then a couple of M-e's. | |
| 114 | |
| 115 See how repeated C-a's do nothing, but repeated M-a's keep moving | |
| 116 farther. Do you think that this is right? | |
| 117 | |
| 118 Two other simple cursor motion commands are M-< (Meta Less-than), | |
| 119 which moves to the beginning of the file, and M-> (Meta Greater-than), | |
| 120 which moves to the end of the file. You probably don't need to try | |
| 121 them, since finding this spot again will be boring. On most terminals | |
| 122 the "<" is above the comma and you must use the shift key to type it. | |
| 123 On these terminals you must use the shift key to type M-< also; | |
| 124 without the shift key, you would be typing M-comma. | |
| 125 | |
| 126 The location of the cursor in the text is also called "point". To | |
| 127 paraphrase, the cursor shows on the screen where point is located in | |
| 128 the text. | |
| 129 | |
| 130 Here is a summary of simple moving operations including the word and | |
| 131 sentence moving commands: | |
| 132 | |
| 133 C-f Move forward a character | |
| 134 C-b Move backward a character | |
| 135 | |
| 136 M-f Move forward a word | |
| 137 M-b Move backward a word | |
| 138 | |
| 139 C-n Move to next line | |
| 140 C-p Move to previous line | |
| 141 | |
| 142 C-a Move to beginning of line | |
| 143 C-e Move to end of line | |
| 144 | |
| 145 M-a Move back to beginning of sentence | |
| 146 M-e Move forward to end of sentence | |
| 147 | |
| 148 M-< Go to beginning of file | |
| 149 M-> Go to end of file | |
| 150 | |
| 151 >> Try all of these commands now a few times for practice. | |
| 152 Since the last two will take you away from this screen, | |
| 153 you can come back here with M-v's and C-v's. These are | |
| 154 the most often used commands. | |
| 155 | |
| 156 Like all other commands in Emacs, these commands can be given | |
| 157 arguments which cause them to be executed repeatedly. The way you | |
| 158 give a command a repeat count is by typing C-u and then the digits | |
| 159 before you type the command. If you have a META or EDIT key, you can | |
| 160 omit the C-u if you hold down the META or EDIT key while you type the | |
| 161 digits. This is easier, but we recommend the C-u method because it | |
| 162 works on any terminal. | |
| 163 | |
| 164 For instance, C-u 8 C-f moves forward eight characters. | |
| 165 | |
| 166 >> Try giving a suitable argument to C-n or C-p to come as close | |
| 167 as you can to this line in one jump. | |
| 168 | |
| 169 The only apparent exception to this is the screen moving commands, | |
| 170 C-v and M-v. When given an argument, they scroll the screen up or | |
| 171 down by that many lines, rather than screenfuls. This proves to be | |
| 172 much more useful. | |
| 173 | |
| 174 >> Try typing C-u 8 C-v now. | |
| 175 | |
| 176 Did it scroll the screen up by 8 lines? If you would like to | |
| 177 scroll it down you can give an argument to M-v. | |
| 178 | |
| 2863 | 179 If you are using X Windows, there is probably a rectangular area |
| 180 called a scroll bar at the right hand side of the Emacs window. You | |
| 181 can scroll the text by clicking the mouse in the scroll bar. | |
| 182 | |
| 183 >> Try pressing the middle button at the top of the highlighted area | |
| 184 within the scroll bar, then moving the mouse while holding that button | |
| 185 down. | |
| 186 | |
| 187 >> Move the mouse to a point in the scroll bar about three lines from | |
| 188 the top, and click the left button a couple of times. Then try the | |
| 189 right button a couple of times. | |
| 190 | |
| 13 | 191 |
| 1375 | 192 * WHEN EMACS IS HUNG |
| 193 -------------------- | |
| 13 | 194 |
| 195 If Emacs gets into an infinite (or simply very long) computation which | |
| 196 you don't want to finish, you can stop it safely by typing C-g. | |
| 197 You can also use C-g to discard a numeric argument or the beginning of | |
| 198 a command that you don't want to finish. | |
| 199 | |
| 200 >> Type C-u 100 to make a numeric arg of 100, then type C-g. | |
| 201 Now type C-f. How many characters does it move? | |
| 202 If you have typed an <ESC> by mistake, you can get rid of it | |
| 203 with a C-g. | |
| 204 | |
| 12609 | 205 If you type <ESC> : then you get a new window appearing on the screen, |
| 206 telling you that M-: is a "disabled command" and asking whether you | |
| 207 really want to execute it. The command M-: is marked as disabled | |
| 208 because we expect it would confuse beginners and you probably don't | |
| 209 want to use it until you know more about Emacs. If you really want to | |
| 210 try the M-: command, you could type a Space in answer to the question, | |
| 211 and M-: would go ahead. Normally, if you do not want to execute M-:, | |
| 212 you would type "n" to answer the question. | |
| 13 | 213 |
| 12609 | 214 >> Type <ESC> :, then type n. |
| 13 | 215 |
| 216 | |
| 1375 | 217 * WINDOWS |
| 218 --------- | |
| 13 | 219 |
| 220 Emacs can have several windows, each displaying its own text. | |
| 221 At this stage it is better not to go into the techniques of | |
| 222 using multiple windows. But you do need to know how to get | |
| 223 rid of extra windows that may appear to display help or | |
| 224 output from certain commands. It is simple: | |
| 225 | |
| 226 C-x 1 One window (i.e., kill all other windows). | |
| 227 | |
| 228 That is Control-x followed by the digit 1. | |
| 229 C-x 1 makes the window which the cursor is in become | |
| 230 the full screen, by getting rid of any other windows. | |
| 231 | |
| 232 >> Move the cursor to this line and type C-u 0 C-l. | |
| 233 >> Type Control-h k Control-f. | |
| 234 See how this window shrinks, while a new one appears | |
| 235 to display documentation on the Control-f command. | |
| 236 | |
| 237 >> Type C-x 1 and see the documentation listing window disappear. | |
| 238 | |
| 239 | |
| 1375 | 240 * INSERTING AND DELETING |
| 241 ------------------------ | |
| 13 | 242 |
| 243 If you want to insert text, just type it. Characters which you can | |
| 244 see, such as A, 7, *, etc. are taken by Emacs as text and inserted | |
| 245 immediately. Type <Return> (the carriage-return key) to insert a | |
| 246 Newline character. | |
| 247 | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
248 You can delete the last character you typed by typing <Delete>. |
|
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
249 <Delete> is a key on the keyboard, which may be labeled "Del". In |
|
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
250 some cases, the "Backspace" key serves as <Delete>, but not always! |
|
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
251 |
|
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
252 More generally, <Delete> deletes the character immediately before the |
|
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
253 current cursor position. |
| 13 | 254 |
| 255 >> Do this now, type a few characters and then delete them | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
256 by typing <Delete> a few times. Don't worry about this file |
| 13 | 257 being changed; you won't affect the master tutorial. This is just |
| 258 a copy of it. | |
| 259 | |
| 260 >> Now start typing text until you reach the right margin, and keep | |
| 261 typing. When a line of text gets too big for one line on the | |
| 262 screen, the line of text is "continued" onto a second screen line. | |
| 263 The backslash at the right margin indicates a line which has | |
| 264 been continued. | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
265 >> Use <Delete>s to delete the text until the line fits on one screen |
| 13 | 266 line again. The continuation line goes away. |
| 267 | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
268 >> Move the cursor to the beginning of a line and type <Delete>. This |
| 13 | 269 deletes the newline before the line and merges the line onto |
| 270 the previous line. The resulting line may be too long to fit, in | |
| 271 which case it has a continuation line. | |
| 272 >> Type <Return> to reinsert the Newline you deleted. | |
| 273 | |
| 274 Remember that most Emacs commands can be given a repeat count; | |
| 275 this includes characters which insert themselves. | |
| 276 | |
| 277 >> Try that now -- type C-u 8 * and see what happens. | |
| 278 | |
| 279 You've now learned the most basic way of typing something in | |
| 280 Emacs and correcting errors. You can delete by words or lines | |
| 281 as well. Here is a summary of the delete operations: | |
| 282 | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
283 <Delete> delete the character just before the cursor |
| 13 | 284 C-d delete the next character after the cursor |
| 285 | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
286 M-<Delete> kill the word immediately before the cursor |
| 13 | 287 M-d kill the next word after the cursor |
| 288 | |
| 289 C-k kill from the cursor position to end of line | |
| 290 M-k kill to the end of the current sentence | |
| 291 | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
292 Notice that <Delete> and C-d vs M-<Delete> and M-d extend the parallel |
|
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
293 started by C-f and M-f (well, <Delete> isn't really a control |
| 13 | 294 character, but let's not worry about that). C-k and M-k are like C-e |
| 295 and M-e, sort of, in that lines are opposite sentences. | |
| 296 | |
| 297 Now suppose you kill something, and then you decide that you want to | |
| 298 get it back? Well, whenever you kill something bigger than a | |
| 299 character, Emacs saves it for you. To yank it back, use C-y. You | |
| 300 can kill text in one place, move elsewhere, and then do C-y; this is | |
| 301 a good way to move text around. Note that the difference | |
| 302 between "Killing" and "Deleting" something is that "Killed" things | |
| 303 can be yanked back, and "Deleted" things cannot. Generally, the | |
| 304 commands that can destroy a lot of text save it, while the ones that | |
| 305 attack only one character, or nothing but blank lines and spaces, do | |
| 306 not save. | |
| 307 | |
| 34 | 308 For instance, type C-n a couple times to position the cursor |
| 13 | 309 at some line on this screen. |
| 310 | |
| 311 >> Do this now, move the cursor and kill that line with C-k. | |
| 312 | |
| 313 Note that a single C-k kills the contents of the line, and a second | |
| 314 C-k kills the line itself, and make all the other lines move up. If | |
| 315 you give C-k a repeat count, it kills that many lines AND their | |
| 316 contents. | |
| 317 | |
| 318 The text that has just disappeared is saved so that you can | |
| 319 retrieve it. To retrieve the last killed text and put it where | |
| 320 the cursor currently is, type C-y. | |
| 321 | |
| 322 >> Try it; type C-y to yank the text back. | |
| 323 | |
| 324 Think of C-y as if you were yanking something back that someone | |
| 325 took away from you. Notice that if you do several C-k's in a row | |
| 326 the text that is killed is all saved together so that one C-y will | |
| 327 yank all of the lines. | |
| 328 | |
| 329 >> Do this now, type C-k several times. | |
| 330 | |
| 331 Now to retrieve that killed text: | |
| 332 | |
| 333 >> Type C-y. Then move the cursor down a few lines and type C-y | |
| 334 again. You now see how to copy some text. | |
| 335 | |
| 336 What do you do if you have some text you want to yank back, and then | |
| 337 you kill something else? C-y would yank the more recent kill. But | |
| 338 the previous text is not lost. You can get back to it using the M-y | |
| 339 command. After you have done C-y to get the most recent kill, typing | |
| 340 M-Y replaces that yanked text with the previous kill. Typing M-y | |
| 341 again and again brings in earlier and earlier kills. When you | |
| 342 have reached the text you are looking for, you can just go away and | |
| 343 leave it there. If you M-y enough times, you come back to the | |
| 344 starting point (the most recent kill). | |
| 345 | |
| 346 >> Kill a line, move around, kill another line. | |
| 347 Then do C-y to get back the second killed line. | |
| 348 Then do M-y and it will be replaced by the first killed line. | |
| 349 Do more M-y's and see what you get. Keep doing them until | |
| 350 the second kill line comes back, and then a few more. | |
| 351 If you like, you can try giving M-y positive and negative | |
| 352 arguments. | |
| 353 | |
| 354 | |
| 1375 | 355 * UNDO |
| 356 ------ | |
| 13 | 357 |
| 358 Any time you make a change to the text and wish you had not done so, | |
| 359 you can undo the change (return the text to its previous state) | |
| 360 with the undo command, C-x u. Normally, C-x u undoes one command's | |
| 361 worth of changes; if you repeat the C-x u several times in a row, | |
| 362 each time undoes one more command. There are two exceptions: | |
| 363 commands that made no change (just moved the cursor) do not count, | |
| 364 and self-inserting characters are often lumped together in groups | |
| 365 of up to 20. This is to reduce the number of C-x u's you have to type. | |
| 366 | |
| 367 >> Kill this line with C-k, then type C-x u and it should reappear. | |
| 368 | |
| 369 C-_ is another command for undoing; it is just the same as C-x u | |
| 370 but easier to type several times in a row. The problem with C-_ is | |
| 371 that on some keyboards it is not obvious how to type it. That is | |
| 372 why C-x u is provided as well. On some DEC terminals, you can type | |
| 373 C-_ by typing / while holding down CTRL. Illogical, but what can | |
| 374 you expect from DEC? | |
| 375 | |
| 376 Giving a numeric argument to C-_ or C-x u is equivalent to repeating | |
| 377 it as many times as the argument says. | |
| 378 | |
| 379 | |
| 1375 | 380 * FILES |
| 381 ------- | |
| 13 | 382 |
| 383 In order to make the text you edit permanent, you must put it in a | |
| 384 file. Otherwise, it will go away when your invocation of Emacs goes | |
| 385 away. You put your editing in a file by "finding" the file. What | |
| 386 finding means is that you see the contents of the file in your Emacs; | |
| 387 and, loosely speaking, what you are editing is the file itself. | |
| 388 However, the changes still don't become permanent until you "save" the | |
| 389 file. This is so you can have control to avoid leaving a half-changed | |
| 390 file around when you don't want to. Even then, Emacs leaves the | |
| 391 original file under a changed name in case your changes turn out | |
| 392 to be a mistake. | |
| 393 | |
| 394 If you look near the bottom of the screen you will see a line that | |
| 395 begins and ends with dashes, and contains the string "Emacs: TUTORIAL". | |
| 396 Your copy of the Emacs tutorial is called "TUTORIAL". Whatever | |
| 397 file you find, that file's name will appear in that precise | |
| 398 spot. | |
| 399 | |
| 400 The commands for finding and saving files are unlike the other | |
| 401 commands you have learned in that they consist of two characters. | |
| 402 They both start with the character Control-x. There is a whole series | |
| 403 of commands that start with Control-x; many of them have to do with | |
| 404 files, buffers, and related things, and all of them consist of | |
| 405 Control-x followed by some other character. | |
| 406 | |
| 407 Another thing about the command for finding a file is that you have | |
| 408 to say what file name you want. We say the command "reads an argument | |
| 409 from the terminal" (in this case, the argument is the name of the | |
| 410 file). After you type the command | |
| 411 | |
| 412 C-x C-f Find a file | |
| 413 | |
| 414 Emacs asks you to type the file name. It echoes on the bottom | |
| 415 line of the screen. You are using the minibuffer now! this is | |
| 416 what the minibuffer is for. When you type <Return> to end the | |
| 417 file name, the minibuffer is no longer needed, so it disappears. | |
| 418 | |
| 419 >> Type C-x C-f, then type C-g. This cancels the minibuffer, | |
| 420 and also cancels the C-x C-f command that was using the | |
| 421 minibuffer. So you do not find any file. | |
| 422 | |
| 423 In a little while the file contents appear on the screen. You can | |
| 424 edit the contents. When you wish to make the changes permanent, | |
| 425 issue the command | |
| 426 | |
| 427 C-x C-s Save the file | |
| 428 | |
| 429 The contents of Emacs are written into the file. The first time you | |
| 430 do this, the original file is renamed to a new name so that it | |
| 431 is not lost. The new name is made by appending "~" to the end | |
| 432 of the original file's name. | |
| 433 | |
| 434 When saving is finished, Emacs prints the name of the file written. | |
| 435 You should save fairly often, so that you will not lose very much | |
| 436 work if the system should crash. | |
| 437 | |
| 438 >> Type C-x C-s, saving your copy of the tutorial. | |
| 439 This should print "Wrote .../TUTORIAL" at the bottom of the screen. | |
| 440 On VMS it will print "Wrote ...[...]TUTORIAL." | |
| 441 | |
|
8128
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
442 NOTE: On some systems, typing C-x C-s will freeze the screen and you |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
443 will see no further output from Emacs. This indicates that an |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
444 operating system "feature" called "flow control" is intercepting the |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
445 C-s and not letting it get through to Emacs. To unfreeze the screen, |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
446 type C-q. Then see the section "Spontaneous Entry to Incremental |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
447 Search" in the Emacs manual for advice on dealing with this "feature". |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
448 |
| 13 | 449 To make a new file, just find it "as if" it already existed. Then |
| 450 start typing in the text. When you ask to "save" the file, Emacs | |
| 451 will really create the file with the text that you have inserted. | |
| 452 From then on, you can consider yourself to be editing an already | |
| 453 existing file. | |
| 454 | |
| 455 | |
| 1375 | 456 * BUFFERS |
| 457 --------- | |
| 13 | 458 |
| 459 If you find a second file with C-x C-f, the first file remains | |
| 460 inside Emacs. You can switch back to it by finding it again with | |
| 461 C-x C-f. This way you can get quite a number of files inside Emacs. | |
| 462 | |
| 463 The object inside Emacs which holds the text read from one file | |
| 464 is called a "buffer." Finding a file makes a new buffer inside Emacs. | |
| 465 To see a list of the buffers that exist in Emacs, type | |
| 466 | |
| 467 C-x C-b List buffers | |
| 468 | |
| 469 >> Try C-x C-b now. | |
| 470 | |
| 471 See how each buffer has a name, and it may also have a file name | |
| 472 for the file whose contents it holds. Some buffers do not correspond | |
| 473 to files. For example, the buffer named "*Buffer List*" does | |
| 474 not have any file. It is the buffer which contains the buffer | |
| 475 list that was made by C-x C-b. ANY text you see in an Emacs window | |
| 476 has to be in some buffer. | |
| 477 | |
| 478 >> Type C-x 1 to get rid of the buffer list. | |
| 479 | |
| 480 If you make changes to the text of one file, then find another file, | |
| 481 this does not save the first file. Its changes remain inside Emacs, | |
| 482 in that file's buffer. The creation or editing of the second file's | |
| 483 buffer has no effect on the first file's buffer. This is very useful, | |
| 484 but it also means that you need a convenient way to save the first | |
| 485 file's buffer. It would be a nuisance to have to switch back to | |
| 486 it with C-x C-f in order to save it with C-x C-s. So we have | |
| 487 | |
| 488 C-x s Save some buffers | |
| 489 | |
| 490 C-x s goes through the list of all the buffers you have | |
| 491 and finds the ones that contain files you have changed. | |
| 492 For each such buffer, C-x s asks you whether to save it. | |
| 493 | |
| 494 | |
| 1375 | 495 * EXTENDING THE COMMAND SET |
| 496 --------------------------- | |
| 13 | 497 |
| 498 There are many, many more Emacs commands than could possibly be put | |
| 499 on all the control and meta characters. Emacs gets around this with | |
| 500 the X (eXtend) command. This comes in two flavors: | |
| 501 | |
| 502 C-x Character eXtend. Followed by one character. | |
| 503 M-x Named command eXtend. Followed by a long name. | |
| 504 | |
| 505 These are commands that are generally useful but used less than the | |
| 506 commands you have already learned about. You have already seen two | |
| 507 of them: the file commands C-x C-f to Find and C-x C-s to Save. | |
| 508 Another example is the command to tell Emacs that you'd like to stop | |
| 509 editing and get rid of Emacs. The command to do this is C-x C-c. | |
| 510 (Don't worry; it offers to save each changed file before it kills the | |
| 511 Emacs.) | |
| 512 | |
|
9560
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
513 C-z is the command to exit Emacs *temporarily*--so that you can go |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
514 back to the same Emacs session afterward. |
| 13 | 515 |
|
9560
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
516 On systems which allow it, C-z exits from Emacs to the shell but does |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
517 not destroy the Emacs; if you use the C shell, you can resume Emacs |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
518 with the `fg' command (or, more generally, with `%emacs', which works |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
519 even if your most recent job was some other). On systems which don't |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
520 implement suspending, C-z creates a subshell running under Emacs to |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
521 give you the chance to run other programs and return to Emacs |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
522 afterward; it does not truly "exit" from Emacs. In this case, the |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
523 shell command `exit' is the usual way to get back to Emacs from the |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
524 subshell. |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
525 |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
526 The time to use C-x C-c is when you are about to log out. It's also |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
527 the right thing to use to exit an Emacs invoked under mail handling |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
528 programs and other random utilities, since they may not know how to |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
529 cope with suspension of Emacs. On other occasions, use C-z, and |
|
4217123670e2
Better info about C-z vs C-x C-c.
Richard M. Stallman <rms@gnu.org>
parents:
8128
diff
changeset
|
530 resume the Emacs when you have more editing to do. |
| 13 | 531 |
| 532 There are many C-x commands. The ones you know are: | |
| 533 | |
| 534 C-x C-f Find file. | |
| 535 C-x C-s Save file. | |
| 536 C-x C-b List buffers. | |
| 537 C-x C-c Quit Emacs. | |
| 538 C-x u Undo. | |
| 539 | |
| 540 Named eXtended commands are commands which are used even less | |
| 541 frequently, or commands which are used only in certain modes. These | |
| 542 commands are usually called "functions". An example is the function | |
| 543 replace-string, which globally replaces one string with another. When | |
| 544 you type M-x, Emacs prompts you at the bottom of the screen with | |
| 545 M-x and you should type the name of the function you wish to call; in | |
| 546 this case, "replace-string". Just type "repl s<TAB>" and Emacs will | |
| 547 complete the name. End the command name with <Return>. | |
| 548 Then type the two "arguments"--the string to be replaced, and the string | |
| 549 to replace it with--each one ended with a Return. | |
| 550 | |
| 551 >> Move the cursor to the blank line two lines below this one. | |
| 552 Then type M-x repl s<Return>changed<Return>altered<Return>. | |
| 553 | |
| 554 Notice how this line has changed: you've replaced | |
| 34 | 555 the word c-h-a-n-g-e-d with "altered" wherever it occurred |
| 13 | 556 after the cursor. |
| 557 | |
| 558 | |
| 10698 | 559 * AUTO SAVE |
| 560 ----------- | |
| 561 | |
| 562 When you have made changes in a file, but you have not saved them yet, | |
| 563 they could be lost if your computer crashes. To protect you from | |
| 564 this, Emacs writes "auto save" files periodically. The auto save file | |
| 10699 | 565 name has a # at the beginning and the end; for example, if your file |
| 566 is named "hello.c", its auto save file's name is "#hello.c#". When | |
| 567 you save the file in the normal way, its auto save file is no longer | |
| 10698 | 568 necessary so Emacs deletes it. |
| 569 | |
| 570 If the computer crashes, you can recover your auto-saved editing by | |
| 571 finding the file normally (the file you were editing, not the auto | |
| 572 save file) and then typing M-x recover file<return>. When it asks for | |
| 573 confirmation, type yes<return> to go ahead and recover the auto-save | |
| 574 data. | |
| 575 | |
| 576 | |
| 1375 | 577 * MODE LINE |
| 578 ----------- | |
| 13 | 579 |
| 580 If Emacs sees that you are typing commands slowly it shows them to you | |
| 581 at the bottom of the screen in an area called the "echo area." The echo | |
| 582 area contains the bottom line of the screen. The line immediately above | |
| 583 it is called the MODE LINE. The mode line says something like | |
| 584 | |
|
4351
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
585 --**-Emacs: TUTORIAL (Fundamental)--58%---------------------- |
| 13 | 586 |
| 587 This is a very useful "information" line. | |
| 588 | |
| 589 You already know what the filename means--it is the file you have | |
| 590 found. What the --NN%-- means is that NN percent of the file is | |
| 591 above the top of the screen. If the top of the file is on the screen, | |
|
4351
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
592 it will say --Top-- instead of --00%--. If the bottom of the file is |
|
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
593 on the screen, it will say --Bot--. If you are looking at a file so |
|
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
594 small it all fits on the screen, it says --All--. |
| 13 | 595 |
| 596 The stars near the front mean that you have made changes to the text. | |
| 597 Right after you visit or save a file, there are no stars, just dashes. | |
| 598 | |
| 599 The part of the mode line inside the parentheses is to tell you what | |
| 600 modes you are in. The default mode is Fundamental which is what you | |
| 601 are in now. It is an example of a "major mode". There are several | |
| 602 major modes in Emacs for editing different languages and text, such as | |
| 603 Lisp mode, Text mode, etc. At any time one and only one major mode is | |
| 604 active, and its name can always be found in the mode line just where | |
| 605 "Fundamental" is now. Each major mode makes a few commands behave | |
| 606 differently. For example, there are commands for creating comments in | |
| 607 a program, and since each programming language has a different idea of | |
| 608 what a comment should look like, each major mode has to insert | |
| 609 comments differently. Each major mode is the name of an extended | |
| 610 command, which is how you get into the mode. For example, | |
|
4351
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
611 M-x fundamental-mode is how to get into Fundamental mode. |
| 13 | 612 |
| 613 If you are going to be editing English text, such as this file, you | |
| 614 should probably use Text Mode. | |
| 615 >> Type M-x text-mode<Return>. | |
| 616 | |
| 617 Don't worry, none of the commands you have learned changes Emacs in | |
| 2619 | 618 any great way. But you can observe that apostrophes are now part of |
| 619 words when you do M-f or M-b. Major modes are usually like that: | |
| 620 commands don't change into completely unrelated things, but they work | |
| 621 a little bit differently. | |
| 13 | 622 |
| 623 To get documentation on your current major mode, type C-h m. | |
| 624 | |
| 625 >> Use C-u C-v once or more to bring this line near the top of screen. | |
| 626 >> Type C-h m, to see how Text mode differs from Fundamental mode. | |
| 627 >> Type C-x 1 to remove the documentation from the screen. | |
| 628 | |
| 629 Major modes are called major because there are also minor modes. | |
| 630 They are called minor because they aren't alternatives to the major | |
| 631 modes, just minor modifications of them. Each minor mode can be | |
| 632 turned on or off by itself, regardless of what major mode you are in, | |
| 633 and regardless of the other minor modes. So you can use no minor | |
| 634 modes, or one minor mode, or any combination of several minor modes. | |
| 635 | |
| 636 One minor mode which is very useful, especially for editing English | |
| 637 text, is Auto Fill mode. When this mode is on, Emacs breaks the line | |
| 638 in between words automatically whenever the line gets too long. You | |
| 639 can turn this mode on by doing M-x auto-fill-mode<Return>. When the | |
| 640 mode is on, you can turn it off by doing M-x auto-fill-mode<Return>. | |
| 641 If the mode is off, this function turns it on, and if the mode is on, | |
| 642 this function turns it off. This is called "toggling". | |
| 643 | |
| 644 >> Type M-x auto-fill-mode<Return> now. Then insert a line of "asdf " | |
| 645 over again until you see it divide into two lines. You must put in | |
| 646 spaces between them because Auto Fill breaks lines only at spaces. | |
| 647 | |
| 648 The margin is usually set at 70 characters, but you can change it | |
| 649 with the C-x f command. You should give the margin setting you want | |
| 650 as a numeric argument. | |
| 651 | |
| 652 >> Type C-x f with an argument of 20. (C-u 2 0 C-x f). | |
| 653 Then type in some text and see Emacs fill lines of 20 | |
| 654 characters with it. Then set the margin back to 70 using | |
| 655 C-x f again. | |
| 656 | |
| 657 If you makes changes in the middle of a paragraph, Auto Fill mode | |
| 658 does not re-fill it for you. | |
| 659 To re-fill the paragraph, type M-q (Meta-q) with the cursor inside | |
| 660 that paragraph. | |
| 661 | |
| 662 >> Move the cursor into the previous paragraph and type M-q. | |
| 663 | |
| 1375 | 664 * SEARCHING |
| 665 ----------- | |
| 13 | 666 |
| 667 Emacs can do searches for strings (these are groups of contiguous | |
| 668 characters or words) either forward through the file or backward | |
| 669 through it. To search for the string means that you are trying to | |
| 670 locate it somewhere in the file and have Emacs show you where the | |
| 671 occurrences of the string exist. This type of search is somewhat | |
| 672 different from what you may be familiar with. It is a search that is | |
| 673 performed as you type in the thing to search for. The command to | |
| 674 initiate a search is C-s for forward search, and C-r for reverse | |
| 675 search. BUT WAIT! Don't do them now. When you type C-s you'll | |
| 676 notice that the string "I-search" appears as a prompt in the echo | |
| 677 area. This tells you that Emacs is in what is called an incremental | |
| 678 search waiting for you to type the thing that you want to search for. | |
|
4190
023ddd6f5c2b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2863
diff
changeset
|
679 <RET> terminates a search. |
| 13 | 680 |
| 681 >> Now type C-s to start a search. SLOWLY, one letter at a time, | |
| 682 type the word 'cursor', pausing after you type each | |
| 683 character to notice what happens to the cursor. | |
| 684 >> Type C-s to find the next occurrence of "cursor". | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
685 >> Now type <Delete> four times and see how the cursor moves. |
|
4190
023ddd6f5c2b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2863
diff
changeset
|
686 >> Type <RET> to terminate the search. |
| 13 | 687 |
| 688 Did you see what happened? Emacs, in an incremental search, tries to | |
| 689 go to the occurrence of the string that you've typed out so far. To go | |
| 690 to the next occurrence of 'cursor' just type C-s again. If no such | |
| 691 occurrence exists Emacs beeps and tells you that it is a failing | |
| 692 search. C-g would also terminate the search. | |
| 693 | |
|
8128
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
694 NOTE: On some systems, typing C-s will freeze the screen and you will |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
695 see no further output from Emacs. This indicates that an operating |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
696 system "feature" called "flow control" is intercepting the C-s and not |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
697 letting it get through to Emacs. To unfreeze the screen, type C-q. |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
698 Then see the section "Spontaneous Entry to Incremental Search" in the |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
699 Emacs manual for advice on dealing with this "feature". |
|
027fb17a2952
Talk about flow control along with C-x C-s and C-s.
Richard M. Stallman <rms@gnu.org>
parents:
6597
diff
changeset
|
700 |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
701 If you are in the middle of an incremental search and type <Delete>, |
| 13 | 702 you'll notice that the last character in the search string is erased |
| 703 and the search backs up to the last place of the search. For | |
| 704 instance, suppose you currently have typed 'cu' and you see that your | |
|
11903
5d0ad882565c
Delete reference to ALT. Change <Rubout> to <Delete>.
Karl Heuer <kwzh@gnu.org>
parents:
10699
diff
changeset
|
705 cursor is at the first occurrence of 'cu'. If you now type <Delete>, |
| 13 | 706 the 'u' on the search line is erased and you'll be repositioned in the |
| 707 text to the occurrence of 'c' where the search took you before you | |
| 708 typed the 'u'. This provides a useful means for backing up while you | |
| 709 are searching. | |
| 710 | |
|
4351
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
711 If you are in the middle of a search and type a control or meta |
|
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
712 character (with a few exceptions--characters that are special in |
|
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
713 a search, such as C-s and C-r), the search is terminated. |
| 13 | 714 |
| 715 The C-s starts a search that looks for any occurrence of the search | |
| 716 string AFTER the current cursor position. But what if you want to | |
| 717 search for something earlier in the text? To do this, type C-r for | |
| 718 Reverse search. Everything that applies to C-s applies to C-r except | |
| 719 that the direction of the search is reversed. | |
| 720 | |
| 721 | |
| 1375 | 722 * MULTIPLE WINDOWS |
| 723 ------------------ | |
| 476 | 724 |
| 725 One of the nice features of Emacs is that you can display more than one | |
| 726 window on the screen at the same time. | |
| 727 | |
| 728 >> Move the cursor to this line and type C-u 0 C-l. | |
| 729 | |
| 730 >> Now type C-x 2 which splits the screen into two windows. | |
| 731 Both windows display this tutorial. The cursor stays in the top window. | |
| 732 | |
| 733 >> Type C-M-v to scroll the bottom window. | |
| 6276 | 734 (If you don't have a real Meta key, type ESC C-v.) |
| 476 | 735 |
| 736 >> Type C-x o ("o" for "other") to move the cursor to the bottom window. | |
| 737 >> Use C-v and M-v in the bottom window to scroll it. | |
| 738 Keep reading these directions in the top window. | |
| 739 | |
| 740 >> Type C-x o again to move the cursor back to the top window. | |
| 741 The cursor is still just where it was in the top window before. | |
| 742 | |
| 743 You can keep using C-x o to switch between the windows. Each | |
| 744 window has its own cursor position, but only one window actually | |
| 745 shows the cursor. All the ordinary editing commands apply to the | |
| 746 window that the cursor is in. | |
| 747 | |
| 748 The command C-M-v is very useful when you are editing text in one | |
| 749 window and using the other window just for reference. You can keep | |
| 750 the cursor always in the window where you are editing, and edit | |
| 751 there as you advance through the other window. | |
| 752 | |
|
12647
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
753 C-M-v is an example of a CONTROL-META character. If you have a real |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
754 META key, you can type C-M-v by holding down both CTRL and META while |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
755 typing v. |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
756 |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
757 It doesn't matter whether CTRL or META "comes first," because both of |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
758 these keys act by modifying the characters you type. But if you don't |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
759 have a real META key, and you use ESC instead, the order does matter: |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
760 you must type ESC followed by CTRL-v; CTRL-ESC v will not work. This |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
761 is because ESC is a character in its own right, not a modifier key. |
|
b94ff6c62c5d
Explain CTRL-META chars and how to use ESC for them.
Richard M. Stallman <rms@gnu.org>
parents:
12609
diff
changeset
|
762 |
| 476 | 763 >> Type C-x 1 (in the top window) to get rid of the bottom window. |
| 764 | |
| 765 (If you had typed C-x 1 in the bottom window, that would get rid | |
| 766 of the top one. Think of this command as "Keep just one | |
| 767 window--the window I am already in.") | |
| 768 | |
| 769 You don't have to display the same buffer in both windows. If | |
| 770 you use C-x C-f to find a file in one window, the other window | |
| 771 doesn't change. You can pick a file in each window | |
| 772 independently. | |
| 773 | |
| 774 Here is another way to use two windows to display two different | |
| 775 things: | |
| 776 | |
| 777 >> Type C-x 4 C-f followed by the name of one of your files. | |
| 778 End with <RETURN>. See the specified file appear in the bottom | |
| 779 window. The cursor goes there, too. | |
| 780 | |
| 781 >> Type C-x o to go back to the top window, and C-x 1 to delete | |
| 782 the bottom window. | |
| 783 | |
| 784 | |
| 1375 | 785 * RECURSIVE EDITING LEVELS |
| 786 -------------------------- | |
| 13 | 787 |
| 788 Sometimes you will get into what is called a "recursive editing | |
| 789 level". This is indicated by square brackets in the mode line, | |
| 790 surrounding the parentheses around the major mode name. For | |
| 791 example, you might see [(Fundamental)] instead of (Fundamental). | |
| 792 | |
|
15443
7a3398850d94
Mention ESC ESC ESC instead of M-x top-level.
Richard M. Stallman <rms@gnu.org>
parents:
15291
diff
changeset
|
793 To get out of the recursive editing level, type ESC ESC ESC. That is |
|
7a3398850d94
Mention ESC ESC ESC instead of M-x top-level.
Richard M. Stallman <rms@gnu.org>
parents:
15291
diff
changeset
|
794 an all-purpose "get out" command. You can also use it for eliminating |
|
7a3398850d94
Mention ESC ESC ESC instead of M-x top-level.
Richard M. Stallman <rms@gnu.org>
parents:
15291
diff
changeset
|
795 extra windows, and getting out of the minibuffer. |
| 13 | 796 |
|
15443
7a3398850d94
Mention ESC ESC ESC instead of M-x top-level.
Richard M. Stallman <rms@gnu.org>
parents:
15291
diff
changeset
|
797 >> Type M-x to get into a minibuffer; then type ESC ESC ESC to get out. |
| 13 | 798 |
| 799 You can't use C-g to get out of a recursive editing level because C-g | |
|
15443
7a3398850d94
Mention ESC ESC ESC instead of M-x top-level.
Richard M. Stallman <rms@gnu.org>
parents:
15291
diff
changeset
|
800 is used for canceling commands and arguments WITHIN the recursive |
|
7a3398850d94
Mention ESC ESC ESC instead of M-x top-level.
Richard M. Stallman <rms@gnu.org>
parents:
15291
diff
changeset
|
801 editing level. |
| 13 | 802 |
| 803 | |
| 1375 | 804 * GETTING MORE HELP |
| 805 ------------------- | |
| 13 | 806 |
| 807 In this tutorial we have tried to supply just enough information to | |
| 808 get you started using Emacs. There is so much available in Emacs that | |
| 809 it would be impossible to explain it all here. However, you may want | |
| 810 to learn more about Emacs since it has numerous desirable features | |
| 811 that you don't know about yet. Emacs has a great deal of internal | |
| 812 documentation. All of these commands can be accessed through | |
| 813 the character Control-h, which we call "the Help character" | |
| 814 because of the function it serves. | |
| 815 | |
| 816 To use the HELP features, type the C-h character, and then a | |
| 817 character saying what kind of help you want. If you are REALLY lost, | |
| 818 type C-h ? and Emacs will tell you what kinds of help it can give. | |
| 819 If you have typed C-h and decide you don't want any help, just | |
|
4351
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
820 type C-g to cancel it. |
| 13 | 821 |
|
6597
c78bae220849
Advise about case where C-h is rebound.
Richard M. Stallman <rms@gnu.org>
parents:
6276
diff
changeset
|
822 (Some sites rebind the character C-h. They really shouldn't do this |
|
c78bae220849
Advise about case where C-h is rebound.
Richard M. Stallman <rms@gnu.org>
parents:
6276
diff
changeset
|
823 as a blanket measure, so complain to the operator. Meanwhile, if C-h |
|
c78bae220849
Advise about case where C-h is rebound.
Richard M. Stallman <rms@gnu.org>
parents:
6276
diff
changeset
|
824 does not display a message about help at the bottom of the screen, try |
|
c78bae220849
Advise about case where C-h is rebound.
Richard M. Stallman <rms@gnu.org>
parents:
6276
diff
changeset
|
825 typing M-x help RET instead.) |
|
c78bae220849
Advise about case where C-h is rebound.
Richard M. Stallman <rms@gnu.org>
parents:
6276
diff
changeset
|
826 |
| 13 | 827 The most basic HELP feature is C-h c. Type C-h, a c, and a |
| 828 command character or sequence, and Emacs displays a very brief | |
| 829 description of the command. | |
| 830 | |
| 831 >> Type C-h c Control-p. | |
| 832 The message should be something like | |
| 833 | |
| 834 C-p runs the command previous-line | |
| 835 | |
| 836 This tells you the "name of the function". That is important in | |
| 837 writing Lisp code to extend Emacs; it also is enough to remind | |
| 838 you of what the command does if you have seen it before but did | |
| 839 not remember. | |
| 840 | |
| 841 Multi-character commands such as C-x C-s and (if you have no META or | |
| 842 EDIT key) <ESC>v are also allowed after C-h c. | |
| 843 | |
| 844 To get more information on the command, use C-h k instead of C-h c. | |
| 845 | |
| 846 >> Type C-h k Control-p. | |
| 847 | |
| 477 | 848 This displays the documentation of the function, as well as its |
| 849 name, in an Emacs window. When you are finished reading the | |
| 850 output, type C-x 1 to get rid of the help text. You do not have | |
| 851 to do this right away. You can do some editing while referring | |
| 852 to the help text and then type C-x 1. | |
| 13 | 853 |
| 854 Here are some other useful C-h options: | |
| 855 | |
| 856 C-h f Describe a function. You type in the name of the | |
| 857 function. | |
| 858 | |
| 859 >> Try typing C-h f previous-line<Return>. | |
| 860 This prints all the information Emacs has about the | |
|
4351
2173e8c3723b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
4190
diff
changeset
|
861 function which implements the C-p command. |
| 13 | 862 |
| 863 C-h a Command Apropos. Type in a keyword and Emacs will list | |
| 864 all the commands whose names contain that keyword. | |
| 865 These commands can all be invoked with Meta-x. | |
| 866 For some commands, Command Apropos will also list a one | |
| 867 or two character sequence which has the same effect. | |
| 868 | |
| 477 | 869 >> Type C-h a file<Return>. |
| 870 | |
| 871 This displays in another window a list of all M-x commands with | |
| 872 "file" in their names. You will also see commands like C-x C-f | |
| 873 and C-x C-w, listed beside the command names find-file and | |
| 874 write-file. | |
| 875 | |
| 876 >> Type C-M-v to scroll the help window. Do this a few times. | |
| 877 | |
| 878 >> Type C-x 1 to delete the help window. | |
| 13 | 879 |
| 880 | |
| 1375 | 881 * CONCLUSION |
| 882 ------------ | |
| 13 | 883 |
| 884 Remember, to exit Emacs permanently use C-x C-c. To exit to a shell | |
| 885 temporarily, so that you can come back in, use C-z. | |
| 886 | |
| 887 This tutorial is meant to be understandable to all new users, so if | |
| 888 you found something unclear, don't sit and blame yourself - complain! | |
| 889 | |
| 890 | |
| 891 COPYING | |
| 892 ------- | |
| 893 | |
| 894 This tutorial descends from a long line of Emacs tutorials | |
| 895 starting with the one written by Stuart Cracraft for the original Emacs. | |
| 896 | |
| 897 This version of the tutorial, like GNU Emacs, is copyrighted, and | |
| 898 comes with permission to distribute copies on certain conditions: | |
| 899 | |
| 900 Copyright (c) 1985 Free Software Foundation | |
| 901 | |
| 902 Permission is granted to anyone to make or distribute verbatim copies | |
| 903 of this document as received, in any medium, provided that the | |
| 904 copyright notice and permission notice are preserved, | |
| 905 and that the distributor grants the recipient permission | |
| 906 for further redistribution as permitted by this notice. | |
| 907 | |
| 908 Permission is granted to distribute modified versions | |
| 909 of this document, or of portions of it, | |
| 910 under the above conditions, provided also that they | |
| 911 carry prominent notices stating who last altered them. | |
| 912 | |
| 913 The conditions for copying Emacs itself are slightly different | |
| 914 but in the same spirit. Please read the file COPYING and then | |
| 915 do give copies of GNU Emacs to your friends. | |
| 916 Help stamp out software obstructionism ("ownership") by using, | |
| 917 writing, and sharing free software! |
