Mercurial > emacs
annotate man/misc.texi @ 38135:f4830f2d181b
Document problems with compressed subdirs.el.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 20 Jun 2001 10:52:38 +0000 |
parents | 1471b85b3b80 |
children | 24fa5ae5fd91 |
rev | line source |
---|---|
25829 | 1 @c This is part of the Emacs manual. |
28125 | 2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000 |
3 @c Free Software Foundation, Inc. | |
25829 | 4 @c See file emacs.texi for copying conditions. |
5 @iftex | |
6 @chapter Miscellaneous Commands | |
7 | |
8 This chapter contains several brief topics that do not fit anywhere | |
9 else: reading netnews, running shell commands and shell subprocesses, | |
10 using a single shared Emacs for utilities that expect to run an editor | |
11 as a subprocess, printing hardcopy, sorting text, narrowing display to | |
12 part of the buffer, editing double-column files and binary files, saving | |
13 an Emacs session for later resumption, emulating other editors, and | |
14 various diversions and amusements. | |
15 | |
16 @end iftex | |
17 @node Gnus, Shell, Calendar/Diary, Top | |
18 @section Gnus | |
19 @cindex Gnus | |
20 @cindex reading netnews | |
21 | |
22 Gnus is an Emacs package primarily designed for reading and posting | |
23 Usenet news. It can also be used to read and respond to messages from a | |
24 number of other sources---mail, remote directories, digests, and so on. | |
25 | |
26 Here we introduce Gnus and describe several basic features. | |
27 @ifinfo | |
28 For full details, see @ref{Top, Gnus,, gnus, The Gnus Manual}. | |
29 @end ifinfo | |
30 @iftex | |
31 For full details on Gnus, type @kbd{M-x info} and then select the Gnus | |
32 manual. | |
33 @end iftex | |
34 | |
35 @findex gnus | |
36 To start Gnus, type @kbd{M-x gnus @key{RET}}. | |
37 | |
38 @menu | |
39 * Buffers of Gnus:: The group, summary, and article buffers. | |
40 * Gnus Startup:: What you should know about starting Gnus. | |
41 * Summary of Gnus:: A short description of the basic Gnus commands. | |
42 @end menu | |
43 | |
44 @node Buffers of Gnus | |
45 @subsection Gnus Buffers | |
46 | |
47 As opposed to most normal Emacs packages, Gnus uses a number of | |
48 different buffers to display information and to receive commands. The | |
49 three buffers users spend most of their time in are the @dfn{group | |
50 buffer}, the @dfn{summary buffer} and the @dfn{article buffer}. | |
51 | |
52 The @dfn{group buffer} contains a list of groups. This is the first | |
53 buffer Gnus displays when it starts up. It normally displays only the | |
54 groups to which you subscribe and that contain unread articles. Use | |
55 this buffer to select a specific group. | |
56 | |
57 The @dfn{summary buffer} lists one line for each article in a single | |
58 group. By default, the author, the subject and the line number are | |
59 displayed for each article, but this is customizable, like most aspects | |
60 of Gnus display. The summary buffer is created when you select a group | |
61 in the group buffer, and is killed when you exit the group. Use this | |
62 buffer to select an article. | |
63 | |
64 The @dfn{article buffer} displays the article. In normal Gnus usage, | |
65 you don't select this buffer---all useful article-oriented commands work | |
66 in the summary buffer. But you can select the article buffer, and | |
67 execute all Gnus commands from that buffer, if you want to. | |
68 | |
69 @node Gnus Startup | |
70 @subsection When Gnus Starts Up | |
71 | |
72 At startup, Gnus reads your @file{.newsrc} news initialization file | |
73 and attempts to communicate with the local news server, which is a | |
74 repository of news articles. The news server need not be the same | |
75 computer you are logged in on. | |
76 | |
77 If you start Gnus and connect to the server, but do not see any | |
78 newsgroups listed in the group buffer, type @kbd{L} or @kbd{A k} to get | |
79 a listing of all the groups. Then type @kbd{u} to toggle | |
80 subscription to groups. | |
81 | |
82 The first time you start Gnus, Gnus subscribes you to a few selected | |
83 groups. All other groups start out as @dfn{killed groups} for you; you | |
84 can list them with @kbd{A k}. All new groups that subsequently come to | |
85 exist at the news server become @dfn{zombie groups} for you; type @kbd{A | |
86 z} to list them. You can subscribe to a group shown in these lists | |
87 using the @kbd{u} command. | |
88 | |
89 When you quit Gnus with @kbd{q}, it automatically records in your | |
90 @file{.newsrc} and @file{.newsrc.eld} initialization files the | |
91 subscribed or unsubscribed status of all groups. You should normally | |
92 not edit these files manually, but you may if you know how. | |
93 | |
94 @node Summary of Gnus | |
95 @subsection Summary of Gnus Commands | |
96 | |
97 Reading news is a two step process: | |
98 | |
99 @enumerate | |
100 @item | |
101 Choose a group in the group buffer. | |
102 | |
103 @item | |
104 Select articles from the summary buffer. Each article selected is | |
105 displayed in the article buffer in a large window, below the summary | |
106 buffer in its small window. | |
107 @end enumerate | |
108 | |
109 Each Gnus buffer has its own special commands; however, the meanings | |
110 of any given key in the various Gnus buffers are usually analogous, even | |
111 if not identical. Here are commands for the group and summary buffers: | |
112 | |
113 @table @kbd | |
114 @kindex q @r{(Gnus Group mode)} | |
115 @findex gnus-group-exit | |
116 @item q | |
117 In the group buffer, update your @file{.newsrc} initialization file | |
118 and quit Gnus. | |
119 | |
120 In the summary buffer, exit the current group and return to the | |
121 group buffer. Thus, typing @kbd{q} twice quits Gnus. | |
122 | |
123 @kindex L @r{(Gnus Group mode)} | |
124 @findex gnus-group-list-all-groups | |
125 @item L | |
126 In the group buffer, list all the groups available on your news | |
127 server (except those you have killed). This may be a long list! | |
128 | |
129 @kindex l @r{(Gnus Group mode)} | |
130 @findex gnus-group-list-groups | |
131 @item l | |
132 In the group buffer, list only the groups to which you subscribe and | |
133 which contain unread articles. | |
134 | |
135 @kindex u @r{(Gnus Group mode)} | |
136 @findex gnus-group-unsubscribe-current-group | |
137 @cindex subscribe groups | |
138 @cindex unsubscribe groups | |
139 @item u | |
140 In the group buffer, unsubscribe from (or subscribe to) the group listed | |
141 in the line that point is on. When you quit Gnus by typing @kbd{q}, | |
142 Gnus lists in your @file{.newsrc} file which groups you have subscribed | |
143 to. The next time you start Gnus, you won't see this group, | |
144 because Gnus normally displays only subscribed-to groups. | |
145 | |
146 @kindex C-k @r{(Gnus)} | |
147 @findex gnus-group-kill-group | |
148 @item C-k | |
149 In the group buffer, ``kill'' the current line's group---don't | |
150 even list it in @file{.newsrc} from now on. This affects future | |
151 Gnus sessions as well as the present session. | |
152 | |
153 When you quit Gnus by typing @kbd{q}, Gnus writes information | |
154 in the file @file{.newsrc} describing all newsgroups except those you | |
155 have ``killed.'' | |
156 | |
157 @kindex SPC @r{(Gnus)} | |
158 @findex gnus-group-read-group | |
159 @item @key{SPC} | |
160 In the group buffer, select the group on the line under the cursor | |
161 and display the first unread article in that group. | |
162 | |
163 @need 1000 | |
164 In the summary buffer, | |
165 | |
166 @itemize @bullet | |
167 @item | |
168 Select the article on the line under the cursor if none is selected. | |
169 | |
170 @item | |
171 Scroll the text of the selected article (if there is one). | |
172 | |
173 @item | |
174 Select the next unread article if at the end of the current article. | |
175 @end itemize | |
176 | |
177 Thus, you can move through all the articles by repeatedly typing @key{SPC}. | |
178 | |
179 @kindex DEL @r{(Gnus)} | |
180 @item @key{DEL} | |
181 In the group buffer, move point to the previous group containing | |
182 unread articles. | |
183 | |
184 @findex gnus-summary-prev-page | |
185 In the summary buffer, scroll the text of the article backwards. | |
186 | |
187 @kindex n @r{(Gnus)} | |
188 @findex gnus-group-next-unread-group | |
189 @findex gnus-summary-next-unread-article | |
190 @item n | |
191 Move point to the next unread group, or select the next unread article. | |
192 | |
193 @kindex p @r{(Gnus)} | |
194 @findex gnus-group-prev-unread-group | |
195 @findex gnus-summary-prev-unread-article | |
196 @item p | |
197 Move point to the previous unread group, or select the previous | |
198 unread article. | |
199 | |
200 @kindex C-n @r{(Gnus Group mode)} | |
201 @findex gnus-group-next-group | |
202 @kindex C-p @r{(Gnus Group mode)} | |
203 @findex gnus-group-prev-group | |
204 @kindex C-n @r{(Gnus Summary mode)} | |
205 @findex gnus-summary-next-subject | |
206 @kindex C-p @r{(Gnus Summary mode)} | |
207 @findex gnus-summary-prev-subject | |
208 @item C-n | |
209 @itemx C-p | |
210 Move point to the next or previous item, even if it is marked as read. | |
211 This does not select the article or group on that line. | |
212 | |
213 @kindex s @r{(Gnus Summary mode)} | |
214 @findex gnus-summary-isearch-article | |
215 @item s | |
216 In the summary buffer, do an incremental search of the current text in | |
217 the article buffer, just as if you switched to the article buffer and | |
218 typed @kbd{C-s}. | |
219 | |
220 @kindex M-s @r{(Gnus Summary mode)} | |
221 @findex gnus-summary-search-article-forward | |
222 @item M-s @var{regexp} @key{RET} | |
223 In the summary buffer, search forward for articles containing a match | |
224 for @var{regexp}. | |
225 | |
226 @end table | |
227 | |
228 @ignore | |
229 @node Where to Look | |
230 @subsection Where to Look Further | |
231 | |
232 @c Too many references to the name of the manual if done with xref in TeX! | |
233 Gnus is powerful and customizable. Here are references to a few | |
234 @ifinfo | |
235 additional topics: | |
236 | |
237 @end ifinfo | |
238 @iftex | |
239 additional topics in @cite{The Gnus Manual}: | |
240 | |
241 @itemize @bullet | |
242 @item | |
243 Follow discussions on specific topics.@* | |
244 See section ``Threading.'' | |
245 | |
246 @item | |
247 Read digests. See section ``Document Groups.'' | |
248 | |
249 @item | |
250 Refer to and jump to the parent of the current article.@* | |
251 See section ``Finding the Parent.'' | |
252 | |
253 @item | |
254 Refer to articles by using Message-IDs included in the messages.@* | |
255 See section ``Article Keymap.'' | |
256 | |
257 @item | |
258 Save articles. See section ``Saving Articles.'' | |
259 | |
260 @item | |
261 Have Gnus score articles according to various criteria, like author | |
262 name, subject, or string in the body of the articles.@* | |
263 See section ``Scoring.'' | |
264 | |
265 @item | |
266 Send an article to a newsgroup.@* | |
267 See section ``Composing Messages.'' | |
268 @end itemize | |
269 @end iftex | |
270 @ifinfo | |
271 @itemize @bullet | |
272 @item | |
273 Follow discussions on specific topics.@* | |
274 @xref{Threading, , Reading Based on Conversation Threads, | |
275 gnus, The Gnus Manual}. | |
276 | |
277 @item | |
278 Read digests. @xref{Document Groups, , , gnus, The Gnus Manual}. | |
279 | |
280 @item | |
281 Refer to and jump to the parent of the current article.@* | |
282 @xref{Finding the Parent, , , gnus, The Gnus Manual}. | |
283 | |
284 @item | |
285 Refer to articles by using Message-IDs included in the messages.@* | |
286 @xref{Article Keymap, , , gnus, The Gnus Manual}. | |
287 | |
288 @item | |
289 Save articles. @xref{Saving Articles, , , gnus, The Gnus Manual}. | |
290 | |
291 @item | |
292 Have Gnus score articles according to various criteria, like author | |
293 name, subject, or string in the body of the articles.@* | |
294 @xref{Scoring, , , gnus, The Gnus Manual}. | |
295 | |
296 @item | |
297 Send an article to a newsgroup.@* | |
298 @xref{Composing Messages, , , gnus, The Gnus Manual}. | |
299 @end itemize | |
300 @end ifinfo | |
301 @end ignore | |
302 | |
303 @node Shell, Emacs Server, Gnus, Top | |
304 @section Running Shell Commands from Emacs | |
305 @cindex subshell | |
306 @cindex shell commands | |
307 | |
308 Emacs has commands for passing single command lines to inferior shell | |
33382 | 309 processes; it can also run a shell interactively with input and output |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
310 to an Emacs buffer named @samp{*shell*} or run a shell inside a terminal |
33382 | 311 emulator window. |
312 | |
313 There is a shell implemented entirely in Emacs, documented in a separate | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
314 manual. @xref{Top,Eshell,Eshell, eshell, Eshell: The Emacs Shell}. |
25829 | 315 |
316 @table @kbd | |
317 @item M-! @var{cmd} @key{RET} | |
318 Run the shell command line @var{cmd} and display the output | |
319 (@code{shell-command}). | |
320 @item M-| @var{cmd} @key{RET} | |
321 Run the shell command line @var{cmd} with region contents as input; | |
322 optionally replace the region with the output | |
323 (@code{shell-command-on-region}). | |
324 @item M-x shell | |
325 Run a subshell with input and output through an Emacs buffer. | |
326 You can then give commands interactively. | |
27210 | 327 @item M-x term |
328 Run a subshell with input and output through an Emacs buffer. | |
329 You can then give commands interactively. | |
330 Full terminal emulation is available. | |
33382 | 331 @item M-x eshell |
332 @findex eshell | |
333 Start the Emacs shell. | |
25829 | 334 @end table |
335 | |
336 @menu | |
337 * Single Shell:: How to run one shell command and return. | |
338 * Interactive Shell:: Permanent shell taking input via Emacs. | |
339 * Shell Mode:: Special Emacs commands used with permanent shell. | |
340 * History: Shell History. Repeating previous commands in a shell buffer. | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
341 * Directory Tracking:: Keeping track when the subshell changes directory. |
25829 | 342 * Options: Shell Options. Options for customizing Shell mode. |
27210 | 343 * Terminal emulator:: An Emacs window as a terminal emulator. |
344 * Term Mode:: Special Emacs commands used in Term mode. | |
345 * Paging in Term:: Paging in the terminal emulator. | |
25829 | 346 * Remote Host:: Connecting to another computer. |
347 @end menu | |
348 | |
349 @node Single Shell | |
350 @subsection Single Shell Commands | |
351 | |
352 @kindex M-! | |
353 @findex shell-command | |
354 @kbd{M-!} (@code{shell-command}) reads a line of text using the | |
355 minibuffer and executes it as a shell command in a subshell made just | |
356 for that command. Standard input for the command comes from the null | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
357 device. If the shell command produces any output, the output appears |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
358 either in the echo area (if it is short), or in an Emacs buffer named |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
359 @samp{*Shell Command Output*}, which is displayed in another window |
38132
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
360 but not selected (if the output is long). |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
361 |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
362 For instance, one way to decompress a file @file{foo.gz} from Emacs |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
363 is to type @kbd{M-! gunzip foo.gz @key{RET}}. That shell command |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
364 normally creates the file @file{foo} and produces no terminal output. |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
365 |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
366 A numeric argument, as in @kbd{M-1 M-!}, says to insert terminal |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
367 output into the current buffer instead of a separate buffer. It puts |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
368 point before the output, and sets the mark after the output. For |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
369 instance, @kbd{M-1 M-! gunzip < foo.gz @key{RET}} would insert the |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
370 uncompressed equivalent of @file{foo.gz} into the current buffer. |
25829 | 371 |
372 If the shell command line ends in @samp{&}, it runs asynchronously. | |
373 For a synchronous shell command, @code{shell-command} returns the | |
374 command's exit status (0 means success), when it is called from a Lisp | |
38132
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
375 program. You do not get any status information for an asynchronous |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
376 command, since it hasn't finished yet. |
25829 | 377 |
378 @kindex M-| | |
379 @findex shell-command-on-region | |
380 @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!} but | |
381 passes the contents of the region as the standard input to the shell | |
382 command, instead of no input. If a numeric argument is used, meaning | |
383 insert the output in the current buffer, then the old region is deleted | |
384 first and the output replaces it as the contents of the region. It | |
385 returns the command's exit status when it is called from a Lisp program. | |
386 | |
38132
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
387 One use for @kbd{M-|} is to run @code{uudecode}. For instance, if |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
388 the buffer contains uuencoded text, type @kbd{C-x h M-| uudecode |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
389 @key{RET}} to feed the entire buffer contents to the @code{uudecode} |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
390 program. That program will ignore everything except the encoded text, |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
391 and will store the decoded output into the file whose name is |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
392 specified in the encoded text. |
1471b85b3b80
Give examples for M-! and M-|.
Richard M. Stallman <rms@gnu.org>
parents:
38025
diff
changeset
|
393 |
25829 | 394 @vindex shell-file-name |
395 @cindex environment | |
396 Both @kbd{M-!} and @kbd{M-|} use @code{shell-file-name} to specify the | |
29107 | 397 shell to use. This variable is initialized based on your @env{SHELL} |
25829 | 398 environment variable when Emacs is started. If the file name does not |
399 specify a directory, the directories in the list @code{exec-path} are | |
400 searched; this list is initialized based on the environment variable | |
29107 | 401 @env{PATH} when Emacs is started. Your @file{.emacs} file can override |
25829 | 402 either or both of these default initializations.@refill |
403 | |
404 Both @kbd{M-!} and @kbd{M-|} wait for the shell command to complete. | |
405 To stop waiting, type @kbd{C-g} to quit; that terminates the shell | |
406 command with the signal @code{SIGINT}---the same signal that @kbd{C-c} | |
407 normally generates in the shell. Emacs waits until the command actually | |
408 terminates. If the shell command doesn't stop (because it ignores the | |
409 @code{SIGINT} signal), type @kbd{C-g} again; this sends the command a | |
410 @code{SIGKILL} signal which is impossible to ignore. | |
411 | |
412 To specify a coding system for @kbd{M-!} or @kbd{M-|}, use the command | |
413 @kbd{C-x @key{RET} c} immediately beforehand. @xref{Specify Coding}. | |
414 | |
415 @vindex shell-command-default-error-buffer | |
416 Error output from the command is normally intermixed with the regular | |
417 output. If you set the variable | |
418 @code{shell-command-default-error-buffer} to a string, which is a buffer | |
419 name, error output is inserted before point in the buffer of that name. | |
420 | |
421 @node Interactive Shell | |
422 @subsection Interactive Inferior Shell | |
423 | |
424 @findex shell | |
425 To run a subshell interactively, putting its typescript in an Emacs | |
426 buffer, use @kbd{M-x shell}. This creates (or reuses) a buffer named | |
427 @samp{*shell*} and runs a subshell with input coming from and output going | |
428 to that buffer. That is to say, any ``terminal output'' from the subshell | |
429 goes into the buffer, advancing point, and any ``terminal input'' for | |
430 the subshell comes from text in the buffer. To give input to the subshell, | |
431 go to the end of the buffer and type the input, terminated by @key{RET}. | |
432 | |
433 Emacs does not wait for the subshell to do anything. You can switch | |
434 windows or buffers and edit them while the shell is waiting, or while it is | |
435 running a command. Output from the subshell waits until Emacs has time to | |
436 process it; this happens whenever Emacs is waiting for keyboard input or | |
437 for time to elapse. | |
438 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
439 @cindex @code{comint-highlight-input} face |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
440 @cindex @code{comint-highlight-prompt} face |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
441 Input lines, once you submit them, are displayed using the face |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
442 @code{comint-highlight-input}, and prompts are displayed using the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
443 face @code{comint-highlight-prompt}. This makes it easier to see |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
444 previous input lines in the buffer. @xref{Faces}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
445 |
25829 | 446 To make multiple subshells, rename the buffer @samp{*shell*} to |
447 something different using @kbd{M-x rename-uniquely}. Then type @kbd{M-x | |
448 shell} again to create a new buffer @samp{*shell*} with its own | |
449 subshell. If you rename this buffer as well, you can create a third | |
450 one, and so on. All the subshells run independently and in parallel. | |
451 | |
452 @vindex explicit-shell-file-name | |
29107 | 453 @cindex @env{ESHELL} environment variable |
454 @cindex @env{SHELL} environment variable | |
25829 | 455 The file name used to load the subshell is the value of the variable |
456 @code{explicit-shell-file-name}, if that is non-@code{nil}. Otherwise, | |
29107 | 457 the environment variable @env{ESHELL} is used, or the environment |
458 variable @env{SHELL} if there is no @env{ESHELL}. If the file name | |
25829 | 459 specified is relative, the directories in the list @code{exec-path} are |
460 searched; this list is initialized based on the environment variable | |
29107 | 461 @env{PATH} when Emacs is started. Your @file{.emacs} file can override |
25829 | 462 either or both of these default initializations. |
463 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
464 Emacs sends the new shell the contents of the file |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
465 @file{~/.emacs_@var{shellname}} as input, if it exists, where |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
466 @var{shellname} is the name of the file that the shell was loaded |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
467 from. For example, if you use bash, the file sent to it is |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
468 @file{~/.emacs_bash}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
469 |
25829 | 470 To specify a coding system for the shell, you can use the command |
471 @kbd{C-x @key{RET} c} immediately before @kbd{M-x shell}. You can also | |
472 specify a coding system after starting the shell by using @kbd{C-x | |
473 @key{RET} p} in the shell buffer. @xref{Specify Coding}. | |
474 | |
29107 | 475 Emacs defines the environment variable @env{EMACS} in the subshell, |
25829 | 476 with value @code{t}. A shell script can check this variable to |
477 determine whether it has been run from an Emacs subshell. | |
478 | |
479 @node Shell Mode | |
480 @subsection Shell Mode | |
481 @cindex Shell mode | |
482 @cindex mode, Shell | |
483 | |
484 Shell buffers use Shell mode, which defines several special keys | |
485 attached to the @kbd{C-c} prefix. They are chosen to resemble the usual | |
486 editing and job control characters present in shells that are not under | |
487 Emacs, except that you must type @kbd{C-c} first. Here is a complete list | |
488 of the special key bindings of Shell mode: | |
489 | |
490 @table @kbd | |
491 @item @key{RET} | |
492 @kindex RET @r{(Shell mode)} | |
493 @findex comint-send-input | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
494 At end of buffer send line as input; otherwise, copy current line to |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
495 end of buffer and send it (@code{comint-send-input}). When a line is |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
496 copied, any prompt at the beginning of the line (text output by |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
497 programs preceding your input) is omitted. (See also the variable |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
498 @code{comint-use-prompt-regexp-instead-of-fields}.) |
25829 | 499 |
500 @item @key{TAB} | |
501 @kindex TAB @r{(Shell mode)} | |
502 @findex comint-dynamic-complete | |
503 Complete the command name or file name before point in the shell buffer | |
504 (@code{comint-dynamic-complete}). @key{TAB} also completes history | |
505 references (@pxref{History References}) and environment variable names. | |
506 | |
507 @vindex shell-completion-fignore | |
508 @vindex comint-completion-fignore | |
509 The variable @code{shell-completion-fignore} specifies a list of file | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
510 name extensions to ignore in Shell mode completion. The default |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
511 setting is @code{nil}, but some users prefer @code{("~" "#" "%")} to |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
512 ignore file names ending in @samp{~}, @samp{#} or @samp{%}. Other |
25829 | 513 related Comint modes use the variable @code{comint-completion-fignore} |
514 instead. | |
515 | |
516 @item M-? | |
517 @kindex M-? @r{(Shell mode)} | |
518 @findex comint-dynamic-list-filename@dots{} | |
519 Display temporarily a list of the possible completions of the file name | |
520 before point in the shell buffer | |
521 (@code{comint-dynamic-list-filename-completions}). | |
522 | |
523 @item C-d | |
524 @kindex C-d @r{(Shell mode)} | |
525 @findex comint-delchar-or-maybe-eof | |
26290 | 526 Either delete a character or send @sc{eof} |
25829 | 527 (@code{comint-delchar-or-maybe-eof}). Typed at the end of the shell |
26290 | 528 buffer, @kbd{C-d} sends @sc{eof} to the subshell. Typed at any other |
25829 | 529 position in the buffer, @kbd{C-d} deletes a character as usual. |
530 | |
531 @item C-c C-a | |
532 @kindex C-c C-a @r{(Shell mode)} | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
533 @findex comint-bol-or-process-mark |
25829 | 534 Move to the beginning of the line, but after the prompt if any |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
535 (@code{comint-bol-or-process-mark}). If you repeat this command twice |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
536 in a row, the second time it moves back to the process mark, which is |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
537 the beginning of the input that you have not yet sent to the subshell. |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
538 (Normally that is the same place---the end of the prompt on this |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
539 line---but after @kbd{C-c @key{SPC}} the process mark may be in a |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
540 previous line.) |
25829 | 541 |
542 @item C-c @key{SPC} | |
543 Accumulate multiple lines of input, then send them together. This | |
544 command inserts a newline before point, but does not send the preceding | |
545 text as input to the subshell---at least, not yet. Both lines, the one | |
546 before this newline and the one after, will be sent together (along with | |
547 the newline that separates them), when you type @key{RET}. | |
548 | |
549 @item C-c C-u | |
550 @kindex C-c C-u @r{(Shell mode)} | |
551 @findex comint-kill-input | |
552 Kill all text pending at end of buffer to be sent as input | |
553 (@code{comint-kill-input}). | |
554 | |
555 @item C-c C-w | |
556 @kindex C-c C-w @r{(Shell mode)} | |
557 Kill a word before point (@code{backward-kill-word}). | |
558 | |
559 @item C-c C-c | |
560 @kindex C-c C-c @r{(Shell mode)} | |
561 @findex comint-interrupt-subjob | |
562 Interrupt the shell or its current subjob if any | |
563 (@code{comint-interrupt-subjob}). This command also kills | |
564 any shell input pending in the shell buffer and not yet sent. | |
565 | |
566 @item C-c C-z | |
567 @kindex C-c C-z @r{(Shell mode)} | |
568 @findex comint-stop-subjob | |
569 Stop the shell or its current subjob if any (@code{comint-stop-subjob}). | |
570 This command also kills any shell input pending in the shell buffer and | |
571 not yet sent. | |
572 | |
573 @item C-c C-\ | |
574 @findex comint-quit-subjob | |
575 @kindex C-c C-\ @r{(Shell mode)} | |
576 Send quit signal to the shell or its current subjob if any | |
577 (@code{comint-quit-subjob}). This command also kills any shell input | |
578 pending in the shell buffer and not yet sent. | |
579 | |
580 @item C-c C-o | |
581 @kindex C-c C-o @r{(Shell mode)} | |
32637 | 582 @findex comint-delete-output |
583 Delete the last batch of output from a shell command | |
584 (@code{comint-delete-output}). This is useful if a shell command spews | |
585 out lots of output that just gets in the way. This command used to be | |
586 called @code{comint-kill-output}. | |
587 | |
588 @item C-c C-s | |
589 @kindex C-c C-s @r{(Shell mode)} | |
590 @findex comint-write-output | |
591 Write the last batch of output from a shell command to a file | |
592 (@code{comint-write-output}). With a prefix argument, the file is | |
593 appended to instead. Any prompt at the end of the output is not | |
594 written. | |
25829 | 595 |
596 @item C-c C-r | |
597 @itemx C-M-l | |
598 @kindex C-c C-r @r{(Shell mode)} | |
599 @kindex C-M-l @r{(Shell mode)} | |
600 @findex comint-show-output | |
601 Scroll to display the beginning of the last batch of output at the top | |
602 of the window; also move the cursor there (@code{comint-show-output}). | |
603 | |
604 @item C-c C-e | |
605 @kindex C-c C-e @r{(Shell mode)} | |
606 @findex comint-show-maximum-output | |
607 Scroll to put the end of the buffer at the bottom of the window | |
608 (@code{comint-show-maximum-output}). | |
609 | |
610 @item C-c C-f | |
611 @kindex C-c C-f @r{(Shell mode)} | |
612 @findex shell-forward-command | |
613 @vindex shell-command-regexp | |
614 Move forward across one shell command, but not beyond the current line | |
615 (@code{shell-forward-command}). The variable @code{shell-command-regexp} | |
616 specifies how to recognize the end of a command. | |
617 | |
618 @item C-c C-b | |
619 @kindex C-c C-b @r{(Shell mode)} | |
620 @findex shell-backward-command | |
621 Move backward across one shell command, but not beyond the current line | |
622 (@code{shell-backward-command}). | |
623 | |
624 @item C-c C-l | |
625 @kindex C-c C-l @r{(Shell mode)} | |
626 @findex comint-dynamic-list-input-ring | |
627 Display the buffer's history of shell commands in another window | |
628 (@code{comint-dynamic-list-input-ring}). | |
629 | |
630 @item M-x dirs | |
631 Ask the shell what its current directory is, so that Emacs can agree | |
632 with the shell. | |
633 | |
634 @item M-x send-invisible @key{RET} @var{text} @key{RET} | |
635 @findex send-invisible | |
636 Send @var{text} as input to the shell, after reading it without | |
637 echoing. This is useful when a shell command runs a program that asks | |
638 for a password. | |
639 | |
640 Alternatively, you can arrange for Emacs to notice password prompts | |
641 and turn off echoing for them, as follows: | |
642 | |
643 @example | |
644 (add-hook 'comint-output-filter-functions | |
645 'comint-watch-for-password-prompt) | |
646 @end example | |
647 | |
648 @item M-x comint-continue-subjob | |
649 @findex comint-continue-subjob | |
650 Continue the shell process. This is useful if you accidentally suspend | |
651 the shell process.@footnote{You should not suspend the shell process. | |
652 Suspending a subjob of the shell is a completely different matter---that | |
653 is normal practice, but you must use the shell to continue the subjob; | |
654 this command won't do it.} | |
655 | |
656 @item M-x comint-strip-ctrl-m | |
657 @findex comint-strip-ctrl-m | |
658 Discard all control-M characters from the current group of shell output. | |
659 The most convenient way to use this command is to make it run | |
660 automatically when you get output from the subshell. To do that, | |
661 evaluate this Lisp expression: | |
662 | |
663 @example | |
664 (add-hook 'comint-output-filter-functions | |
665 'comint-strip-ctrl-m) | |
666 @end example | |
667 | |
668 @item M-x comint-truncate-buffer | |
669 @findex comint-truncate-buffer | |
670 This command truncates the shell buffer to a certain maximum number of | |
671 lines, specified by the variable @code{comint-buffer-maximum-size}. | |
672 Here's how to do this automatically each time you get output from the | |
673 subshell: | |
674 | |
675 @example | |
676 (add-hook 'comint-output-filter-functions | |
677 'comint-truncate-buffer) | |
678 @end example | |
679 @end table | |
680 | |
681 Shell mode also customizes the paragraph commands so that only shell | |
682 prompts start new paragraphs. Thus, a paragraph consists of an input | |
683 command plus the output that follows it in the buffer. | |
684 | |
685 @cindex Comint mode | |
686 @cindex mode, Comint | |
687 Shell mode is a derivative of Comint mode, a general-purpose mode for | |
688 communicating with interactive subprocesses. Most of the features of | |
689 Shell mode actually come from Comint mode, as you can see from the | |
32516
f89fc1421b53
Update references to shell prompts and comint-prompt-regexp, etc.
Miles Bader <miles@gnu.org>
parents:
31310
diff
changeset
|
690 command names listed above. The special features of Shell mode include |
f89fc1421b53
Update references to shell prompts and comint-prompt-regexp, etc.
Miles Bader <miles@gnu.org>
parents:
31310
diff
changeset
|
691 the directory tracking feature, and a few user commands. |
25829 | 692 |
693 Other Emacs features that use variants of Comint mode include GUD | |
694 (@pxref{Debuggers}) and @kbd{M-x run-lisp} (@pxref{External Lisp}). | |
695 | |
696 @findex comint-run | |
697 You can use @kbd{M-x comint-run} to execute any program of your choice | |
698 in a subprocess using unmodified Comint mode---without the | |
699 specializations of Shell mode. | |
700 | |
701 @node Shell History | |
702 @subsection Shell Command History | |
703 | |
704 Shell buffers support three ways of repeating earlier commands. You | |
705 can use the same keys used in the minibuffer; these work much as they do | |
706 in the minibuffer, inserting text from prior commands while point | |
707 remains always at the end of the buffer. You can move through the | |
708 buffer to previous inputs in their original place, then resubmit them or | |
709 copy them to the end. Or you can use a @samp{!}-style history | |
710 reference. | |
711 | |
712 @menu | |
713 * Ring: Shell Ring. Fetching commands from the history list. | |
714 * Copy: Shell History Copying. Moving to a command and then copying it. | |
715 * History References:: Expanding @samp{!}-style history references. | |
716 @end menu | |
717 | |
718 @node Shell Ring | |
719 @subsubsection Shell History Ring | |
720 | |
721 @table @kbd | |
722 @findex comint-previous-input | |
723 @kindex M-p @r{(Shell mode)} | |
724 @item M-p | |
725 Fetch the next earlier old shell command. | |
726 | |
727 @kindex M-n @r{(Shell mode)} | |
728 @findex comint-next-input | |
729 @item M-n | |
730 Fetch the next later old shell command. | |
731 | |
732 @kindex M-r @r{(Shell mode)} | |
733 @kindex M-s @r{(Shell mode)} | |
734 @findex comint-previous-matching-input | |
735 @findex comint-next-matching-input | |
736 @item M-r @var{regexp} @key{RET} | |
737 @itemx M-s @var{regexp} @key{RET} | |
738 Search backwards or forwards for old shell commands that match @var{regexp}. | |
739 | |
740 @item C-c C-x @r{(Shell mode)} | |
741 @findex comint-get-next-from-history | |
742 Fetch the next subsequent command from the history. | |
743 @end table | |
744 | |
745 Shell buffers provide a history of previously entered shell commands. To | |
746 reuse shell commands from the history, use the editing commands @kbd{M-p}, | |
747 @kbd{M-n}, @kbd{M-r} and @kbd{M-s}. These work just like the minibuffer | |
748 history commands except that they operate on the text at the end of the | |
749 shell buffer, where you would normally insert text to send to the shell. | |
750 | |
751 @kbd{M-p} fetches an earlier shell command to the end of the shell buffer. | |
752 Successive use of @kbd{M-p} fetches successively earlier shell commands, | |
753 each replacing any text that was already present as potential shell input. | |
754 @kbd{M-n} does likewise except that it finds successively more recent shell | |
755 commands from the buffer. | |
756 | |
757 The history search commands @kbd{M-r} and @kbd{M-s} read a regular | |
758 expression and search through the history for a matching command. Aside | |
759 from the choice of which command to fetch, they work just like @kbd{M-p} | |
760 and @kbd{M-r}. If you enter an empty regexp, these commands reuse the | |
761 same regexp used last time. | |
762 | |
763 When you find the previous input you want, you can resubmit it by | |
764 typing @key{RET}, or you can edit it first and then resubmit it if you | |
765 wish. | |
766 | |
767 Often it is useful to reexecute several successive shell commands that | |
768 were previously executed in sequence. To do this, first find and | |
769 reexecute the first command of the sequence. Then type @kbd{C-c C-x}; | |
770 that will fetch the following command---the one that follows the command | |
771 you just repeated. Then type @key{RET} to reexecute this command. You | |
772 can reexecute several successive commands by typing @kbd{C-c C-x | |
773 @key{RET}} over and over. | |
774 | |
775 These commands get the text of previous shell commands from a special | |
776 history list, not from the shell buffer itself. Thus, editing the shell | |
777 buffer, or even killing large parts of it, does not affect the history | |
778 that these commands access. | |
779 | |
780 @vindex shell-input-ring-file-name | |
781 Some shells store their command histories in files so that you can | |
782 refer to previous commands from previous shell sessions. Emacs reads | |
783 the command history file for your chosen shell, to initialize its own | |
784 command history. The file name is @file{~/.bash_history} for bash, | |
785 @file{~/.sh_history} for ksh, and @file{~/.history} for other shells. | |
786 | |
787 @node Shell History Copying | |
788 @subsubsection Shell History Copying | |
789 | |
790 @table @kbd | |
791 @kindex C-c C-p @r{(Shell mode)} | |
792 @findex comint-previous-prompt | |
793 @item C-c C-p | |
794 Move point to the previous prompt (@code{comint-previous-prompt}). | |
795 | |
796 @kindex C-c C-n @r{(Shell mode)} | |
797 @findex comint-next-prompt | |
798 @item C-c C-n | |
799 Move point to the following prompt (@code{comint-next-prompt}). | |
800 | |
801 @kindex C-c RET @r{(Shell mode)} | |
802 @findex comint-copy-old-input | |
803 @item C-c @key{RET} | |
804 Copy the input command which point is in, inserting the copy at the end | |
805 of the buffer (@code{comint-copy-old-input}). This is useful if you | |
806 move point back to a previous command. After you copy the command, you | |
807 can submit the copy as input with @key{RET}. If you wish, you can | |
808 edit the copy before resubmitting it. | |
809 @end table | |
810 | |
811 Moving to a previous input and then copying it with @kbd{C-c | |
812 @key{RET}} produces the same results---the same buffer contents---that | |
813 you would get by using @kbd{M-p} enough times to fetch that previous | |
814 input from the history list. However, @kbd{C-c @key{RET}} copies the | |
815 text from the buffer, which can be different from what is in the history | |
816 list if you edit the input text in the buffer after it has been sent. | |
817 | |
818 @node History References | |
819 @subsubsection Shell History References | |
820 @cindex history reference | |
821 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
822 Various shells including csh and bash support @dfn{history |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
823 references} that begin with @samp{!} and @samp{^}. Shell mode |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
824 recognizes these constructs, and can perform the history substitution |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
825 for you. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
826 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
827 If you insert a history reference and type @key{TAB}, this searches |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
828 the input history for a matching command, performs substitution if |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
829 necessary, and places the result in the buffer in place of the history |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
830 reference. For example, you can fetch the most recent command |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
831 beginning with @samp{mv} with @kbd{! m v @key{TAB}}. You can edit the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
832 command if you wish, and then resubmit the command to the shell by |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
833 typing @key{RET}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
834 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
835 @vindex comint-input-autoexpand |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
836 @findex comint-magic-space |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
837 Shell mode can optionally expand history references in the buffer |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
838 when you send them to the shell. To request this, set the variable |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
839 @code{comint-input-autoexpand} to @code{input}. You can make |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
840 @key{SPC} perform history expansion by binding @key{SPC} to the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
841 command @code{comint-magic-space}. |
25829 | 842 |
843 @vindex shell-prompt-pattern | |
844 @vindex comint-prompt-regexp | |
32516
f89fc1421b53
Update references to shell prompts and comint-prompt-regexp, etc.
Miles Bader <miles@gnu.org>
parents:
31310
diff
changeset
|
845 @vindex comint-use-prompt-regexp-instead-of-fields |
f89fc1421b53
Update references to shell prompts and comint-prompt-regexp, etc.
Miles Bader <miles@gnu.org>
parents:
31310
diff
changeset
|
846 @cindex prompt, shell |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
847 Shell mode recognizes history references when they follow a prompt. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
848 Normally, any text output by a program at the beginning of an input |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
849 line is considered a prompt. However, if the variable |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
850 @code{comint-use-prompt-regexp-instead-of-fields} is non-@code{nil}, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
851 then Comint mode uses a regular expression to recognize prompts. In |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
852 general, the variable @code{comint-prompt-regexp} specifies the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
853 regular expression; Shell mode uses the variable |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
854 @code{shell-prompt-pattern} to set up @code{comint-prompt-regexp} in |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
855 the shell buffer. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
856 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
857 @node Directory Tracking |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
858 @subsection Directory Tracking |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
859 @cindex directory tracking |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
860 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
861 @vindex shell-pushd-regexp |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
862 @vindex shell-popd-regexp |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
863 @vindex shell-cd-regexp |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
864 Shell mode keeps track of @samp{cd}, @samp{pushd} and @samp{popd} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
865 commands given to the inferior shell, so it can keep the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
866 @samp{*shell*} buffer's default directory the same as the shell's |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
867 working directory. It recognizes these commands syntactically, by |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
868 examining lines of input that are sent. |
25829 | 869 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
870 If you use aliases for these commands, you can tell Emacs to |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
871 recognize them also. For example, if the value of the variable |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
872 @code{shell-pushd-regexp} matches the beginning of a shell command |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
873 line, that line is regarded as a @code{pushd} command. Change this |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
874 variable when you add aliases for @samp{pushd}. Likewise, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
875 @code{shell-popd-regexp} and @code{shell-cd-regexp} are used to |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
876 recognize commands with the meaning of @samp{popd} and @samp{cd}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
877 These commands are recognized only at the beginning of a shell command |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
878 line. |
25829 | 879 |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
880 @ignore @c This seems to have been deleted long ago. |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
881 @vindex shell-set-directory-error-hook |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
882 If Emacs gets an error while trying to handle what it believes is a |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
883 @samp{cd}, @samp{pushd} or @samp{popd} command, it runs the hook |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
884 @code{shell-set-directory-error-hook} (@pxref{Hooks}). |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
885 @end ignore |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
886 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
887 @findex dirs |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
888 If Emacs gets confused about changes in the current directory of the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
889 subshell, use the command @kbd{M-x dirs} to ask the shell what its |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
890 current directory is. This command works for shells that support the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
891 most common command syntax; it may not work for unusual shells. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
892 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
893 @findex dirtrack-mode |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
894 You can also use @kbd{M-x dirtrack-mode} to enable (or disable) an |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
895 alternative and more aggressive method of tracking changes in the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
896 current directory. |
25829 | 897 |
898 @node Shell Options | |
899 @subsection Shell Mode Options | |
900 | |
901 @vindex comint-scroll-to-bottom-on-input | |
902 If the variable @code{comint-scroll-to-bottom-on-input} is | |
903 non-@code{nil}, insertion and yank commands scroll the selected window | |
904 to the bottom before inserting. | |
905 | |
906 @vindex comint-scroll-show-maximum-output | |
907 If @code{comint-scroll-show-maximum-output} is non-@code{nil}, then | |
908 scrolling due to arrival of output tries to place the last line of text | |
909 at the bottom line of the window, so as to show as much useful text as | |
910 possible. (This mimics the scrolling behavior of many terminals.) | |
911 The default is @code{nil}. | |
912 | |
913 @vindex comint-scroll-to-bottom-on-output | |
914 By setting @code{comint-scroll-to-bottom-on-output}, you can opt for | |
915 having point jump to the end of the buffer whenever output arrives---no | |
916 matter where in the buffer point was before. If the value is | |
917 @code{this}, point jumps in the selected window. If the value is | |
918 @code{all}, point jumps in each window that shows the comint buffer. If | |
919 the value is @code{other}, point jumps in all nonselected windows that | |
920 show the current buffer. The default value is @code{nil}, which means | |
921 point does not jump to the end. | |
922 | |
923 @vindex comint-input-ignoredups | |
924 The variable @code{comint-input-ignoredups} controls whether successive | |
925 identical inputs are stored in the input history. A non-@code{nil} | |
926 value means to omit an input that is the same as the previous input. | |
927 The default is @code{nil}, which means to store each input even if it is | |
928 equal to the previous input. | |
929 | |
930 @vindex comint-completion-addsuffix | |
931 @vindex comint-completion-recexact | |
932 @vindex comint-completion-autolist | |
933 Three variables customize file name completion. The variable | |
934 @code{comint-completion-addsuffix} controls whether completion inserts a | |
935 space or a slash to indicate a fully completed file or directory name | |
936 (non-@code{nil} means do insert a space or slash). | |
937 @code{comint-completion-recexact}, if non-@code{nil}, directs @key{TAB} | |
938 to choose the shortest possible completion if the usual Emacs completion | |
939 algorithm cannot add even a single character. | |
940 @code{comint-completion-autolist}, if non-@code{nil}, says to list all | |
941 the possible completions whenever completion is not exact. | |
942 | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
943 @vindex shell-completion-execonly |
25829 | 944 Command completion normally considers only executable files. |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
945 If you set @code{shell-completion-execonly} to @code{nil}, |
25829 | 946 it considers nonexecutable files as well. |
947 | |
948 @findex shell-pushd-tohome | |
949 @findex shell-pushd-dextract | |
950 @findex shell-pushd-dunique | |
951 You can configure the behavior of @samp{pushd}. Variables control | |
952 whether @samp{pushd} behaves like @samp{cd} if no argument is given | |
953 (@code{shell-pushd-tohome}), pop rather than rotate with a numeric | |
954 argument (@code{shell-pushd-dextract}), and only add directories to the | |
955 directory stack if they are not already on it | |
956 (@code{shell-pushd-dunique}). The values you choose should match the | |
957 underlying shell, of course. | |
958 | |
27210 | 959 @node Terminal emulator |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
960 @subsection Emacs Terminal Emulator |
27210 | 961 @findex term |
962 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
963 To run a subshell in a terminal emulator, putting its typescript in |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
964 an Emacs buffer, use @kbd{M-x term}. This creates (or reuses) a |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
965 buffer named @samp{*terminal*}, and runs a subshell with input coming |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
966 from your keyboard, and output going to that buffer. |
27210 | 967 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
968 The terminal emulator uses Term mode, which has two input modes. In |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
969 line mode, Term basically acts like Shell mode; see @ref{Shell Mode}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
970 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
971 In char mode, each character is sent directly to the inferior |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
972 subshell, as ``terminal input.'' Any ``echoing'' of your input is the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
973 responsibility of the subshell. The sole exception is the terminal |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
974 escape character, which by default is @kbd{C-c} (@pxref{Term Mode}). |
27210 | 975 Any ``terminal output'' from the subshell goes into the buffer, |
976 advancing point. | |
977 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
978 Some programs (such as Emacs itself) need to control the appearance |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
979 on the terminal screen in detail. They do this by sending special |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
980 control codes. The exact control codes needed vary from terminal to |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
981 terminal, but nowadays most terminals and terminal emulators |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
982 (including @code{xterm}) understand the ANSI-standard (VT100-style) |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
983 escape sequences. Term mode recognizes these escape sequences, and |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
984 handles each one appropriately, changing the buffer so that the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
985 appearance of the window matches what it would be on a real terminal. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
986 You can actually run Emacs inside an Emacs Term window. |
27210 | 987 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
988 The file name used to load the subshell is determined the same way |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
989 as for Shell mode. To make multiple terminal emulators, rename the |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
990 buffer @samp{*terminal*} to something different using @kbd{M-x |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
991 rename-uniquely}, just as with Shell mode. |
27210 | 992 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
993 Unlike Shell mode, Term mode does not track the current directory by |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
994 examining your input. But some shells can tell Term what the current |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
995 directory is. This is done automatically by @code{bash} version 1.15 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
996 and later. |
27210 | 997 |
998 @node Term Mode | |
999 @subsection Term Mode | |
1000 @cindex Term mode | |
1001 @cindex mode, Term | |
1002 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1003 The terminal emulator uses Term mode, which has two input modes. In |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1004 line mode, Term basically acts like Shell mode; see @ref{Shell Mode}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1005 In char mode, each character is sent directly to the inferior |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1006 subshell, except for the Term escape character, normally @kbd{C-c}. |
27210 | 1007 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1008 To switch between line and char mode, use these commands: |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1009 |
27210 | 1010 @table @kbd |
1011 @kindex C-c C-k @r{(Term mode)} | |
1012 @findex term-char-mode | |
1013 @item C-c C-k | |
1014 Switch to line mode. Do nothing if already in line mode. | |
1015 | |
1016 @kindex C-c C-j @r{(Term mode)} | |
1017 @findex term-line-mode | |
1018 @item C-c C-j | |
1019 Switch to char mode. Do nothing if already in char mode. | |
1020 @end table | |
1021 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1022 The following commands are only available in char mode: |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1023 |
27210 | 1024 @table @kbd |
1025 @item C-c C-c | |
1026 Send a literal @key{C-c} to the sub-shell. | |
1027 | |
1028 @item C-c C-x | |
1029 A prefix command to access the global @key{C-x} commands conveniently. | |
1030 For example, @kbd{C-c C-x o} invokes the global binding of | |
1031 @kbd{C-x o}, which is normally @samp{other-window}. | |
1032 @end table | |
1033 | |
1034 @node Paging in Term | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1035 @subsection Page-At-A-Time Output |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1036 @cindex page-at-a-time |
27210 | 1037 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1038 Term mode has a page-at-a-time feature. When enabled it makes |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1039 output pause at the end of each screenful. |
27210 | 1040 |
1041 @table @kbd | |
1042 @kindex C-c C-q @r{(Term mode)} | |
1043 @findex term-pager-toggle | |
1044 @item C-c C-q | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1045 Toggle the page-at-a-time feature. This command works in both line |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1046 and char modes. When page-at-a-time is enabled, the mode-line |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1047 displays the word @samp{page}. |
27210 | 1048 @end table |
1049 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1050 With page-at-a-time enabled, whenever Term receives more than a |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1051 screenful of output since your last input, it pauses, displaying |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1052 @samp{**MORE**} in the mode-line. Type @key{SPC} to display the next |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1053 screenful of output. Type @kbd{?} to see your other options. The |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1054 interface is similar to the Unix @code{more} program. |
27210 | 1055 |
25829 | 1056 @node Remote Host |
1057 @subsection Remote Host Shell | |
1058 @cindex remote host | |
1059 @cindex connecting to remote host | |
1060 @cindex Telnet | |
1061 @cindex Rlogin | |
1062 | |
27210 | 1063 You can login to a remote computer, using whatever commands you |
1064 would from a regular terminal (e.g.@: using the @code{telnet} or | |
1065 @code{rlogin} commands), from a Term window. | |
1066 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1067 A program that asks you for a password will normally suppress |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1068 echoing of the password, so the password will not show up in the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1069 buffer. This will happen just as if you were using a real terminal, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1070 if the buffer is in char mode. If it is in line mode, the password is |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1071 temporarily visible, but will be erased when you hit return. (This |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1072 happens automatically; there is no special password processing.) |
27210 | 1073 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1074 When you log in to a different machine, you need to specify the type |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1075 of terminal your using. Terminal types @samp{ansi} or @samp{vt100} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1076 will work on most systems. |
27210 | 1077 |
1078 @c If you are talking to a Bourne-compatible | |
29107 | 1079 @c shell, and your system understands the @env{TERMCAP} variable, |
27210 | 1080 @c you can use the command @kbd{M-x shell-send-termcap}, which |
1081 @c sends a string specifying the terminal type and size. | |
1082 @c (This command is also useful after the window has changed size.) | |
1083 | |
1084 @c You can of course run @samp{gdb} on that remote computer. One useful | |
1085 @c trick: If you invoke gdb with the @code{--fullname} option, | |
1086 @c it will send special commands to Emacs that will cause Emacs to | |
1087 @c pop up the source files you're debugging. This will work | |
1088 @c whether or not gdb is running on a different computer than Emacs, | |
1089 @c as long as Emacs can access the source files specified by gdb. | |
1090 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1091 @ignore |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1092 You cannot log into to a remote computer using the Shell mode. |
27210 | 1093 @c (This will change when Shell is re-written to use Term.) |
1094 Instead, Emacs provides two commands for logging in to another computer | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1095 and communicating with it through an Emacs buffer using Comint mode: |
25829 | 1096 |
1097 @table @kbd | |
1098 @item M-x telnet @key{RET} @var{hostname} @key{RET} | |
1099 Set up a Telnet connection to the computer named @var{hostname}. | |
1100 @item M-x rlogin @key{RET} @var{hostname} @key{RET} | |
1101 Set up an Rlogin connection to the computer named @var{hostname}. | |
1102 @end table | |
1103 | |
1104 @findex telnet | |
1105 Use @kbd{M-x telnet} to set up a Telnet connection to another | |
1106 computer. (Telnet is the standard Internet protocol for remote login.) | |
1107 It reads the host name of the other computer as an argument with the | |
1108 minibuffer. Once the connection is established, talking to the other | |
1109 computer works like talking to a subshell: you can edit input with the | |
1110 usual Emacs commands, and send it a line at a time by typing @key{RET}. | |
1111 The output is inserted in the Telnet buffer interspersed with the input. | |
1112 | |
1113 @findex rlogin | |
1114 @vindex rlogin-explicit-args | |
1115 Use @kbd{M-x rlogin} to set up an Rlogin connection. Rlogin is | |
1116 another remote login communication protocol, essentially much like the | |
1117 Telnet protocol but incompatible with it, and supported only by certain | |
1118 systems. Rlogin's advantages are that you can arrange not to have to | |
1119 give your user name and password when communicating between two machines | |
1120 you frequently use, and that you can make an 8-bit-clean connection. | |
1121 (To do that in Emacs, set @code{rlogin-explicit-args} to @code{("-8")} | |
1122 before you run Rlogin.) | |
1123 | |
1124 @kbd{M-x rlogin} sets up the default file directory of the Emacs | |
1125 buffer to access the remote host via FTP (@pxref{File Names}), and it | |
1126 tracks the shell commands that change the current directory, just like | |
1127 Shell mode. | |
1128 | |
1129 @findex rlogin-directory-tracking-mode | |
1130 There are two ways of doing directory tracking in an Rlogin | |
1131 buffer---either with remote directory names | |
1132 @file{/@var{host}:@var{dir}/} or with local names (that works if the | |
1133 ``remote'' machine shares file systems with your machine of origin). | |
1134 You can use the command @code{rlogin-directory-tracking-mode} to switch | |
1135 modes. No argument means use remote directory names, a positive | |
1136 argument means use local names, and a negative argument means turn | |
1137 off directory tracking. | |
1138 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1139 @end ignore |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1140 |
25829 | 1141 @node Emacs Server, Hardcopy, Shell, Top |
1142 @section Using Emacs as a Server | |
1143 @pindex emacsclient | |
1144 @cindex Emacs as a server | |
1145 @cindex server, using Emacs as | |
29107 | 1146 @cindex @env{EDITOR} environment variable |
25829 | 1147 |
1148 Various programs such as @code{mail} can invoke your choice of editor | |
1149 to edit a particular piece of text, such as a message that you are | |
1150 sending. By convention, most of these programs use the environment | |
29107 | 1151 variable @env{EDITOR} to specify which editor to run. If you set |
1152 @env{EDITOR} to @samp{emacs}, they invoke Emacs---but in an | |
25829 | 1153 inconvenient fashion, by starting a new, separate Emacs process. This |
1154 is inconvenient because it takes time and because the new Emacs process | |
1155 doesn't share the buffers in the existing Emacs process. | |
1156 | |
1157 You can arrange to use your existing Emacs process as the editor for | |
1158 programs like @code{mail} by using the Emacs client and Emacs server | |
1159 programs. Here is how. | |
1160 | |
29107 | 1161 @cindex @env{TEXEDIT} environment variable |
25829 | 1162 First, the preparation. Within Emacs, call the function |
1163 @code{server-start}. (Your @file{.emacs} file can do this automatically | |
1164 if you add the expression @code{(server-start)} to it.) Then, outside | |
29107 | 1165 Emacs, set the @env{EDITOR} environment variable to @samp{emacsclient}. |
25829 | 1166 (Note that some programs use a different environment variable; for |
1167 example, to make @TeX{} use @samp{emacsclient}, you should set the | |
29107 | 1168 @env{TEXEDIT} environment variable to @samp{emacsclient +%d %s}.) |
25829 | 1169 |
1170 @kindex C-x # | |
1171 @findex server-edit | |
29107 | 1172 Then, whenever any program invokes your specified @env{EDITOR} |
25829 | 1173 program, the effect is to send a message to your principal Emacs telling |
1174 it to visit a file. (That's what the program @code{emacsclient} does.) | |
1175 Emacs displays the buffer immediately and you can immediately begin | |
1176 editing it. | |
1177 | |
1178 When you've finished editing that buffer, type @kbd{C-x #} | |
1179 (@code{server-edit}). This saves the file and sends a message back to | |
1180 the @code{emacsclient} program telling it to exit. The programs that | |
29107 | 1181 use @env{EDITOR} wait for the ``editor'' (actually, @code{emacsclient}) |
25829 | 1182 to exit. @kbd{C-x #} also checks for other pending external requests |
1183 to edit various files, and selects the next such file. | |
1184 | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
1185 You can switch to a server buffer manually if you wish; you don't |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
1186 have to arrive at it with @kbd{C-x #}. But @kbd{C-x #} is the way to |
25829 | 1187 say that you are ``finished'' with one. |
1188 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1189 @vindex server-kill-new-buffers |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1190 @vindex server-temp-file-regexp |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1191 Finishing with a server buffer also kills the buffer, unless it |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1192 already existed in the Emacs session before the server asked to create |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1193 it. However, if you set @code{server-kill-new-buffers} to @code{nil}, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1194 then a different criterion is used: finishing with a server buffer |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1195 kills it if the file name matches the regular expression |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1196 @code{server-temp-file-regexp}. This is set up to distinguish certain |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1197 ``temporary'' files. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1198 |
25829 | 1199 @vindex server-window |
1200 If you set the variable @code{server-window} to a window or a frame, | |
1201 @kbd{C-x #} displays the server buffer in that window or in that frame. | |
1202 | |
1203 While @code{mail} or another application is waiting for | |
1204 @code{emacsclient} to finish, @code{emacsclient} does not read terminal | |
1205 input. So the terminal that @code{mail} was using is effectively | |
1206 blocked for the duration. In order to edit with your principal Emacs, | |
1207 you need to be able to use it without using that terminal. There are | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1208 three ways to do this: |
25829 | 1209 |
1210 @itemize @bullet | |
1211 @item | |
1212 Using a window system, run @code{mail} and the principal Emacs in two | |
1213 separate windows. While @code{mail} is waiting for @code{emacsclient}, | |
1214 the window where it was running is blocked, but you can use Emacs by | |
1215 switching windows. | |
1216 | |
1217 @item | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1218 Using virtual terminals, run @code{mail} in one virtual terminal |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1219 and run Emacs in another. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1220 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1221 @item |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1222 Use Shell mode or Term mode in Emacs to run the other program such as |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1223 @code{mail}; then, @code{emacsclient} blocks only the subshell under |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1224 Emacs, and you can still use Emacs to edit the file. |
25829 | 1225 @end itemize |
1226 | |
1227 If you run @code{emacsclient} with the option @samp{--no-wait}, it | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1228 returns immediately without waiting for you to ``finish'' the buffer |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1229 in Emacs. Note that server buffers created in this way are not killed |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1230 automatically when you finish with them. |
30856 | 1231 |
25829 | 1232 @menu |
1233 * Invoking emacsclient:: | |
1234 @end menu | |
1235 | |
1236 @node Invoking emacsclient,, Emacs Server, Emacs Server | |
1237 @section Invoking @code{emacsclient} | |
1238 | |
1239 To run the @code{emacsclient} program, specify file names as arguments, | |
1240 and optionally line numbers as well. Do it like this: | |
1241 | |
1242 @example | |
1243 emacsclient @r{@{}@r{[}+@var{line}@r{]} @var{filename}@r{@}}@dots{} | |
1244 @end example | |
1245 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1246 @noindent |
25829 | 1247 This tells Emacs to visit each of the specified files; if you specify a |
1248 line number for a certain file, Emacs moves to that line in the file. | |
1249 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1250 Ordinarily, @code{emacsclient} does not return until you use the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1251 @kbd{C-x #} command on each of these buffers. When that happens, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1252 Emacs sends a message to the @code{emacsclient} program telling it to |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1253 return. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1254 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1255 But if you use the option @samp{-n} or @samp{--no-wait} when running |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1256 @code{emacsclient}, then it returns immediately. (You can take as |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1257 long as you like to edit the files in Emacs.) |
25829 | 1258 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1259 The option @samp{--alternate-editor=@var{command}} is useful when |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1260 running @code{emacsclient} in a script. It specifies a command to run |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1261 if @code{emacsclient} fails to contact Emacs. For example, the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1262 following setting for the @var{EDITOR} environment variable will |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1263 always give an editor, even if Emacs is not running: |
25829 | 1264 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1265 @example |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1266 EDITOR="emacsclient --alternate-editor vi +%d %s" |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1267 @end example |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1268 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1269 @noindent |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1270 The environment variable @var{ALTERNATE_EDITOR} has the same effect, but |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1271 the value of the @samp{--alternate-editor} takes precedence. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1272 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1273 @pindex emacs.bash |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1274 Alternatively, the file @file{etc/emacs.bash} defines a bash |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1275 function which will communicate with a running Emacs server, or start |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1276 one if none exists. |
25829 | 1277 |
27210 | 1278 @node Hardcopy, PostScript, Emacs Server, Top |
25829 | 1279 @section Hardcopy Output |
1280 @cindex hardcopy | |
1281 | |
1282 The Emacs commands for making hardcopy let you print either an entire | |
1283 buffer or just part of one, either with or without page headers. | |
1284 See also the hardcopy commands of Dired (@pxref{Misc File Ops}) | |
1285 and the diary (@pxref{Diary Commands}). | |
1286 | |
1287 @table @kbd | |
1288 @item M-x print-buffer | |
1289 Print hardcopy of current buffer with page headings containing the file | |
1290 name and page number. | |
1291 @item M-x lpr-buffer | |
1292 Print hardcopy of current buffer without page headings. | |
1293 @item M-x print-region | |
1294 Like @code{print-buffer} but print only the current region. | |
1295 @item M-x lpr-region | |
1296 Like @code{lpr-buffer} but print only the current region. | |
1297 @end table | |
1298 | |
1299 @findex print-buffer | |
1300 @findex print-region | |
1301 @findex lpr-buffer | |
1302 @findex lpr-region | |
1303 @vindex lpr-switches | |
1304 The hardcopy commands (aside from the Postscript commands) pass extra | |
1305 switches to the @code{lpr} program based on the value of the variable | |
1306 @code{lpr-switches}. Its value should be a list of strings, each string | |
1307 an option starting with @samp{-}. For example, to specify a line width | |
1308 of 80 columns for all the printing you do in Emacs, set | |
1309 @code{lpr-switches} like this: | |
1310 | |
1311 @example | |
1312 (setq lpr-switches '("-w80")) | |
1313 @end example | |
1314 | |
1315 @vindex printer-name | |
1316 You can specify the printer to use by setting the variable | |
1317 @code{printer-name}. | |
1318 | |
1319 @vindex lpr-headers-switches | |
1320 @vindex lpr-commands | |
1321 @vindex lpr-add-switches | |
1322 The variable @code{lpr-command} specifies the name of the printer | |
1323 program to run; the default value depends on your operating system type. | |
1324 On most systems, the default is @code{"lpr"}. The variable | |
1325 @code{lpr-headers-switches} similarly specifies the extra switches to | |
1326 use to make page headers. The variable @code{lpr-add-switches} controls | |
1327 whether to supply @samp{-T} and @samp{-J} options (suitable for | |
1328 @code{lpr}) to the printer program: @code{nil} means don't add them. | |
1329 @code{lpr-add-switches} should be @code{nil} if your printer program is | |
1330 not compatible with @code{lpr}. | |
1331 | |
27210 | 1332 @node PostScript, PostScript Variables, Hardcopy, Top |
1333 @section PostScript Hardcopy | |
25829 | 1334 |
27210 | 1335 These commands convert buffer contents to PostScript, |
25829 | 1336 either printing it or leaving it in another Emacs buffer. |
1337 | |
1338 @table @kbd | |
1339 @item M-x ps-print-buffer | |
27210 | 1340 Print hardcopy of the current buffer in PostScript form. |
25829 | 1341 @item M-x ps-print-region |
27210 | 1342 Print hardcopy of the current region in PostScript form. |
25829 | 1343 @item M-x ps-print-buffer-with-faces |
27210 | 1344 Print hardcopy of the current buffer in PostScript form, showing the |
1345 faces used in the text by means of PostScript features. | |
25829 | 1346 @item M-x ps-print-region-with-faces |
27210 | 1347 Print hardcopy of the current region in PostScript form, showing the |
25829 | 1348 faces used in the text. |
1349 @item M-x ps-spool-buffer | |
27210 | 1350 Generate PostScript for the current buffer text. |
25829 | 1351 @item M-x ps-spool-region |
27210 | 1352 Generate PostScript for the current region. |
25829 | 1353 @item M-x ps-spool-buffer-with-faces |
27210 | 1354 Generate PostScript for the current buffer, showing the faces used. |
25829 | 1355 @item M-x ps-spool-region-with-faces |
27210 | 1356 Generate PostScript for the current region, showing the faces used. |
1357 @item M-x handwrite | |
1358 Generates/prints PostScript for the current buffer as if handwritten. | |
25829 | 1359 @end table |
1360 | |
1361 @findex ps-print-region | |
1362 @findex ps-print-buffer | |
1363 @findex ps-print-region-with-faces | |
1364 @findex ps-print-buffer-with-faces | |
27210 | 1365 The PostScript commands, @code{ps-print-buffer} and |
1366 @code{ps-print-region}, print buffer contents in PostScript form. One | |
25829 | 1367 command prints the entire buffer; the other, just the region. The |
1368 corresponding @samp{-with-faces} commands, | |
1369 @code{ps-print-buffer-with-faces} and @code{ps-print-region-with-faces}, | |
27210 | 1370 use PostScript features to show the faces (fonts and colors) in the text |
25829 | 1371 properties of the text being printed. |
1372 | |
1373 If you are using a color display, you can print a buffer of program | |
1374 code with color highlighting by turning on Font-Lock mode in that | |
1375 buffer, and using @code{ps-print-buffer-with-faces}. | |
1376 | |
1377 @findex ps-spool-region | |
1378 @findex ps-spool-buffer | |
1379 @findex ps-spool-region-with-faces | |
1380 @findex ps-spool-buffer-with-faces | |
1381 The commands whose names have @samp{spool} instead of @samp{print} | |
27210 | 1382 generate the PostScript output in an Emacs buffer instead of sending |
25829 | 1383 it to the printer. |
1384 | |
27210 | 1385 @findex handwrite |
1386 @cindex handwriting | |
1387 @kbd{M-x handwrite} is more frivolous. It generates a PostScript | |
1388 rendition of the current buffer as a cursive handwritten document. It | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
1389 can be customized in group @code{handwrite}. This function only |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
1390 supports ISO 8859-1 characters. |
27210 | 1391 |
25829 | 1392 @ifinfo |
1393 The following section describes variables for customizing these commands. | |
1394 @end ifinfo | |
1395 | |
27210 | 1396 @node PostScript Variables, Sorting, PostScript, Top |
1397 @section Variables for PostScript Hardcopy | |
25829 | 1398 |
1399 @vindex ps-lpr-command | |
1400 @vindex ps-lpr-switches | |
1401 @vindex ps-printer-name | |
27210 | 1402 All the PostScript hardcopy commands use the variables |
25829 | 1403 @code{ps-lpr-command} and @code{ps-lpr-switches} to specify how to print |
1404 the output. @code{ps-lpr-command} specifies the command name to run, | |
1405 @code{ps-lpr-switches} specifies command line options to use, and | |
1406 @code{ps-printer-name} specifies the printer. If you don't set the | |
1407 first two variables yourself, they take their initial values from | |
1408 @code{lpr-command} and @code{lpr-switches}. If @code{ps-printer-name} | |
1409 is @code{nil}, @code{printer-name} is used. | |
1410 | |
1411 @vindex ps-print-header | |
1412 The variable @code{ps-print-header} controls whether these commands | |
1413 add header lines to each page---set it to @code{nil} to turn headers | |
35648
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1414 off. |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1415 |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1416 @cindex color emulation on black-and-white printers |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1417 @vindex ps-print-color-p |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1418 If your printer doesn't support colors, you should turn off color |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1419 processing by setting @code{ps-print-color-p} to @code{nil}. By |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1420 default, if the display supports colors, Emacs produces hardcopy output |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1421 with color information; on black-and-white printers, colors are emulated |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1422 with shades of gray. This might produce illegible output, even if your |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1423 screen colors only use shades of gray. |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1424 |
fd06a4e20d87
(PostScript Variables): Extend the documentation of ps-print-color-p.
Eli Zaretskii <eliz@gnu.org>
parents:
33382
diff
changeset
|
1425 @vindex ps-use-face-background |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1426 By default, PostScript printing ignores the background colors of the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1427 faces, unless the variable @code{ps-use-face-background} is |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1428 non-@code{nil}. This is to avoid unwanted interference with the zebra |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1429 stripes and background image/text. |
25829 | 1430 |
1431 @vindex ps-paper-type | |
1432 @vindex ps-page-dimensions-database | |
1433 The variable @code{ps-paper-type} specifies which size of paper to | |
1434 format for; legitimate values include @code{a4}, @code{a3}, | |
1435 @code{a4small}, @code{b4}, @code{b5}, @code{executive}, @code{ledger}, | |
1436 @code{legal}, @code{letter}, @code{letter-small}, @code{statement}, | |
1437 @code{tabloid}. The default is @code{letter}. You can define | |
1438 additional paper sizes by changing the variable | |
1439 @code{ps-page-dimensions-database}. | |
1440 | |
1441 @vindex ps-landscape-mode | |
1442 The variable @code{ps-landscape-mode} specifies the orientation of | |
1443 printing on the page. The default is @code{nil}, which stands for | |
1444 ``portrait'' mode. Any non-@code{nil} value specifies ``landscape'' | |
1445 mode. | |
1446 | |
1447 @vindex ps-number-of-columns | |
1448 The variable @code{ps-number-of-columns} specifies the number of | |
1449 columns; it takes effect in both landscape and portrait mode. The | |
1450 default is 1. | |
1451 | |
1452 @vindex ps-font-family | |
1453 @vindex ps-font-size | |
1454 @vindex ps-font-info-database | |
1455 The variable @code{ps-font-family} specifies which font family to use | |
1456 for printing ordinary text. Legitimate values include @code{Courier}, | |
1457 @code{Helvetica}, @code{NewCenturySchlbk}, @code{Palatino} and | |
1458 @code{Times}. The variable @code{ps-font-size} specifies the size of | |
1459 the font for ordinary text. It defaults to 8.5 points. | |
1460 | |
37018
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1461 @vindex ps-multibyte-buffer |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1462 @cindex Intlfonts for PostScript printing |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1463 @cindex fonts for PostScript printing |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1464 Emacs supports more scripts and characters than a typical PostScript |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1465 printer. Thus, some of the characters in your buffer might not be |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1466 printable using the fonts built into your printer. You can augment |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1467 the fonts supplied with the printer with those from the GNU Intlfonts |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1468 package, or you can instruct Emacs to use Intlfonts exclusively. The |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1469 variable @code{ps-multibyte-buffer} controls this: the default value, |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1470 @code{nil}, is appropriate for printing @sc{ascii} and Latin-1 |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1471 characters; a value of @code{non-latin-printer} is for printers which |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1472 have the fonts for @sc{ascii}, Latin-1, Japanese, and Korean |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1473 characters built into them. A value of @code{bdf-font} arranges for |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1474 the BDF fonts from the Intlfonts package to be used for @emph{all} |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1475 characters. Finally, a value of @code{bdf-font-except-latin} |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1476 instructs the printer to use built-in fonts for @sc{ascii} and Latin-1 |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1477 characters, and Intlfonts BDF fonts for the rest. |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1478 |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1479 @vindex bdf-directory-list |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1480 To be able to use the BDF fonts, Emacs should know where to find |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1481 them. The variable @code{bdf-directory-list} holds the list of |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1482 directories where Emacs should look for the fonts; the default value |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1483 includes a single directory @file{/usr/local/share/emacs/fonts/bdf}. |
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1484 |
25829 | 1485 Many other customization variables for these commands are defined and |
37018
6883b349cfd6
(PostScript Variables): Explain how to set up use of
Eli Zaretskii <eliz@gnu.org>
parents:
36263
diff
changeset
|
1486 described in the Lisp files @file{ps-print.el} and @file{ps-mule.el}. |
25829 | 1487 |
27210 | 1488 @node Sorting, Narrowing, PostScript Variables, Top |
25829 | 1489 @section Sorting Text |
1490 @cindex sorting | |
1491 | |
1492 Emacs provides several commands for sorting text in the buffer. All | |
1493 operate on the contents of the region (the text between point and the | |
1494 mark). They divide the text of the region into many @dfn{sort records}, | |
1495 identify a @dfn{sort key} for each record, and then reorder the records | |
1496 into the order determined by the sort keys. The records are ordered so | |
1497 that their keys are in alphabetical order, or, for numeric sorting, in | |
1498 numeric order. In alphabetic sorting, all upper-case letters `A' through | |
1499 `Z' come before lower-case `a', in accord with the ASCII character | |
1500 sequence. | |
1501 | |
1502 The various sort commands differ in how they divide the text into sort | |
1503 records and in which part of each record is used as the sort key. Most of | |
1504 the commands make each line a separate sort record, but some commands use | |
1505 paragraphs or pages as sort records. Most of the sort commands use each | |
1506 entire sort record as its own sort key, but some use only a portion of the | |
1507 record as the sort key. | |
1508 | |
1509 @findex sort-lines | |
1510 @findex sort-paragraphs | |
1511 @findex sort-pages | |
1512 @findex sort-fields | |
1513 @findex sort-numeric-fields | |
27469 | 1514 @vindex sort-numeric-base |
25829 | 1515 @table @kbd |
1516 @item M-x sort-lines | |
1517 Divide the region into lines, and sort by comparing the entire | |
1518 text of a line. A numeric argument means sort into descending order. | |
1519 | |
1520 @item M-x sort-paragraphs | |
1521 Divide the region into paragraphs, and sort by comparing the entire | |
1522 text of a paragraph (except for leading blank lines). A numeric | |
1523 argument means sort into descending order. | |
1524 | |
1525 @item M-x sort-pages | |
1526 Divide the region into pages, and sort by comparing the entire | |
1527 text of a page (except for leading blank lines). A numeric | |
1528 argument means sort into descending order. | |
1529 | |
1530 @item M-x sort-fields | |
1531 Divide the region into lines, and sort by comparing the contents of | |
1532 one field in each line. Fields are defined as separated by | |
1533 whitespace, so the first run of consecutive non-whitespace characters | |
1534 in a line constitutes field 1, the second such run constitutes field | |
1535 2, etc. | |
1536 | |
1537 Specify which field to sort by with a numeric argument: 1 to sort by | |
1538 field 1, etc. A negative argument means count fields from the right | |
1539 instead of from the left; thus, minus 1 means sort by the last field. | |
1540 If several lines have identical contents in the field being sorted, they | |
1541 keep same relative order that they had in the original buffer. | |
1542 | |
1543 @item M-x sort-numeric-fields | |
1544 Like @kbd{M-x sort-fields} except the specified field is converted | |
1545 to an integer for each line, and the numbers are compared. @samp{10} | |
1546 comes before @samp{2} when considered as text, but after it when | |
27469 | 1547 considered as a number. By default, numbers are interpreted according |
1548 to @code{sort-numeric-base}, but numbers beginning with @samp{0x} or | |
1549 @samp{0} are interpreted as hexadecimal and octal, respectively. | |
25829 | 1550 |
1551 @item M-x sort-columns | |
1552 Like @kbd{M-x sort-fields} except that the text within each line | |
1553 used for comparison comes from a fixed range of columns. See below | |
1554 for an explanation. | |
1555 | |
1556 @item M-x reverse-region | |
1557 Reverse the order of the lines in the region. This is useful for | |
1558 sorting into descending order by fields or columns, since those sort | |
1559 commands do not have a feature for doing that. | |
1560 @end table | |
1561 | |
1562 For example, if the buffer contains this: | |
1563 | |
1564 @smallexample | |
1565 On systems where clash detection (locking of files being edited) is | |
1566 implemented, Emacs also checks the first time you modify a buffer | |
1567 whether the file has changed on disk since it was last visited or | |
1568 saved. If it has, you are asked to confirm that you want to change | |
1569 the buffer. | |
1570 @end smallexample | |
1571 | |
1572 @noindent | |
1573 applying @kbd{M-x sort-lines} to the entire buffer produces this: | |
1574 | |
1575 @smallexample | |
1576 On systems where clash detection (locking of files being edited) is | |
1577 implemented, Emacs also checks the first time you modify a buffer | |
1578 saved. If it has, you are asked to confirm that you want to change | |
1579 the buffer. | |
1580 whether the file has changed on disk since it was last visited or | |
1581 @end smallexample | |
1582 | |
1583 @noindent | |
1584 where the upper-case @samp{O} sorts before all lower-case letters. If | |
1585 you use @kbd{C-u 2 M-x sort-fields} instead, you get this: | |
1586 | |
1587 @smallexample | |
1588 implemented, Emacs also checks the first time you modify a buffer | |
1589 saved. If it has, you are asked to confirm that you want to change | |
1590 the buffer. | |
1591 On systems where clash detection (locking of files being edited) is | |
1592 whether the file has changed on disk since it was last visited or | |
1593 @end smallexample | |
1594 | |
1595 @noindent | |
1596 where the sort keys were @samp{Emacs}, @samp{If}, @samp{buffer}, | |
1597 @samp{systems} and @samp{the}. | |
1598 | |
1599 @findex sort-columns | |
1600 @kbd{M-x sort-columns} requires more explanation. You specify the | |
1601 columns by putting point at one of the columns and the mark at the other | |
1602 column. Because this means you cannot put point or the mark at the | |
1603 beginning of the first line of the text you want to sort, this command | |
36185 | 1604 uses an unusual definition of ``region'': all of the line point is in is |
25829 | 1605 considered part of the region, and so is all of the line the mark is in, |
1606 as well as all the lines in between. | |
1607 | |
1608 For example, to sort a table by information found in columns 10 to 15, | |
1609 you could put the mark on column 10 in the first line of the table, and | |
1610 point on column 15 in the last line of the table, and then run | |
1611 @code{sort-columns}. Equivalently, you could run it with the mark on | |
1612 column 15 in the first line and point on column 10 in the last line. | |
1613 | |
1614 This can be thought of as sorting the rectangle specified by point and | |
1615 the mark, except that the text on each line to the left or right of the | |
1616 rectangle moves along with the text inside the rectangle. | |
1617 @xref{Rectangles}. | |
1618 | |
1619 @vindex sort-fold-case | |
1620 Many of the sort commands ignore case differences when comparing, if | |
1621 @code{sort-fold-case} is non-@code{nil}. | |
1622 | |
1623 @node Narrowing, Two-Column, Sorting, Top | |
1624 @section Narrowing | |
1625 @cindex widening | |
1626 @cindex restriction | |
1627 @cindex narrowing | |
1628 @cindex accessible portion | |
1629 | |
1630 @dfn{Narrowing} means focusing in on some portion of the buffer, | |
1631 making the rest temporarily inaccessible. The portion which you can | |
1632 still get to is called the @dfn{accessible portion}. Canceling the | |
1633 narrowing, which makes the entire buffer once again accessible, is | |
1634 called @dfn{widening}. The amount of narrowing in effect in a buffer at | |
1635 any time is called the buffer's @dfn{restriction}. | |
1636 | |
1637 Narrowing can make it easier to concentrate on a single subroutine or | |
1638 paragraph by eliminating clutter. It can also be used to restrict the | |
1639 range of operation of a replace command or repeating keyboard macro. | |
1640 | |
1641 @c WideCommands | |
1642 @table @kbd | |
1643 @item C-x n n | |
1644 Narrow down to between point and mark (@code{narrow-to-region}). | |
1645 @item C-x n w | |
1646 Widen to make the entire buffer accessible again (@code{widen}). | |
1647 @item C-x n p | |
1648 Narrow down to the current page (@code{narrow-to-page}). | |
1649 @item C-x n d | |
1650 Narrow down to the current defun (@code{narrow-to-defun}). | |
1651 @end table | |
1652 | |
1653 When you have narrowed down to a part of the buffer, that part appears | |
1654 to be all there is. You can't see the rest, you can't move into it | |
1655 (motion commands won't go outside the accessible part), you can't change | |
1656 it in any way. However, it is not gone, and if you save the file all | |
1657 the inaccessible text will be saved. The word @samp{Narrow} appears in | |
1658 the mode line whenever narrowing is in effect. | |
1659 | |
1660 @kindex C-x n n | |
1661 @findex narrow-to-region | |
1662 The primary narrowing command is @kbd{C-x n n} (@code{narrow-to-region}). | |
1663 It sets the current buffer's restrictions so that the text in the current | |
1664 region remains accessible but all text before the region or after the region | |
1665 is inaccessible. Point and mark do not change. | |
1666 | |
1667 @kindex C-x n p | |
1668 @findex narrow-to-page | |
1669 @kindex C-x n d | |
1670 @findex narrow-to-defun | |
1671 Alternatively, use @kbd{C-x n p} (@code{narrow-to-page}) to narrow | |
1672 down to the current page. @xref{Pages}, for the definition of a page. | |
1673 @kbd{C-x n d} (@code{narrow-to-defun}) narrows down to the defun | |
1674 containing point (@pxref{Defuns}). | |
1675 | |
1676 @kindex C-x n w | |
1677 @findex widen | |
1678 The way to cancel narrowing is to widen with @kbd{C-x n w} | |
1679 (@code{widen}). This makes all text in the buffer accessible again. | |
1680 | |
1681 You can get information on what part of the buffer you are narrowed down | |
1682 to using the @kbd{C-x =} command. @xref{Position Info}. | |
1683 | |
1684 Because narrowing can easily confuse users who do not understand it, | |
1685 @code{narrow-to-region} is normally a disabled command. Attempting to use | |
1686 this command asks for confirmation and gives you the option of enabling it; | |
1687 if you enable the command, confirmation will no longer be required for | |
1688 it. @xref{Disabling}. | |
1689 | |
1690 @node Two-Column, Editing Binary Files, Narrowing, Top | |
1691 @section Two-Column Editing | |
1692 @cindex two-column editing | |
1693 @cindex splitting columns | |
1694 @cindex columns, splitting | |
1695 | |
1696 Two-column mode lets you conveniently edit two side-by-side columns of | |
1697 text. It uses two side-by-side windows, each showing its own | |
1698 buffer. | |
1699 | |
1700 There are three ways to enter two-column mode: | |
1701 | |
1702 @table @asis | |
1703 @item @kbd{@key{F2} 2} or @kbd{C-x 6 2} | |
1704 @kindex F2 2 | |
1705 @kindex C-x 6 2 | |
1706 @findex 2C-two-columns | |
1707 Enter two-column mode with the current buffer on the left, and on the | |
1708 right, a buffer whose name is based on the current buffer's name | |
1709 (@code{2C-two-columns}). If the right-hand buffer doesn't already | |
1710 exist, it starts out empty; the current buffer's contents are not | |
1711 changed. | |
1712 | |
1713 This command is appropriate when the current buffer is empty or contains | |
1714 just one column and you want to add another column. | |
1715 | |
1716 @item @kbd{@key{F2} s} or @kbd{C-x 6 s} | |
1717 @kindex F2 s | |
1718 @kindex C-x 6 s | |
1719 @findex 2C-split | |
1720 Split the current buffer, which contains two-column text, into two | |
1721 buffers, and display them side by side (@code{2C-split}). The current | |
1722 buffer becomes the left-hand buffer, but the text in the right-hand | |
1723 column is moved into the right-hand buffer. The current column | |
1724 specifies the split point. Splitting starts with the current line and | |
1725 continues to the end of the buffer. | |
1726 | |
1727 This command is appropriate when you have a buffer that already contains | |
1728 two-column text, and you wish to separate the columns temporarily. | |
1729 | |
1730 @item @kbd{@key{F2} b @var{buffer} @key{RET}} | |
1731 @itemx @kbd{C-x 6 b @var{buffer} @key{RET}} | |
1732 @kindex F2 b | |
1733 @kindex C-x 6 b | |
1734 @findex 2C-associate-buffer | |
1735 Enter two-column mode using the current buffer as the left-hand buffer, | |
1736 and using buffer @var{buffer} as the right-hand buffer | |
1737 (@code{2C-associate-buffer}). | |
1738 @end table | |
1739 | |
1740 @kbd{@key{F2} s} or @kbd{C-x 6 s} looks for a column separator, which | |
1741 is a string that appears on each line between the two columns. You can | |
1742 specify the width of the separator with a numeric argument to | |
1743 @kbd{@key{F2} s}; that many characters, before point, constitute the | |
1744 separator string. By default, the width is 1, so the column separator | |
1745 is the character before point. | |
1746 | |
1747 When a line has the separator at the proper place, @kbd{@key{F2} s} | |
1748 puts the text after the separator into the right-hand buffer, and | |
1749 deletes the separator. Lines that don't have the column separator at | |
1750 the proper place remain unsplit; they stay in the left-hand buffer, and | |
1751 the right-hand buffer gets an empty line to correspond. (This is the | |
1752 way to write a line that ``spans both columns while in two-column | |
1753 mode'': write it in the left-hand buffer, and put an empty line in the | |
1754 right-hand buffer.) | |
1755 | |
1756 @kindex F2 RET | |
1757 @kindex C-x 6 RET | |
1758 @findex 2C-newline | |
1759 The command @kbd{C-x 6 @key{RET}} or @kbd{@key{F2} @key{RET}} | |
1760 (@code{2C-newline}) inserts a newline in each of the two buffers at | |
1761 corresponding positions. This is the easiest way to add a new line to | |
1762 the two-column text while editing it in split buffers. | |
1763 | |
1764 @kindex F2 1 | |
1765 @kindex C-x 6 1 | |
1766 @findex 2C-merge | |
1767 When you have edited both buffers as you wish, merge them with | |
1768 @kbd{@key{F2} 1} or @kbd{C-x 6 1} (@code{2C-merge}). This copies the | |
1769 text from the right-hand buffer as a second column in the other buffer. | |
1770 To go back to two-column editing, use @kbd{@key{F2} s}. | |
1771 | |
1772 @kindex F2 d | |
1773 @kindex C-x 6 d | |
1774 @findex 2C-dissociate | |
1775 Use @kbd{@key{F2} d} or @kbd{C-x 6 d} to dissociate the two buffers, | |
1776 leaving each as it stands (@code{2C-dissociate}). If the other buffer, | |
1777 the one not current when you type @kbd{@key{F2} d}, is empty, | |
1778 @kbd{@key{F2} d} kills it. | |
1779 | |
1780 @node Editing Binary Files, Saving Emacs Sessions, Two-Column, Top | |
1781 @section Editing Binary Files | |
1782 | |
1783 @cindex Hexl mode | |
1784 @cindex mode, Hexl | |
1785 @cindex editing binary files | |
31029 | 1786 @cindex hex editing |
25829 | 1787 There is a special major mode for editing binary files: Hexl mode. To |
1788 use it, use @kbd{M-x hexl-find-file} instead of @kbd{C-x C-f} to visit | |
1789 the file. This command converts the file's contents to hexadecimal and | |
1790 lets you edit the translation. When you save the file, it is converted | |
1791 automatically back to binary. | |
1792 | |
1793 You can also use @kbd{M-x hexl-mode} to translate an existing buffer | |
1794 into hex. This is useful if you visit a file normally and then discover | |
1795 it is a binary file. | |
1796 | |
1797 Ordinary text characters overwrite in Hexl mode. This is to reduce | |
1798 the risk of accidentally spoiling the alignment of data in the file. | |
1799 There are special commands for insertion. Here is a list of the | |
1800 commands of Hexl mode: | |
1801 | |
1802 @c I don't think individual index entries for these commands are useful--RMS. | |
1803 @table @kbd | |
1804 @item C-M-d | |
1805 Insert a byte with a code typed in decimal. | |
1806 | |
1807 @item C-M-o | |
1808 Insert a byte with a code typed in octal. | |
1809 | |
1810 @item C-M-x | |
1811 Insert a byte with a code typed in hex. | |
1812 | |
1813 @item C-x [ | |
1814 Move to the beginning of a 1k-byte ``page.'' | |
1815 | |
1816 @item C-x ] | |
1817 Move to the end of a 1k-byte ``page.'' | |
1818 | |
1819 @item M-g | |
1820 Move to an address specified in hex. | |
1821 | |
1822 @item M-j | |
1823 Move to an address specified in decimal. | |
1824 | |
1825 @item C-c C-c | |
1826 Leave Hexl mode, going back to the major mode this buffer had before you | |
1827 invoked @code{hexl-mode}. | |
1828 @end table | |
1829 | |
31029 | 1830 @noindent |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
1831 Other Hexl commands let you insert strings (sequences) of binary |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
1832 bytes, move by short's or int's, etc.; type @kbd{C-h a hexl- |
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
1833 @key{RET}} for details. |
31029 | 1834 |
1835 | |
25829 | 1836 @node Saving Emacs Sessions, Recursive Edit, Editing Binary Files, Top |
1837 @section Saving Emacs Sessions | |
1838 @cindex saving sessions | |
38025
64ee3e7394ed
Add a few more index entries for desktop.el.
Eli Zaretskii <eliz@gnu.org>
parents:
38017
diff
changeset
|
1839 @cindex restore session |
64ee3e7394ed
Add a few more index entries for desktop.el.
Eli Zaretskii <eliz@gnu.org>
parents:
38017
diff
changeset
|
1840 @cindex remember editing session |
64ee3e7394ed
Add a few more index entries for desktop.el.
Eli Zaretskii <eliz@gnu.org>
parents:
38017
diff
changeset
|
1841 @cindex reload files |
25829 | 1842 @cindex desktop |
1843 | |
1844 You can use the Desktop library to save the state of Emacs from one | |
1845 session to another. Saving the state means that Emacs starts up with | |
1846 the same set of buffers, major modes, buffer positions, and so on that | |
1847 the previous Emacs session had. | |
1848 | |
1849 @vindex desktop-enable | |
1850 To use Desktop, you should use the Customization buffer (@pxref{Easy | |
1851 Customization}) to set @code{desktop-enable} to a non-@code{nil} value, | |
1852 or add these lines at the end of your @file{.emacs} file: | |
1853 | |
1854 @example | |
1855 (desktop-load-default) | |
1856 (desktop-read) | |
1857 @end example | |
1858 | |
1859 @noindent | |
1860 @findex desktop-save | |
1861 The first time you save the state of the Emacs session, you must do it | |
1862 manually, with the command @kbd{M-x desktop-save}. Once you have done | |
1863 that, exiting Emacs will save the state again---not only the present | |
1864 Emacs session, but also subsequent sessions. You can also save the | |
1865 state at any time, without exiting Emacs, by typing @kbd{M-x | |
1866 desktop-save} again. | |
1867 | |
1868 In order for Emacs to recover the state from a previous session, you | |
1869 must start it with the same current directory as you used when you | |
1870 started the previous session. This is because @code{desktop-read} looks | |
1871 in the current directory for the file to read. This means that you can | |
1872 have separate saved sessions in different directories; the directory in | |
1873 which you start Emacs will control which saved session to use. | |
1874 | |
1875 @vindex desktop-files-not-to-save | |
1876 The variable @code{desktop-files-not-to-save} controls which files are | |
1877 excluded from state saving. Its value is a regular expression that | |
1878 matches the files to exclude. By default, remote (ftp-accessed) files | |
1879 are excluded; this is because visiting them again in the subsequent | |
1880 session would be slow. If you want to include these files in state | |
1881 saving, set @code{desktop-files-not-to-save} to @code{"^$"}. | |
1882 @xref{Remote Files}. | |
1883 | |
29083 | 1884 @vindex save-place |
1885 @cindex Saveplace | |
1886 @findex toggle-save-place | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1887 The Saveplace library provides a simpler feature that records your |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1888 position in each file when you kill its buffer (or kill Emacs), and |
29083 | 1889 jumps to the same position when you visit the file again (even in |
31310 | 1890 another Emacs session). Use @kbd{M-x toggle-save-place} to turn on |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1891 place-saving in a given file. Customize the option @code{save-place} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
1892 to turn it on for all files in each session. |
29083 | 1893 |
25829 | 1894 @node Recursive Edit, Emulation, Saving Emacs Sessions, Top |
1895 @section Recursive Editing Levels | |
1896 @cindex recursive editing level | |
1897 @cindex editing level, recursive | |
1898 | |
1899 A @dfn{recursive edit} is a situation in which you are using Emacs | |
1900 commands to perform arbitrary editing while in the middle of another | |
1901 Emacs command. For example, when you type @kbd{C-r} inside of a | |
1902 @code{query-replace}, you enter a recursive edit in which you can change | |
1903 the current buffer. On exiting from the recursive edit, you go back to | |
1904 the @code{query-replace}. | |
1905 | |
1906 @kindex C-M-c | |
1907 @findex exit-recursive-edit | |
1908 @cindex exiting recursive edit | |
1909 @dfn{Exiting} the recursive edit means returning to the unfinished | |
1910 command, which continues execution. The command to exit is @kbd{C-M-c} | |
1911 (@code{exit-recursive-edit}). | |
1912 | |
1913 You can also @dfn{abort} the recursive edit. This is like exiting, | |
1914 but also quits the unfinished command immediately. Use the command | |
1915 @kbd{C-]} (@code{abort-recursive-edit}) to do this. @xref{Quitting}. | |
1916 | |
1917 The mode line shows you when you are in a recursive edit by displaying | |
1918 square brackets around the parentheses that always surround the major and | |
1919 minor mode names. Every window's mode line shows this, in the same way, | |
1920 since being in a recursive edit is true of Emacs as a whole rather than | |
1921 any particular window or buffer. | |
1922 | |
1923 It is possible to be in recursive edits within recursive edits. For | |
1924 example, after typing @kbd{C-r} in a @code{query-replace}, you may type a | |
1925 command that enters the debugger. This begins a recursive editing level | |
1926 for the debugger, within the recursive editing level for @kbd{C-r}. | |
1927 Mode lines display a pair of square brackets for each recursive editing | |
1928 level currently in progress. | |
1929 | |
1930 Exiting the inner recursive edit (such as, with the debugger @kbd{c} | |
1931 command) resumes the command running in the next level up. When that | |
1932 command finishes, you can then use @kbd{C-M-c} to exit another recursive | |
1933 editing level, and so on. Exiting applies to the innermost level only. | |
1934 Aborting also gets out of only one level of recursive edit; it returns | |
1935 immediately to the command level of the previous recursive edit. If you | |
1936 wish, you can then abort the next recursive editing level. | |
1937 | |
1938 Alternatively, the command @kbd{M-x top-level} aborts all levels of | |
1939 recursive edits, returning immediately to the top-level command reader. | |
1940 | |
1941 The text being edited inside the recursive edit need not be the same text | |
1942 that you were editing at top level. It depends on what the recursive edit | |
1943 is for. If the command that invokes the recursive edit selects a different | |
1944 buffer first, that is the buffer you will edit recursively. In any case, | |
1945 you can switch buffers within the recursive edit in the normal manner (as | |
1946 long as the buffer-switching keys have not been rebound). You could | |
1947 probably do all the rest of your editing inside the recursive edit, | |
1948 visiting files and all. But this could have surprising effects (such as | |
1949 stack overflow) from time to time. So remember to exit or abort the | |
1950 recursive edit when you no longer need it. | |
1951 | |
1952 In general, we try to minimize the use of recursive editing levels in | |
1953 GNU Emacs. This is because they constrain you to ``go back'' in a | |
1954 particular order---from the innermost level toward the top level. When | |
1955 possible, we present different activities in separate buffers so that | |
1956 you can switch between them as you please. Some commands switch to a | |
1957 new major mode which provides a command to switch back. These | |
1958 approaches give you more flexibility to go back to unfinished tasks in | |
1959 the order you choose. | |
1960 | |
28448 | 1961 @node Emulation, Hyperlinking, Recursive Edit, Top |
25829 | 1962 @section Emulation |
1963 @cindex emulating other editors | |
1964 @cindex other editors | |
1965 @cindex EDT | |
1966 @cindex vi | |
27210 | 1967 @cindex PC keybindings |
1968 @cindex scrolling all windows | |
1969 @cindex PC selecion | |
1970 @cindex Motif keybindings | |
1971 @cindex Macintosh keybindings | |
1972 @cindex WordStar | |
25829 | 1973 |
1974 GNU Emacs can be programmed to emulate (more or less) most other | |
1975 editors. Standard facilities can emulate these: | |
1976 | |
1977 @table @asis | |
27210 | 1978 @item CRiSP/Brief (PC editor) |
1979 @findex crisp-mode | |
1980 @vindex crisp-override-meta-x | |
1981 @findex scroll-all-mode | |
30856 | 1982 @cindex CRiSP mode |
1983 @cindex Brief emulation | |
36263
11db0318031d
Remove redundant index entries.
Eli Zaretskii <eliz@gnu.org>
parents:
36185
diff
changeset
|
1984 @cindex emulation of Brief |
30856 | 1985 @cindex mode, CRiSP |
1986 You can turn on keybindings to emulate the CRiSP/Brief editor with | |
1987 @kbd{M-x crisp-mode}. Note that this rebinds @kbd{M-x} to exit Emacs | |
1988 unless you change the user option @code{crisp-override-meta-x}. You can | |
1989 also use the command @kbd{M-x scroll-all-mode} or set the user option | |
1990 @code{crisp-load-scroll-all} to emulate CRiSP's scroll-all feature | |
1991 (scrolling all windows together). | |
27210 | 1992 |
25829 | 1993 @item EDT (DEC VMS editor) |
1994 @findex edt-emulation-on | |
1995 @findex edt-emulation-off | |
1996 Turn on EDT emulation with @kbd{M-x edt-emulation-on}. @kbd{M-x | |
1997 edt-emulation-off} restores normal Emacs command bindings. | |
1998 | |
1999 Most of the EDT emulation commands are keypad keys, and most standard | |
2000 Emacs key bindings are still available. The EDT emulation rebindings | |
2001 are done in the global keymap, so there is no problem switching | |
2002 buffers or major modes while in EDT emulation. | |
2003 | |
36185 | 2004 @item ``PC'' bindings |
27210 | 2005 @findex pc-bindings-mode |
36185 | 2006 @cindex ``PC'' key bindings |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2007 The command @kbd{M-x pc-bindings-mode} sets up certain key bindings |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2008 for ``PC compatibility''---what people are often used to on PCs---as |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2009 follows: @kbd{Delete} and its variants delete forward instead of |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2010 backward, @kbd{C-Backspace} kills backward a word (as @kbd{C-Delete} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2011 normally would), @kbd{M-Backspace} does undo, @kbd{Home} and @kbd{End} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2012 move to beginning and end of line, @kbd{C-Home} and @kbd{C-End} move |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2013 to beginning and end of buffer and @kbd{C-Escape} does |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2014 @code{list-buffers}. |
27210 | 2015 |
30856 | 2016 @item PC Selection mode |
27210 | 2017 @findex pc-selection-mode |
30856 | 2018 @cindex PC Selection minor mode |
2019 @cindex mode, PC selection | |
36185 | 2020 @cindex selection, PC |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2021 The command @kbd{M-x pc-selection-mode} enables a global minor mode |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2022 that emulates the mark, copy, cut and paste commands of various other |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2023 systems---an interface known as CUA. It establishes the keybindings |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2024 of PC mode, and also modifies the bindings of the cursor keys and the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2025 @kbd{next}, @kbd{prior}, @kbd{home} and @kbd{end} keys. It does not |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2026 provide the full set of CUA keybindings---the fundamental Emacs keys |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2027 @kbd{C-c}, @kbd{C-v} and @kbd{C-x} are not changed. |
27210 | 2028 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2029 The standard keys for moving around (@kbd{right}, @kbd{left}, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2030 @kbd{up}, @kbd{down}, @kbd{home}, @kbd{end}, @kbd{prior}, @kbd{next}, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2031 called ``move-keys'') deactivate the mark in PC selection mode. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2032 However, using @kbd{Shift} together with the ``move keys'' activates |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2033 the region over which they move. The copy, cut and paste functions |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2034 are available on @kbd{C-insert}, @kbd{S-delete} and @kbd{S-insert} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2035 respectively. |
27210 | 2036 |
31310 | 2037 @cindex s-region package |
27210 | 2038 The @code{s-region} package provides similar, but less complete, |
2039 facilities. | |
2040 | |
28448 | 2041 @item TPU (DEC VMS editor) |
2042 @findex tpu-edt-on | |
2043 @cindex TPU | |
2044 @kbd{M-x tpu-edt-on} turns on emulation of the TPU editor emulating EDT. | |
2045 | |
25829 | 2046 @item vi (Berkeley editor) |
2047 @findex viper-mode | |
2048 Viper is the newest emulator for vi. It implements several levels of | |
2049 emulation; level 1 is closest to vi itself, while level 5 departs | |
2050 somewhat from strict emulation to take advantage of the capabilities of | |
2051 Emacs. To invoke Viper, type @kbd{M-x viper-mode}; it will guide you | |
2052 the rest of the way and ask for the emulation level. @inforef{Top, | |
2053 Viper, viper}. | |
2054 | |
2055 @item vi (another emulator) | |
2056 @findex vi-mode | |
2057 @kbd{M-x vi-mode} enters a major mode that replaces the previously | |
2058 established major mode. All of the vi commands that, in real vi, enter | |
2059 ``input'' mode are programmed instead to return to the previous major | |
2060 mode. Thus, ordinary Emacs serves as vi's ``input'' mode. | |
2061 | |
2062 Because vi emulation works through major modes, it does not work | |
2063 to switch buffers during emulation. Return to normal Emacs first. | |
2064 | |
2065 If you plan to use vi emulation much, you probably want to bind a key | |
2066 to the @code{vi-mode} command. | |
2067 | |
2068 @item vi (alternate emulator) | |
2069 @findex vip-mode | |
2070 @kbd{M-x vip-mode} invokes another vi emulator, said to resemble real vi | |
2071 more thoroughly than @kbd{M-x vi-mode}. ``Input'' mode in this emulator | |
2072 is changed from ordinary Emacs so you can use @key{ESC} to go back to | |
2073 emulated vi command mode. To get from emulated vi command mode back to | |
2074 ordinary Emacs, type @kbd{C-z}. | |
2075 | |
2076 This emulation does not work through major modes, and it is possible | |
2077 to switch buffers in various ways within the emulator. It is not | |
2078 so necessary to assign a key to the command @code{vip-mode} as | |
2079 it is with @code{vi-mode} because terminating insert mode does | |
2080 not use it. | |
2081 | |
2082 @inforef{Top, VIP, vip}, for full information. | |
27210 | 2083 |
2084 @item WordStar (old wordprocessor) | |
2085 @findex wordstar-mode | |
2086 @kbd{M-x wordstar-mode} provides a major mode with WordStar-like | |
2087 keybindings. | |
25829 | 2088 @end table |
2089 | |
28448 | 2090 @node Hyperlinking, Dissociated Press, Emulation, Top |
2091 @section Hyperlinking and Navigation Features | |
2092 | |
2093 @cindex hyperlinking | |
2094 @cindex navigation | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2095 Various modes documented elsewhere have hypertext features so that |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2096 you can follow links, usually by clicking @kbd{Mouse-2} on the link or |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2097 typing @key{RET} while point is on the link. Info mode, Help mode and |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2098 the Dired-like modes are examples. The Tags facility links between |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2099 uses and definitions in source files, see @ref{Tags}. Imenu provides |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2100 navigation amongst items indexed in the current buffer, see |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2101 @ref{Imenu}. Info-lookup provides mode-specific lookup of definitions |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2102 in Info indexes, see @ref{Documentation}. Speedbar maintains a frame |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2103 in which links to files, and locations in files are displayed, see |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2104 @ref{Speedbar}. |
30856 | 2105 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2106 Other non-mode-specific facilities described in this section enable |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2107 following links from the current buffer in a context-sensitive |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2108 fashion. |
28448 | 2109 |
30856 | 2110 @menu |
2111 * Browse-URL:: Following URLs. | |
2112 * Goto-address:: Activating URLs. | |
2113 * FFAP:: Finding files etc. at point. | |
2114 * Find-func:: Finding function and variable definitions. | |
2115 @end menu | |
28448 | 2116 |
30856 | 2117 @node Browse-URL |
2118 @subsection Following URLs | |
28448 | 2119 @cindex World Wide Web |
30856 | 2120 @cindex Web |
28448 | 2121 @findex browse-url |
2122 @findex browse-url-at-point | |
2123 @findex browse-url-at-mouse | |
2124 @cindex Browse-URL | |
2125 @cindex URLs | |
30856 | 2126 |
2127 @table @kbd | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
2128 @item M-x browse-url @key{RET} @var{url} @key{RET} |
30856 | 2129 Load a URL into a Web browser. |
2130 @end table | |
2131 | |
28448 | 2132 The Browse-URL package provides facilities for following URLs specifying |
2133 links on the World Wide Web. Usually this works by invoking a web | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2134 browser, but you can, for instance, arrange to invoke @code{compose-mail} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2135 from @samp{mailto:} URLs. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2136 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2137 The general way to use this feature is to type @kbd{M-x browse-url}, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2138 which displays a specified URL. If point is located near a plausible |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2139 URL, that URL is used as the default. Other commands are available |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2140 which you might like to bind to keys, such as |
30856 | 2141 @code{browse-url-at-point} and @code{browse-url-at-mouse}. |
28448 | 2142 |
30856 | 2143 @vindex browse-url-browser-function |
38017
32f10000ac35
Don't use the British spelling of "behaviour".
Eli Zaretskii <eliz@gnu.org>
parents:
37846
diff
changeset
|
2144 You can customize Browse-URL's behavior via various options in the |
30856 | 2145 @code{browse-url} Customize group, particularly |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2146 @code{browse-url-browser-function}. You can invoke actions dependent |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2147 on the type of URL by defining @code{browse-url-browser-function} as |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2148 an association list. The package's commentary available via @kbd{C-h |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2149 p} provides more information. Packages with facilities for following |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2150 URLs should always go through Browse-URL, so that the customization |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2151 options for Browse-URL will affect all browsing in Emacs. |
28448 | 2152 |
30856 | 2153 @node Goto-address |
2154 @subsection Activating URLs | |
28448 | 2155 @findex goto-address |
2156 @cindex Goto-address | |
2157 @cindex URLs, activating | |
30856 | 2158 |
2159 @table @kbd | |
2160 @item M-x goto-address | |
2161 Activate URLs and e-mail addresses in the current buffer. | |
2162 @end table | |
2163 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2164 You can make URLs in the current buffer active with @kbd{M-x |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2165 goto-address}. This finds all the URLs in the buffer, and establishes |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2166 bindings for @kbd{Mouse-2} and @kbd{C-c @key{RET}} on them. After |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2167 activation, if you click on a URL with @kbd{Mouse-2}, or move to a URL |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2168 and type @kbd{C-c @key{RET}}, that will display the web page that the URL |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2169 specifies. For a @samp{mailto} URL, it sends mail instead, using your |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2170 selected mail-composition method (@pxref{Mail Methods}). |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2171 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2172 It can be useful to add @code{goto-address} to mode hooks and the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2173 hooks used to display an incoming message. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2174 @code{rmail-show-message-hook} is the appropriate hook for Rmail, and |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2175 @code{mh-show-mode-hook} for MH-E. This is not needed for Gnus, |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2176 which has a similar feature of its own. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2177 |
28448 | 2178 |
30856 | 2179 @node FFAP |
2180 @subsection Finding Files and URLs at Point | |
28448 | 2181 @findex find-file-at-point |
2182 @findex ffap | |
30856 | 2183 @findex ffap-dired-at-point |
2184 @findex ffap-next | |
2185 @findex ffap-menu | |
2186 @cindex finding file at point | |
2187 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2188 FFAP mode replaces certain key bindings for finding files, including |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2189 @kbd{C-x C-f}, with commands that provide more sensitive defaults. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2190 These commands behave like the ordinary ones when given a prefix |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2191 argument. Otherwise, they get the default file name or URL from the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2192 text around point. If what is found in the buffer has the form of a |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2193 URL rather than a file name, the commands use @code{browse-url} to |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2194 view it. |
30856 | 2195 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2196 This feature is useful for following references in mail or news |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2197 buffers, @file{README} files, @file{MANIFEST} files, and so on. The |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2198 @samp{ffap} package's commentary available via @kbd{C-h p} and the |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2199 @code{ffap} Custom group provide details. |
28448 | 2200 |
30856 | 2201 @cindex FFAP minor mode |
2202 @findex ffap-mode | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2203 You can turn on FFAP minor mode to make the following key bindings |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2204 and to install hooks for using @code{ffap} in Rmail, Gnus and VM |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2205 article buffers. |
30856 | 2206 |
2207 @table @kbd | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2208 @item C-x C-f @var{filename} @key{RET} |
30856 | 2209 @kindex C-x C-f @r{(FFAP)} |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2210 Find @var{filename}, guessing a default from text around point |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2211 (@code{find-file-at-point}). |
30856 | 2212 @item C-x 4 f |
2213 @kindex C-x 4 f @r{(FFAP)} | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2214 @code{ffap-other-window}, analogous to @code{find-file-other-window}. |
30856 | 2215 @item C-x 5 f |
2216 @kindex C-x 5 f @r{(FFAP)} | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2217 @code{ffap-other-frame}, analogous to @code{find-file-other-frame}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2218 @item M-x ffap-next |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2219 Search buffer for next file name or URL, then find that file or URL. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2220 @item C-x d @var{directory} @key{RET} |
30856 | 2221 @kindex C-x d @r{(FFAP)} |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2222 Start Dired on @var{directory}, defaulting to the directory name at |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2223 point (@code{ffap-dired-at-point}). |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2224 @item S-Mouse-3 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2225 @kindex S-Mouse-3 @r{(FFAP)} |
30856 | 2226 @code{ffap-at-mouse} finds the file guessed from text around the position |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2227 of a mouse click. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2228 @item C-S-Mouse-3 |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2229 @kindex C-S-Mouse-3 @r{(FFAP)} |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2230 Display a menu of files and URLs mentioned in current buffer, then |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2231 find the one you select (@code{ffap-menu}). |
30856 | 2232 @end table |
2233 | |
2234 @node Find-func | |
2235 @subsection Finding Function and Variable Definitions | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2236 @cindex definitions, finding in Lisp sources |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2237 @cindex Lisp definitions, finding in sources |
30856 | 2238 |
2239 @table @kbd | |
2240 @item M-x find-function @key{RET} @var{function} @key{RET} | |
37846
d8b197c6f26d
Explain M-! output can go in echo area.
Richard M. Stallman <rms@gnu.org>
parents:
37018
diff
changeset
|
2241 Find the definition of @var{function} in its source file. |
30856 | 2242 @item M-x find-variable @key{RET} @var{variable} @key{RET} |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2243 Find the definition of @var{variable} in its source file. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2244 @item M-x find-function-on-key @key{RET} @var{key} |
30856 | 2245 Find the definition of the function that @var{key} invokes. |
2246 @end table | |
2247 | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2248 These commands provide an easy way to find the definitions of Emacs |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2249 Lisp functions and variables. They are similar in purpose to the Tags |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2250 facility (@pxref{Tags}), but don't require a tags table; on the other |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2251 hand, they only works for function and variable definitions that are |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2252 already loaded in the Emacs session. |
28448 | 2253 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2254 @findex find-function |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2255 @findex find-function-on-key |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2256 @findex find-variable |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2257 To find the definition of a function, use @kbd{M-x find-function}. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2258 @kbd{M-x find-variable} finds the definition of a specified variable. |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2259 @kbd{M-x find-function-on-key} finds the definition of the function |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2260 bound to a specified key. |
28448 | 2261 |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2262 To use these commands, you must have the Lisp source (@samp{.el}) |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2263 files available along with the compiled (@samp{.elc}) files, in |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2264 directories in @code{load-path}. You can use compressed source files |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2265 if you enable Auto Compression mode. These commands only handle |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2266 definitions written in Lisp, not primitive functions or variables |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2267 defined in the C code of Emacs. |
28448 | 2268 |
2269 @node Dissociated Press, Amusements, Hyperlinking, Top | |
25829 | 2270 @section Dissociated Press |
2271 | |
2272 @findex dissociated-press | |
2273 @kbd{M-x dissociated-press} is a command for scrambling a file of text | |
2274 either word by word or character by character. Starting from a buffer of | |
2275 straight English, it produces extremely amusing output. The input comes | |
2276 from the current Emacs buffer. Dissociated Press writes its output in a | |
2277 buffer named @samp{*Dissociation*}, and redisplays that buffer after every | |
2278 couple of lines (approximately) so you can read the output as it comes out. | |
2279 | |
2280 Dissociated Press asks every so often whether to continue generating | |
2281 output. Answer @kbd{n} to stop it. You can also stop at any time by | |
2282 typing @kbd{C-g}. The dissociation output remains in the | |
2283 @samp{*Dissociation*} buffer for you to copy elsewhere if you wish. | |
2284 | |
2285 @cindex presidentagon | |
2286 Dissociated Press operates by jumping at random from one point in the | |
2287 buffer to another. In order to produce plausible output rather than | |
2288 gibberish, it insists on a certain amount of overlap between the end of | |
2289 one run of consecutive words or characters and the start of the next. | |
2290 That is, if it has just printed out `president' and then decides to jump | |
2291 to a different point in the file, it might spot the `ent' in `pentagon' | |
2292 and continue from there, producing `presidentagon'.@footnote{This | |
2293 dissociword actually appeared during the Vietnam War, when it was very | |
2294 appropriate.} Long sample texts produce the best results. | |
2295 | |
2296 @cindex againformation | |
2297 A positive argument to @kbd{M-x dissociated-press} tells it to operate | |
2298 character by character, and specifies the number of overlap characters. A | |
2299 negative argument tells it to operate word by word and specifies the number | |
2300 of overlap words. In this mode, whole words are treated as the elements to | |
2301 be permuted, rather than characters. No argument is equivalent to an | |
2302 argument of two. For your againformation, the output goes only into the | |
2303 buffer @samp{*Dissociation*}. The buffer you start with is not changed. | |
2304 | |
2305 @cindex Markov chain | |
2306 @cindex ignoriginal | |
2307 @cindex techniquitous | |
2308 Dissociated Press produces nearly the same results as a Markov chain | |
2309 based on a frequency table constructed from the sample text. It is, | |
2310 however, an independent, ignoriginal invention. Dissociated Press | |
2311 techniquitously copies several consecutive characters from the sample | |
2312 between random choices, whereas a Markov chain would choose randomly for | |
2313 each word or character. This makes for more plausible sounding results, | |
2314 and runs faster. | |
2315 | |
2316 @cindex outragedy | |
2317 @cindex buggestion | |
2318 @cindex properbose | |
2319 @cindex mustatement | |
2320 @cindex developediment | |
2321 @cindex userenced | |
2322 It is a mustatement that too much use of Dissociated Press can be a | |
2323 developediment to your real work. Sometimes to the point of outragedy. | |
2324 And keep dissociwords out of your documentation, if you want it to be well | |
2325 userenced and properbose. Have fun. Your buggestions are welcome. | |
2326 | |
2327 @node Amusements, Customization, Dissociated Press, Top | |
2328 @section Other Amusements | |
2329 @cindex boredom | |
2330 @findex hanoi | |
2331 @findex yow | |
2332 @findex gomoku | |
2333 @cindex tower of Hanoi | |
2334 | |
2335 If you are a little bit bored, you can try @kbd{M-x hanoi}. If you are | |
2336 considerably bored, give it a numeric argument. If you are very very | |
2337 bored, try an argument of 9. Sit back and watch. | |
2338 | |
2339 @cindex Go Moku | |
2340 If you want a little more personal involvement, try @kbd{M-x gomoku}, | |
2341 which plays the game Go Moku with you. | |
2342 | |
2343 @findex blackbox | |
2344 @findex mpuz | |
27210 | 2345 @findex 5x5 |
25829 | 2346 @cindex puzzles |
27210 | 2347 @kbd{M-x blackbox}, @kbd{M-x mpuz} and @kbd{M-x 5x5} are kinds of puzzles. |
25829 | 2348 @code{blackbox} challenges you to determine the location of objects |
2349 inside a box by tomography. @code{mpuz} displays a multiplication | |
2350 puzzle with letters standing for digits in a code that you must | |
2351 guess---to guess a value, type a letter and then the digit you think it | |
27210 | 2352 stands for. The aim of @code{5x5} is to fill in all the squares. |
25829 | 2353 |
30856 | 2354 @findex decipher |
2355 @cindex ciphers | |
2356 @cindex cryptanalysis | |
2357 @kbd{M-x decipher} helps you to cryptanalyze a buffer which is encrypted | |
2358 in a simple monoalphabetic substitution cipher. | |
2359 | |
25829 | 2360 @findex dunnet |
2361 @kbd{M-x dunnet} runs an adventure-style exploration game, which is | |
2362 a bigger sort of puzzle. | |
2363 | |
27210 | 2364 @findex lm |
2365 @cindex landmark game | |
2366 @kbd{M-x lm} runs a relatively non-participatory game in which a robot | |
2367 attempts to maneuver towards a tree at the center of the window based on | |
2368 unique olfactory cues from each of the four directions. | |
2369 | |
2370 @findex life | |
2371 @cindex Life | |
36185 | 2372 @kbd{M-x life} runs Conway's ``Life'' cellular automaton. |
27210 | 2373 |
30856 | 2374 @findex morse-region |
2375 @findex unmorse-region | |
2376 @cindex Morse code | |
2377 @cindex --/---/.-./.../. | |
2378 @kbd{M-x morse-region} converts text in a region to Morse code and | |
2379 @kbd{M-x unmorse-region} converts it back. No cause for remorse. | |
2380 | |
2381 @findex pong | |
2382 @cindex Pong game | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2383 @kbd{M-x pong} plays a Pong-like game, bouncing the ball off opposing |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2384 bats. |
30856 | 2385 |
27210 | 2386 @findex solitaire |
2387 @cindex solitaire | |
2388 @kbd{M-x solitaire} plays a game of solitaire in which you jump pegs | |
2389 across other pegs. | |
2390 | |
30856 | 2391 @findex studlify-region |
2392 @cindex StudlyCaps | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2393 @kbd{M-x studlify-region} studlify-cases the region, producing |
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2394 text like this: |
30856 | 2395 |
2396 @example | |
2397 M-x stUdlIfY-RegioN stUdlIfY-CaSeS thE region. | |
2398 @end example | |
2399 | |
27210 | 2400 @findex tetris |
2401 @cindex Tetris | |
2402 @findex snake | |
2403 @cindex Snake | |
36168
df827c1def99
Clean up close-quote punctuation.
Richard M. Stallman <rms@gnu.org>
parents:
35648
diff
changeset
|
2404 @kbd{M-x tetris} runs an implementation of the well-known Tetris game. |
27210 | 2405 Likewise, @kbd{M-x snake} provides an implementation of Snake. |
2406 | |
25829 | 2407 When you are frustrated, try the famous Eliza program. Just do |
2408 @kbd{M-x doctor}. End each input by typing @key{RET} twice. | |
2409 | |
2410 @cindex Zippy | |
2411 When you are feeling strange, type @kbd{M-x yow}. | |
30862 | 2412 |
2413 @findex zone | |
2414 The command @kbd{M-x zone} plays games with the display when Emacs is | |
2415 idle. |