Mercurial > hg > xemacs-beta
comparison etc/TUTORIAL @ 161:28f395d8dc7a r20-3b7
Import from CVS: tag r20-3b7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:42:26 +0200 |
parents | 3bb7ccffb0c0 |
children | e45d5e7c476e |
comparison
equal
deleted
inserted
replaced
160:1c55655d6702 | 161:28f395d8dc7a |
---|---|
1 Copyright (c) 1985 Free Software Foundation, Inc; See end for conditions. | 1 Copyright (c) 1985, 1996 Free Software Foundation, Inc. See end for conditions. |
2 | |
2 You are looking at the Emacs tutorial. | 3 You are looking at the Emacs tutorial. |
3 | 4 |
4 Emacs commands generally involve the CONTROL key (sometimes labeled | 5 Emacs commands generally involve the CONTROL key (sometimes labelled |
5 CTRL or CTL) or the META key (sometimes labeled EDIT or ALT). Rather than | 6 CTRL or CTL) or the META key. On some keyboards, the META key is |
6 write that in full each time, we'll use the following abbreviations: | 7 labelled ALT or EDIT or something else (for example, on Sun keyboards, |
8 the diamond key to the left of the spacebar is META). If you have no | |
9 META key, you can use ESC instead. Rather than write out META or | |
10 CONTROL each time we want you to prefix a character, we'll use the | |
11 following abbreviations: | |
7 | 12 |
8 C-<chr> means hold the CONTROL key while typing the character <chr> | 13 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. | 14 Thus, C-f would be: hold the CONTROL key and type f. |
10 M-<chr> means hold the META or EDIT or ALT key down while typing <chr>. | 15 M-<chr> means hold the META key down while typing <chr>. If there |
11 If there is no META, EDIT or ALT key, instead press and release the | 16 is no META key, type <ESC>, release it, then type the |
12 ESC key and then type <chr>. We write <ESC> for the ESC key. | 17 character <chr>. |
13 | 18 |
14 Important note: to end the Emacs session, type C-x C-c. (Two characters.) | 19 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 | 20 The characters ">>" at the left margin indicate directions for you to |
16 try using a command. For instance: | 21 try using a command. For instance: |
17 <<Blank lines inserted here by startup of help-with-tutorial>> | 22 <<Blank lines inserted here by startup of help-with-tutorial>> |
37 | 42 |
38 The following commands are useful for viewing screenfuls: | 43 The following commands are useful for viewing screenfuls: |
39 | 44 |
40 C-v Move forward one screenful | 45 C-v Move forward one screenful |
41 M-v Move backward one screenful | 46 M-v Move backward one screenful |
42 C-l Clear screen and redisplay all the text, | 47 C-l Clear screen and redisplay everything |
43 moving the text around the cursor | 48 putting the text near the cursor at the center. |
44 to the center of the screen. | |
45 (That's control-L, not control-1.) | 49 (That's control-L, not control-1.) |
46 | 50 |
47 >> Find the cursor, and note what text is near it. | 51 >> Find the cursor, and note what text is near it. |
48 Then type C-l. | 52 Then type C-l. |
49 Find the cursor again and notice that the same text | 53 Find the cursor again and notice that the same text |
207 >> Try typing C-u 8 C-v now. | 211 >> Try typing C-u 8 C-v now. |
208 | 212 |
209 This should have scrolled the screen up by 8 lines. If you would like | 213 This should have scrolled the screen up by 8 lines. If you would like |
210 to scroll it down again, you can give an argument to M-v. | 214 to scroll it down again, you can give an argument to M-v. |
211 | 215 |
212 If you are using X Windows, there should be a tall rectangular area | 216 If you are using the X Window system, there is probably a rectangular |
213 called a scroll bar at the left hand side of the Emacs window. You | 217 area called a scroll bar at the right hand side of the Emacs window. |
214 can scroll the text by clicking the mouse in the scroll bar. | 218 You can scroll the text by manipulating the scroll bar with the mouse. |
215 | 219 |
216 >> Try pressing the middle button at the top of the highlighted area | 220 >> Try pressing the middle button at the top of the highlighted area |
217 within the scroll bar. This should scroll the text to a position | 221 within the scroll bar. This should scroll the text to a position |
218 determined by how high or low you click. | 222 determined by how high or low you click. |
219 | 223 |
220 >> Try moving the mouse up and down, while holding the middle button | 224 >> Move the mouse to a point in the scroll bar about three lines from |
221 pressed down. You'll see that the text scrolls up and down as | 225 the top, and click the left button a couple of times. |
222 you move the mouse. | 226 |
227 | |
228 * CURSOR CONTROL WITH AN X TERMINAL | |
229 ----------------------------------- | |
230 | |
231 If you have an X terminal, you will probably find it easier to use | |
232 the keys on the keypad to control the cursor. The left, right, up, | |
233 and down arrow keys move in the expected direction; they function | |
234 exactly like C-b, C-f, C-p, and C-n, but are easier to type and to | |
235 remember. You can also use C-left and C-right to move by words, and | |
236 C-up and C-down to move by blocks (e.g. paragraphs, if you're | |
237 editing text). If you have keys labelled HOME (or BEGIN) and END, | |
238 they will take you to the beginning and end of a line, respectively, | |
239 and C-home and C-end will move to the beginning and end of the file. | |
240 If your keyboard has PgUp and PgDn keys, you can use them to move up | |
241 and down a screenful at a time, like M-v and C-v. | |
242 | |
243 All of these commands can take numeric arguments, as described above. | |
244 You can use a shortcut to enter these arguments: just hold down the | |
245 CONTROL or META key and type the number. For example, to move 12 | |
246 words to the right, type C-1 C-2 C-right. Note that it is very easy | |
247 to type this because you do not have to release the CONTROL key | |
248 between keystrokes. | |
223 | 249 |
224 | 250 |
225 * WHEN EMACS IS HUNG | 251 * WHEN EMACS IS HUNG |
226 -------------------- | 252 -------------------- |
227 | 253 |
252 | 278 |
253 If you really want to try the command, type Space in answer to the | 279 If you really want to try the command, type Space in answer to the |
254 question. Normally, if you do not want to execute the disabled | 280 question. Normally, if you do not want to execute the disabled |
255 command, answer the question with "n". | 281 command, answer the question with "n". |
256 | 282 |
257 >> Type <ESC> : (which is a disabled command), | 283 >> Type `C-x n p' (which is a disabled command), |
258 then type n to answer the question. | 284 then type n to answer the question. |
259 | 285 |
260 | 286 |
261 * WINDOWS | 287 * WINDOWS |
262 --------- | 288 --------- |
263 | 289 |
264 Emacs can have several windows, each displaying its own text. We will | 290 Emacs can have several windows, each displaying its own text. |
265 explain later on how to use multiple windows. Right now we want to | 291 Note that "window" as used by Emacs does not refer to separate |
266 explain how to get rid of extra windows and go back to basic | 292 overlapping windows in the window system, but to separate panes |
267 one-window editing. It is simple: | 293 within a single X window. (Emacs can also have multiple X |
294 windows, or "frames" in Emacs terminology. This is described | |
295 later.) | |
296 | |
297 At this stage it is better not to go into the techniques of | |
298 using multiple windows. But you do need to know how to get | |
299 rid of extra windows that may appear to display help or | |
300 output from certain commands. It is simple: | |
268 | 301 |
269 C-x 1 One window (i.e., kill all other windows). | 302 C-x 1 One window (i.e., kill all other windows). |
270 | 303 |
271 That is Control-x followed by the digit 1. C-x 1 expands the window | 304 That is Control-x followed by the digit 1. C-x 1 expands the window |
272 which contains the cursor, to occupy the full screen. It deletes all | 305 which contains the cursor, to occupy the full screen. It deletes all |
273 other windows. | 306 other windows. |
274 | 307 |
275 >> Move the cursor to this line and type C-u 0 C-l. | 308 >> Move the cursor to this line and type C-u 0 C-l. |
309 | |
310 (Remember that C-l redraws the screen. If you give a | |
311 numeric argument to this command, it means "redraw the | |
312 screen and put the current line that many lines from the | |
313 top of the screen." So C-u 0 C-l means "redraw the | |
314 screen, putting the current line at the top.") | |
315 | |
276 >> Type Control-h k Control-f. | 316 >> Type Control-h k Control-f. |
277 See how this window shrinks, while a new one appears | 317 See how this window shrinks, while a new one appears |
278 to display documentation on the Control-f command. | 318 to display documentation on the Control-f command. |
279 | 319 |
280 >> Type C-x 1 and see the documentation listing window disappear. | 320 >> Type C-x 1 and see the documentation listing window disappear. |
568 | 608 |
569 >> Insert a line of text, then type C-x s. | 609 >> Insert a line of text, then type C-x s. |
570 It should ask you whether to save the buffer named TUTORIAL. | 610 It should ask you whether to save the buffer named TUTORIAL. |
571 Answer yes to the question by typing "y". | 611 Answer yes to the question by typing "y". |
572 | 612 |
613 * USING THE MENU | |
614 ---------------- | |
615 | |
616 If you are on an X terminal, you will notice a menubar at the | |
617 top of the Emacs screen. You can use this menubar to access all | |
618 the most common Emacs commands, such as "find file". You will | |
619 find this easier at first, because you don't need to remember | |
620 the keystrokes necessary to access any particular command. Once | |
621 you are comfortable with Emacs, it will be easy to begin using | |
622 the keyboard commands because each menu item with a | |
623 corresponding keyboard command has the command listed next to | |
624 it. | |
625 | |
626 Note that there are many items in the menubar that have no exact | |
627 keyboard equivalents. For example, the Buffers menu lists all | |
628 of the available buffers in most-recently used order. You can | |
629 switch to any buffer by simply findings its name in the Buffers | |
630 menu and selecting it. | |
631 | |
632 | |
633 * USING THE MOUSE | |
634 ----------------- | |
635 | |
636 When running under X, Emacs is fully integrated with the mouse. | |
637 You can position the text cursor by clicking the left button at | |
638 the desired location, and you can select text by dragging the | |
639 left mouse button across the text you want to select. (Or | |
640 alternatively, click the left mouse button at one end of the | |
641 text, then move to the other end and use Shift-click to select | |
642 the text.) | |
643 | |
644 To kill some selected text, you can use C-w or choose the Cut | |
645 item from the Edit menu. Note that these are *not* equivalent: | |
646 C-w only saves the text internally within Emacs (similar to C-k | |
647 as described above), whereas Cut does this and also puts the | |
648 text into the X clipboard, where it can be accessed by other | |
649 applications. | |
650 | |
651 To retrieve text from the X clipboard, use the Paste item from | |
652 the Edit menu. | |
653 | |
654 The middle mouse button is commonly used to choose items that | |
655 are visible on the screen. For example, if you enter Info (the | |
656 on-line Emacs documentation) using C-h i or the Help menu, you | |
657 can follow a highlighted link by clicking the middle mouse | |
658 button on it. Similarly, if you are typing a file name in | |
659 (e.g. when prompted by "Find File") and you hit TAB to show the | |
660 possible completions, you can click the middle mouse button on | |
661 one of the completions to select it. | |
662 | |
663 The right mouse button brings up a popup menu. The contents of | |
664 this menu vary depending on what mode you're in, and usually | |
665 contain a few commonly used commands, so they're easier to | |
666 access. | |
667 | |
668 >> Press the right mouse button now. | |
669 | |
670 You will have to hold the button down in order to keep the | |
671 menu up. | |
672 | |
673 | |
573 * EXTENDING THE COMMAND SET | 674 * EXTENDING THE COMMAND SET |
574 --------------------------- | 675 --------------------------- |
575 | 676 |
576 There are many, many more Emacs commands than could possibly be put | 677 There are many, many more Emacs commands than could possibly be put |
577 on all the control and meta characters. Emacs gets around this with | 678 on all the control and meta characters. Emacs gets around this with |
665 ----------- | 766 ----------- |
666 | 767 |
667 The line immediately above the echo area it is called the "mode line". | 768 The line immediately above the echo area it is called the "mode line". |
668 The mode line says something like this: | 769 The mode line says something like this: |
669 | 770 |
670 --**-Emacs: TUTORIAL (Fundamental)--L670--58%---------------- | 771 --**-XEmacs: TUTORIAL (Fundamental)--L670--58%---------------- |
671 | 772 |
672 This line gives useful information about the status of Emacs and | 773 This line gives useful information about the status of Emacs and |
673 the text you are editing. | 774 the text you are editing. |
674 | 775 |
675 You already know what the filename means--it is the file you have | 776 You already know what the filename means--it is the file you have |
756 does not re-fill it for you. | 857 does not re-fill it for you. |
757 To re-fill the paragraph, type M-q (Meta-q) with the cursor inside | 858 To re-fill the paragraph, type M-q (Meta-q) with the cursor inside |
758 that paragraph. | 859 that paragraph. |
759 | 860 |
760 >> Move the cursor into the previous paragraph and type M-q. | 861 >> Move the cursor into the previous paragraph and type M-q. |
862 | |
761 | 863 |
762 * SEARCHING | 864 * SEARCHING |
763 ----------- | 865 ----------- |
764 | 866 |
765 Emacs can do searches for strings (these are groups of contiguous | 867 Emacs can do searches for strings (these are groups of contiguous |
979 | 1081 |
980 * CONCLUSION | 1082 * CONCLUSION |
981 ------------ | 1083 ------------ |
982 | 1084 |
983 Remember, to exit Emacs permanently use C-x C-c. To exit to a shell | 1085 Remember, to exit Emacs permanently use C-x C-c. To exit to a shell |
984 temporarily, so that you can come back to Emacs afterward, use C-z. | 1086 temporarily, so that you can come back in, use C-z. (under X, this |
1087 iconifies the current Emacs frame.) | |
985 | 1088 |
986 This tutorial is meant to be understandable to all new users, so if | 1089 This tutorial is meant to be understandable to all new users, so if |
987 you found something unclear, don't sit and blame yourself - complain! | 1090 you found something unclear, don't sit and blame yourself - complain! |
988 | 1091 |
989 | 1092 |
990 COPYING | 1093 COPYING |
991 ------- | 1094 ------- |
992 | 1095 |
993 This tutorial descends from a long line of Emacs tutorials | 1096 This tutorial descends from a long line of Emacs tutorials |
994 starting with the one written by Stuart Cracraft for the original Emacs. | 1097 starting with the one written by Stuart Cracraft for the original Emacs. |
1098 Ben Wing updated the tutorial for X Windows. | |
995 | 1099 |
996 This version of the tutorial, like GNU Emacs, is copyrighted, and | 1100 This version of the tutorial, like GNU Emacs, is copyrighted, and |
997 comes with permission to distribute copies on certain conditions: | 1101 comes with permission to distribute copies on certain conditions: |
998 | 1102 |
999 Copyright (c) 1985, 1996 Free Software Foundation | 1103 Copyright (c) 1985, 1996 Free Software Foundation |