annotate etc/TUTORIAL @ 16468:0927028baa82

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