]> code.delx.au - gnu-emacs/blob - man/faq.texi
Require ps-vars instead of ps-print-def.
[gnu-emacs] / man / faq.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename ../info/emacs-faq.info
4 @settitle GNU Emacs FAQ
5 @c %**end of header
6
7 @setchapternewpage odd
8
9 @c The @ifinfo stuff only appears in the Info version
10 @ifinfo
11 @dircategory Editors
12 @direntry
13 * Emacs FAQ: (emacs-faq). Frequently Asked Questions about Emacs.
14 @end direntry
15
16 Copyright 1994-1999 Reuven M. Lerner@*
17 Copyright 1992-1993 Steven Byrnes@*
18 Copyright 1990-1992 Joseph Brian Wells@*
19
20 This list of frequently asked questions about GNU Emacs with answers
21 ("FAQ") may be translated into other languages, transformed into other
22 formats (e.g. Texinfo, Info, WWW, WAIS), and updated with new information.
23
24 The same conditions apply to any derivative of the FAQ as apply to the FAQ
25 itself. Every copy of the FAQ must include this notice or an approved
26 translation, information on who is currently maintaining the FAQ and how to
27 contact them (including their e-mail address), and information on where the
28 latest version of the FAQ is archived (including FTP information).
29
30 The FAQ may be copied and redistributed under these conditions, except that
31 the FAQ may not be embedded in a larger literary work unless that work
32 itself allows free copying and redistribution.
33
34 [This version has been somewhat edited from the last-posted version
35 (as of August 1999) for inclusion in the Emacs distribution.]
36
37 @end ifinfo
38
39 @c The @titlepage stuff only appears in the printed version
40 @titlepage
41 @sp 10
42 @center @titlefont{GNU Emacs FAQ}
43
44 @c The following two commands start the copyright page.
45 @page
46 @vskip 0pt plus 1filll
47 Copyright @copyright{} 1994-1999 Reuven M. Lerner@*
48 Copyright @copyright{} 1992-1993 Steven Byrnes@*
49 Copyright @copyright{} 1990-1992 Joseph Brian Wells@*
50
51 This list of frequently asked questions about GNU Emacs with answers
52 ("FAQ") may be translated into other languages, transformed into other
53 formats (e.g. Texinfo, Info, WWW, WAIS), and updated with new information.
54
55 The same conditions apply to any derivative of the FAQ as apply to the FAQ
56 itself. Every copy of the FAQ must include this notice or an approved
57 translation, information on who is currently maintaining the FAQ and how to
58 contact them (including their e-mail address), and information on where the
59 latest version of the FAQ is archived (including FTP information).
60
61 The FAQ may be copied and redistributed under these conditions, except that
62 the FAQ may not be embedded in a larger literary work unless that work
63 itself allows free copying and redistribution.
64
65 [This version has been somewhat edited from the last-posted version
66 (as of August 1999) for inclusion in the Emacs distribution.]
67 @end titlepage
68
69 @node Top, FAQ notation, (dir), (dir)
70
71 This is the GNU Emacs FAQ, last updated on @today{}.
72
73 The FAQ is slowly but surely being turned into a Texinfo document,
74 allowing us to create HTML, Info, and TeX documents from a single source
75 file. Please bear with us as we improve on this format. If you have
76 any suggestions or questions, please contact
77 @email{emacs-faq@@lerner.co.il, the FAQ maintainers}.
78
79 @menu
80 * FAQ notation::
81 * General questions::
82 * Getting help::
83 * Status of Emacs::
84 * Common requests::
85 * Bugs and problems::
86 * Compiling and installing Emacs::
87 * Finding Emacs and related packages::
88 * Major packages and programs::
89 * Key bindings::
90 * Alternate character sets::
91 * Mail and news::
92 * Concept index::
93 @end menu
94
95 @c ------------------------------------------------------------
96 @node FAQ notation, General questions, Top, Top
97 @chapter FAQ notation
98 @cindex FAQ notation
99
100 This section describes notation used in the GNU Emacs FAQ, as well as in
101 the Emacs documentation. Consult this section if this is the first time
102 you are reading the FAQ, or if you are confused by notation or terms
103 used in the FAQ.
104
105 @menu
106 * Basic keys::
107 * Extended commands::
108 * On-line manual::
109 * Filename conventions::
110 * Common acronyms::
111 @end menu
112
113 @node Basic keys, Extended commands, FAQ notation, FAQ notation
114 @section What do these mean: @kbd{C-h}, @kbd{M-C-a}, @key{RET}, @kbd{@key{ESC} a}, etc.?
115 @cindex Basic keys
116 @cindex Control key, notation for
117 @cindex @key{Meta} key, notation for
118 @cindex Control-meta characters, notation for
119 @cindex @kbd{C-h}, definition of
120 @cindex @kbd{M-C-h}, definition of
121 @cindex @key{DEL}, definition of
122 @cindex @key{ESC}, definition of
123 @cindex @key{LFD}, definition of
124 @cindex @key{RET}, definition of
125 @cindex @key{SPC}, definition of
126 @cindex @key{TAB}, definition of
127
128 @itemize @bullet
129
130 @item
131 @kbd{C-x}: press the @key{x} key while holding down the @key{Control} key
132
133 @item
134 @kbd{M-x}: press the @key{x} key while holding down the @key{Meta} key
135 (if your computer doesn't have a @key{Meta} key, see @pxref{No Meta key})
136
137 @item
138 @kbd{M-C-x}: press the @key{x} key while holding down both @key{Control}
139 and @key{Meta}
140
141 @item
142 @kbd{C-M-x}: a synonym for the above
143
144 @item
145 @key{LFD}: Linefeed or Newline; same as @kbd{C-j}
146
147 @item
148 @key{RET}: @key{Return}, sometimes marked @key{Enter}; same as @kbd{C-m}
149
150 @item
151 @key{DEL}: @key{Delete}, usually not the same as @key{Backspace}; same
152 as @kbd{C-?} (@pxref{Backspace invokes help} if deleting invokes Emacs help)
153
154 @item
155 @key{ESC}: Escape; same as @kbd{C-[}
156
157 @item
158 @key{TAB}: Tab; same as @kbd{C-i}
159
160 @item
161 @key{SPC}: Space bar
162
163 @end itemize
164
165 Key sequences longer than one key (and some single-key sequences) are
166 inside double quotes or on lines by themselves. Any real spaces in such
167 a key sequence should be ignored; only @key{SPC} really means press the
168 space key.
169
170 The ASCII code sent by @kbd{C-x} (except for @kbd{C-?}) is the value
171 that would be sent by pressing just @key{x} minus 96 (or 64 for
172 uppercase @key{X}) and will be from 0 to 31. The ASCII code sent by
173 @kbd{M-x} is the sum of 128 and the ASCII code that would be sent by
174 pressing just @key{x}. Essentially, @key{Control} turns off bits 5 and
175 6 and @key{Meta} turns on bit 7.
176
177 @kbd{C-?} (aka @key{DEL}) is ASCII code 127. It is a misnomer to call
178 @kbd{C-?} a "control" key, since 127 has both bits 5 and 6 turned ON.
179 Also, on very few keyboards does @kbd{C-?} generate ASCII code 127.
180
181 @inforef{Characters, Characters, emacs} and @inforef{Keys, Keys, emacs}
182 for more information. (@pxref{On-line manual} for more information about
183 Info.)
184
185 @node Extended commands, On-line manual, Basic keys, FAQ notation
186 @section What does @file{M-x @var{command}} mean?
187 @cindex Extended commands
188 @cindex Commands, extended
189 @cindex M-x, meaning of
190
191 @kbd{M-x @var{command}} means type @kbd{M-x}, then type the name of the
192 command, then type @key{RET}. (@pxref{Basic keys} if you're not sure
193 what @kbd{M-x} and @key{RET} mean.)
194
195 @kbd{M-x} (by default) invokes the command
196 @code{execute-extended-command}. This command allows you to run any
197 Emacs command if you can remember the command's name. If you can't
198 remember the command's name, you can type @key{TAB} and @key{SPC} for
199 completion, @key{?} for a list of possibilities, and @kbd{M-p} and
200 @kbd{M-n} to see previous commands entered. An Emacs "command" is any
201 "interactive" Emacs function.
202
203 Your system administrator may have bound other key sequences to invoke
204 @code{execute-extended-command}. A function key labeled @kbd{Do} is a
205 good candidate for this.
206
207 To run non-interactive Emacs functions, @pxref{Evaluating Emacs Lisp code}.
208
209 @node On-line manual, Filename conventions, Extended commands, FAQ notation
210 @section How do I read topic XXX in the on-line manual?
211 @cindex On-line manual, reading topics in
212 @cindex Reading topics in the on-line manual
213 @cindex Finding topics in the on-line manual
214 @cindex Info, finding topics in
215
216 When we refer you to topic XXX in the on-line manual, you can read this
217 manual node inside Emacs (assuming nothing is broken) by typing @kbd{C-h
218 i m emacs @key{RET} m XXX @key{RET}}.
219
220 This invokes Info, the GNU hypertext documentation browser. If you don't
221 already know how to use Info, type @key{?} from within Info.
222
223 If we refer to topic XXX:YYY, type @kbd{C-h i m emacs @key{RET} m XXX
224 @key{RET} m YYY @key{RET}}.
225
226 Your system administrator may not have installed the Info files, or may
227 have installed them improperly. In this case you should complain.
228
229 @xref{Getting a printed manual}, if you would like a paper copy of the
230 Emacs manual.
231
232 @node Filename conventions, Common acronyms, On-line manual, FAQ notation
233 @section What are @file{etc/SERVICE}, @file{src/config.h}, and @file{lisp/default.el}?
234 @cindex Filename conventions
235 @cindex Conventions for filenames
236 @cindex Directories and files that come with Emacs
237
238 These are files that come with Emacs. The Emacs distribution is divided
239 into subdirectories; the important ones are @file{etc}, @file{lisp}, and
240 @file{src}.
241
242 If you use Emacs, but don't know where it is kept on your system, start
243 Emacs, then type @kbd{C-h v data-directory @key{RET}}. The directory
244 name displayed by this will be the full pathname of the installed
245 @file{etc} directory.
246
247 The location of your Info directory (i.e., where on-line documentation
248 is stored) is kept in the variable @code{Info-default-directory-list}. Use
249 @kbd{C-h v Info-default-directory-list @key{RET}} to see the contents of
250 this variable, which will be a list of directory names. The last
251 directory in that list is probably where most Info files are stored. By
252 default, Info documentation is placed in @file{/usr/local/info}.
253
254 Some of these files are available individually via FTP or e-mail;
255 @pxref{Informational files for Emacs}. All are available in the source
256 distribution. Many of the files in the @file{etc} directory are also
257 available via the Emacs "help" menu, or by typing @kbd{C-h ?} (@kbd{M-x
258 help-for-help}).
259
260 Your system administrator may have removed the @file{src} directory and
261 many files from the @file{etc} directory.
262
263 @node Common acronyms, , Filename conventions, FAQ notation
264 @section What are FSF, LPF, OSF, GNU, RMS, FTP, and GPL?
265 @cindex FSF, definition of
266 @cindex LPF, definition of
267 @cindex OSF, definition of
268 @cindex GNU, definition of
269 @cindex RMS, definition of
270 @cindex Stallman, Richard, acronym for
271 @cindex Richard Stallman, acronym for
272 @cindex FTP, definition of
273 @cindex GPL, definition of
274 @cindex Acronyms, definitions for
275 @cindex Common acronyms, definitions for
276
277 @table @asis
278
279 @item FSF
280 Free Software Foundation
281
282 @item LPF
283 League for Programming Freedom
284
285 @item OSF
286 Open Software Foundation
287
288 @item GNU
289 GNU's Not Unix
290
291 @item RMS
292 Richard Matthew Stallman
293
294 @item FTP
295 File Transfer Protocol
296
297 @item GPL
298 GNU General Public License
299
300 @end table
301
302 Avoid confusing the FSF, the LPF, and the OSF. The LPF opposes
303 look-and-feel copyrights and software patents. The FSF aims to make
304 high quality free software available for everyone. The OSF is a
305 consortium of computer vendors which develops commercial software for
306 Unix systems.
307
308 The word "free" in the title of the Free Software Foundation refers to
309 "freedom," not "zero dollars." Anyone can charge any price for
310 GPL-covered software that they want to. However, in practice, the
311 freedom enforced by the GPL leads to low prices, because you can always
312 get the software for less money from someone else, because everyone has
313 the right to resell or give away GPL-covered software.
314
315 @c ------------------------------------------------------------
316 @node General questions, Getting help, FAQ notation, Top
317 @chapter General questions
318 @cindex General questions
319
320 This section contains general questions having to do with Emacs, the
321 Free Software Foundation, and related organizations.
322
323 @menu
324 * The LPF::
325 * Real meaning of copyleft::
326 * Guidelines for newsgroup postings::
327 * Newsgroup archives::
328 * Reporting bugs::
329 * Unsubscribing from Emacs lists::
330 * Contacting the FSF::
331 @end menu
332
333 @node The LPF, Real meaning of copyleft, General questions, General questions
334 @section What is the LPF?
335 @cindex LPF, description of
336 @cindex League for Programming Freedom
337 @cindex Software patents, opposition to
338 @cindex Patents for software, opposition to
339
340 The LPF opposes the expanding danger of software patents and
341 look-and-feel copyrights. To get more information, feel free to contact
342 the LPF via e-mail or otherwise. You may also contact
343 @email{jbw@@cs.bu.edu, Joe Wells}; he will be happy to talk with you
344 about the LPF.
345
346 You can find more information about the LPF in the file @file{etc/LPF}.
347 More papers describing the LPF's views are available on the Internet and
348 also from @uref{http://lpf.ai.mit.edu/, the LPF}.
349
350 @node Real meaning of copyleft, Guidelines for newsgroup postings, The LPF, General questions
351 @section What is the real legal meaning of the GNU copyleft?
352 @cindex Copyleft, real meaning of
353 @cindex GPL, real meaning of
354 @cindex General Public License, real meaning of
355 @cindex Discussion of the GPL
356
357 The real legal meaning of the GNU General Public License (copyleft) will
358 only be known if and when a judge rules on its validity and scope.
359 There has never been a copyright infringement case involving the GPL to
360 set any precedents. Please take any discussion regarding this issue to
361 the newsgroup @uref{news:gnu.misc.discuss}, which was created to hold the
362 extensive flame wars on the subject.
363
364 RMS writes:
365
366 @quotation
367 The legal meaning of the GNU copyleft is less important than the spirit,
368 which is that Emacs is a free software project and that work pertaining
369 to Emacs should also be free software. "Free" means that all users have
370 the freedom to study, share, change and improve Emacs. To make sure
371 everyone has this freedom, pass along source code when you distribute
372 any version of Emacs or a related program, and give the recipients the
373 same freedom that you enjoyed.
374 @end quotation
375
376 @node Guidelines for newsgroup postings, Newsgroup archives, Real meaning of copyleft, General questions
377 @section What are appropriate messages for @uref{news:gnu.emacs.help}, @uref{news:gnu.emacs.bug}, @uref{news:comp.emacs}, etc.?
378 @cindex Newsgroups, appropriate messages for
379 @cindex GNU newsgroups, appropriate messages for
380 @cindex Usenet groups, appropriate messages for
381 @cindex Mailing lists, appropriate messages for
382
383 The file @file{etc/MAILINGLISTS} discusses the purpose of each GNU
384 mailing-list. (@pxref{Informational files for Emacs} if you want a copy
385 of the file.) For those lists which are gatewayed with newsgroups, it
386 lists both the newsgroup name and the mailing list address.
387
388 @uref{news:comp.emacs} is for discussion of Emacs programs in general.
389 This includes Emacs along with various other implementations, such as
390 JOVE, MicroEmacs, Freemacs, MG, Unipress, CCA, and Epsilon.
391
392 Many people post Emacs questions to @uref{news:comp.emacs} because they
393 don't receive any of the gnu.* newsgroups. Arguments have been made
394 both for and against posting GNU-Emacs-specific material to
395 @uref{news:comp.emacs}. You have to decide for yourself.
396
397 Messages advocating "non-free" software are considered unacceptable on
398 any of the gnu.* newsgroups except for @uref{news:gnu.misc.discuss},
399 which was created to hold the extensive flame-wars on the subject.
400 "Non-free" software includes any software for which the end user can't
401 freely modify the source code and exchange enhancements. Be careful to
402 remove the gnu.* groups from the "Newsgroups:" line when posting a
403 followup that recommends such software.
404
405 @uref{news:gnu.emacs.bug} is a place where bug reports appear, but avoid
406 posting bug reports to this newsgroup (@pxref{Reporting bugs}).
407
408 @node Newsgroup archives, Reporting bugs, Guidelines for newsgroup postings, General questions
409 @section Where can I get old postings to @uref{news:gnu.emacs.help} and other GNU groups?
410 @cindex Archived postings from @uref{news:gnu.emacs.help}
411 @cindex Usenet archives for GNU groups
412 @cindex Old Usenet postings for GNU groups
413
414 The FSF has maintained archives of all of the GNU mailing lists for many
415 years, although there may be some unintentional gaps in coverage. The
416 archive is not particularly well organized or easy to retrieve
417 individual postings from, but pretty much everything is there.
418
419 The archive is at @uref{ftp://ftp-mailing-list-archives.gnu.org}.
420
421 As of this writing, the archives are not yet working.
422
423 Web-based Usenet search services, such as
424 @uref{http://www.dejanews.com, DejaNews}, also archive the
425 gnu.* groups.
426
427 @node Reporting bugs, Unsubscribing from Emacs lists, Newsgroup archives, General questions
428 @section Where should I report bugs and other problems with Emacs?
429 @cindex Bug reporting
430 @cindex Good bug reports
431 @cindex How to submit a bug report
432 @cindex Reporting bugs
433
434 The correct way to report Emacs bugs is by e-mail to
435 @email{bug-gnu-emacs@@gnu.org}. Anything sent here also appears in the
436 newsgroup @uref{news:gnu.emacs.bug}, but please use e-mail instead of
437 news to submit the bug report. This ensures a reliable return address
438 so you can be contacted for further details.
439
440 Be sure to read the "Bugs" section of the Emacs manual before reporting
441 a bug to bug-gnu-emacs! The manual describes in detail how to submit a
442 useful bug report. (@pxref{On-line manual} if you don't know how to read the
443 manual.)
444
445 RMS says:
446
447 @quotation
448 Sending bug reports to @email{help-gnu-emacs@@gnu.org} (which has the
449 effect of posting on @uref{news:gnu.emacs.help}) is undesirable because
450 it takes the time of an unnecessarily large group of people, most of
451 whom are just users and have no idea how to fix these problem.
452 @email{bug-gnu-emacs@@gnu.org} reaches a much smaller group of people
453 who are more likely to know what to do and have expressed a wish to
454 receive more messages about Emacs than the others.
455 @end quotation
456
457 RMS says it is sometimes fine to post to @uref{news:gnu.emacs.help}:
458
459 @quotation
460 If you have reported a bug and you don't hear about a possible fix,
461 then after a suitable delay (such as a week) it is okay to post on
462 gnu.emacs.help asking if anyone can help you.
463 @end quotation
464
465 If you are unsure whether you have found a bug, consider the following
466 non-exhaustive list, courtesy of RMS:
467
468 @quotation
469 If Emacs crashes, that is a bug. If Emacs gets compilation errors
470 while building, that is a bug. If Emacs crashes while building, that
471 is a bug. If Lisp code does not do what the documentation says it
472 does, that is a bug.
473 @end quotation
474
475 @node Unsubscribing from Emacs lists, Contacting the FSF, Reporting bugs, General questions
476 @section How do I unsubscribe from this mailing list?
477 @cindex Unsubscribing from GNU mailing lists
478 @cindex Removing yourself from GNU mailing lists
479
480 If you are receiving a GNU mailing list named "XXX", you might be able
481 to unsubscribe from it by sending a request to the address
482 @email{XXX-request@@gnu.org}. However, this will not work if you are
483 not listed on the main mailing list, but instead receive the mail from a
484 distribution point. In that case, you will have to track down at which
485 distribution point you are listed. Inspecting the @samp{Received} headers
486 on the mail messages may help, along with liberal use of the "EXPN" or
487 "VRFY" sendmail commands through "telnet <site-address> smtp". Ask your
488 postmaster for help.
489
490 @node Contacting the FSF, , Unsubscribing from Emacs lists, General questions
491 @section What is the current address of the FSF?
492 @cindex Snail mail address of the FSF
493 @cindex Postal address of the FSF
494 @cindex Contracting the FSF
495 @cindex Free Software Foundation, contacting
496
497 @table @asis
498
499 @item E-mail
500 gnu@@gnu.org
501
502 @item Telephone
503 +1-617-542-5942
504
505 @item Fax
506 +1-617-542-2652
507
508 @item World Wide Web
509 @uref{http://www.gnu.org/}
510
511 @item Postal address
512 Free Software Foundation@*
513 59 Temple Place - Suite 330@*
514 Boston, MA 02111-1307@*
515 USA@*
516
517 @end table
518
519 For details on how to order items directly from the FSF, see the file
520 @file{etc/ORDERS}.
521
522 @c ------------------------------------------------------------
523 @node Getting help, Status of Emacs, General questions, Top
524 @chapter Getting help
525 @cindex Getting help
526
527 This section tells you how to get help with Emacs
528
529 @menu
530 * Basic editing::
531 * Learning how to do something::
532 * Getting a printed manual::
533 * Emacs Lisp documentation::
534 * Installing Texinfo documentation::
535 * Printing a Texinfo file::
536 * Viewing Info files outside of Emacs::
537 * Informational files for Emacs::
538 * Help installing Emacs::
539 * Obtaining the FAQ::
540 @end menu
541
542 @node Basic editing, Learning how to do something, Getting help, Getting help
543 @section I'm just starting Emacs; how do I do basic editing?
544 @cindex Basic editing with Emacs
545 @cindex Beginning editing
546 @cindex Tutorial, invoking the
547 @cindex Self-paced tutorial, invoking the
548 @cindex Help system, entering the
549
550 Type @kbd{C-h t} to invoke the self-paced tutorial. Just typing @kbd{C-h}
551 enters the help system.
552
553 Your system administrator may have changed @kbd{C-h} to act like
554 @key{DEL} to deal with local keyboards. You can use @kbd{M-x
555 help-for-help} instead to invoke help. To discover what key (if any)
556 invokes help on your system, type @kbd{M-x where-is @key{RET}
557 help-for-help @key{RET}}. This will print a comma-separated list of key
558 sequences in the echo area. Ignore the last character in each key
559 sequence listed. Each of the resulting key sequences invokes help.
560
561 Emacs help works best if it is invoked by a single key whose value
562 should be stored in the variable @code{help-char}.
563
564 There is also a WWW-based tutorial for Emacs 18, much of which is also
565 relevant for Emacs 20, available at
566
567 @uref{http://kufacts.cc.ukans.edu/cwis/writeups/misc/emacsguide.html}
568
569 @node Learning how to do something, Getting a printed manual, Basic editing, Getting help
570 @section How do I find out how to do something in Emacs?
571 @cindex Help for Emacs
572 @cindex Learning to do something in Emacs
573 @cindex Reference card for Emacs
574 @cindex Overview of help systems
575
576 There are several methods for finding out how to do things in Emacs.
577
578 @itemize @bullet
579
580 @item
581 The complete text of the Emacs manual is available on-line via the Info
582 hypertext reader. Type @kbd{C-h i} to invoke Info. Typing @key{h}
583 immediately after entering Info will provide a short tutorial on how to
584 use it.
585
586 @item
587 You can order a hardcopy of the manual from the FSF. @xref{Getting a
588 printed manual}.
589
590 @item
591 You can get a printed reference card listing commands and keys to
592 invoke them. You can order one from the FSF for $1 (or 10 for $5),
593 or you can print your own from the @file{etc/refcard.tex} or
594 @file{etc/refcard.ps} files in the Emacs distribution.
595
596 @item
597 You can list all of the commands whose names contain a certain word
598 (actually which match a regular expression) using @kbd{C-h a} (@kbd{M-x
599 command-apropos}).
600
601 @item
602 You can list all of the functions and variables whose names contain a
603 certain word using @kbd{M-x apropos}.
604
605 @item
606 There are many other commands in Emacs for getting help and
607 information. To get a list of these commands, type @samp{?} after
608 @kbd{C-h}.
609
610 @end itemize
611
612 @node Getting a printed manual, Emacs Lisp documentation, Learning how to do something, Getting help
613 @section How do I get a printed copy of the Emacs manual?
614 @cindex Printed Emacs manual, obtaining
615 @cindex Manual, obtaining a printed copy of
616 @cindex Emacs manual, obtaining a printed copy of
617
618 You can order a printed copy of the Emacs manual from the FSF. For
619 details see the file @file{etc/ORDERS}.
620
621 The full @TeX{} source for the manual also comes in the @file{man}
622 directory of the Emacs distribution, if you're daring enough to try to
623 print out this 440-page manual yourself (@pxref{Printing a Texinfo
624 file}).
625
626 If you absolutely have to print your own copy, and you don't have @TeX{},
627 you can get a PostScript version from
628
629 @uref{http://www.gnu.org/manual/emacs/ps/emacs.ps.gz}
630
631 A WWW version of the manual is at
632
633 @uref{www.gnu.org/manual/emacs/index.html}
634
635 @xref{Learning how to do something}, for how to view the manual on-line.
636
637 @node Emacs Lisp documentation, Installing Texinfo documentation, Getting a printed manual, Getting help
638 @section Where can I get documentation on Emacs Lisp?
639 @cindex Documentation on Emacs Lisp
640 @cindex Function documentation
641 @cindex Variable documentation
642 @cindex Emacs Lisp Reference Manual
643 @cindex Reference manual for Emacs Lisp
644
645 Within Emacs, you can type @kbd{C-h f} to get the documentation for a
646 function, @kbd{C-h v} for a variable.
647
648 For more information, obtain the Emacs Lisp Reference Manual. Details on
649 ordering it from FSF are in file @file{etc/ORDERS}.
650
651 The Emacs Lisp Reference Manual is also available on-line, in Info
652 format. Texinfo source for the manual (along with pregenerated Info
653 files) is available at
654
655 @uref{ftp://ftp.gnu.org/pub/gnu/emacs/elisp-manual-20-2.5.tar.gz}
656
657 and all mirrors of @samp{ftp.gnu.org} (@pxref{Current GNU distributions} for a
658 list). @xref{Installing Texinfo documentation}, if you want to install
659 the Info files, or @ref{Printing a Texinfo file} if you want to use the
660 Texinfo source to print the manual yourself.
661
662 A WWW version of the Emacs Lisp Reference Manual is available at
663
664 @uref{http://www.gnu.org/manual/elisp-manual-20-2.5/elisp.html}
665
666 @node Installing Texinfo documentation, Printing a Texinfo file, Emacs Lisp documentation, Getting help
667 @section How do I install a piece of Texinfo documentation?
668 @cindex Texinfo documentation, installing
669 @cindex Installing Texinfo documentation
670 @cindex New Texinfo files, installing
671 @cindex Documentation, installing new Texinfo files
672
673 First, you must turn the Texinfo files into Info files. You may do this
674 using the stand-alone @file{makeinfo} program, available as part of the latest
675 Texinfo package at
676
677 @uref{ftp://ftp.gnu.org/pub/gnu/texinfo/texinfo-3.12.tar.gz}
678
679 and all mirrors of @samp{ftp.gnu.org} (@pxref{Current GNU distributions} for a list).
680
681 For information about the Texinfo format, read the Texinfo manual which
682 comes with Emacs. This manual also comes installed in Info format, so
683 you can read it on-line.
684
685 Neither @code{texinfo-format-buffer} nor @file{makeinfo} installs the
686 resulting Info files in Emacs's Info tree. To install Info files:
687
688 @enumerate
689
690 @item Move the files to the @file{info} directory in the installed Emacs
691 distribution. @xref{Filename conventions}, if you don't know where that is.
692
693 @item Edit the file @file{info/dir} in the installed Emacs distribution,
694 and add a line for the top level node in the Info package that you are
695 installing. Follow the examples already in this file. The format is:
696
697 @example
698 * Topic: (relative-pathname). Short description of topic.
699 @end example
700
701 @end enumerate
702
703 If you want to install Info files and you don't have the necessary
704 privileges, you have several options:
705
706 @itemize @bullet
707
708 @item
709 Info files don't actually need to be installed before being used. You
710 can feed a file name to the @code{Info-goto-node} command (invoked by
711 pressing @key{g} in Info mode) by typing the name of the file in
712 parentheses. This goes to the node named "Top" in that file. For
713 example, to view a Info file named "XXX" in your home directory, you can
714 type this:
715
716 @lisp
717 C-h i g (~/XXX) @key{RET}
718 @end lisp
719
720 @item
721 You can create your own Info directory. You can tell Emacs where the
722 Info directory is by adding its pathname to the value of the variable
723 @code{Info-default-directory-list}. For example, to use a private Info
724 directory which is a subdirectory of your home directory named "Info",
725 you could put this in your @file{.emacs} file:
726
727 @lisp
728 (setq Info-default-directory-list
729 (cons "~/Info" Info-default-directory-list))
730 @end lisp
731
732 You will need a top-level Info file named @file{dir} in this directory
733 which has everything the system dir file has in it, except it should
734 list only entries for Info files in that directory. You might not need
735 it if all files in this directory were referenced by other @file{dir}
736 files. The node lists from all @file{dir} files in
737 @code{Info-default-directory-list} are merged by the Info system.
738
739 @end itemize
740
741 @node Printing a Texinfo file, Viewing Info files outside of Emacs, Installing Texinfo documentation, Getting help
742 @section How do I print a Texinfo file?
743 @cindex Printing a Texinfo file
744 @cindex Texinfo file, printing
745
746 You can't get nicely printed output from Info files; you must still have
747 the original Texinfo source file for the manual you want to print.
748
749 Assuming you have @TeX{} installed on your system, follow these steps:
750
751 @enumerate
752
753 @item Make sure the first line of the Texinfo file looks like this:
754
755 @example
756 \input texinfo
757 @end example
758
759 You may need to change @samp{texinfo} to the full pathname of the
760 texinfo.tex file, which comes with Emacs as @samp{man/texinfo.tex} (or
761 copy or link it into the current directory).
762
763 @item @code{tex XXX.texinfo}
764
765 @item @code{texindex XXX.??}
766
767 The @samp{texindex} program comes with Emacs as @file{man/texindex.c}.
768
769 @item @code{tex XXX.texinfo}
770
771 @item Print the DVI file @file{XXX.dvi} in the normal way for printing DVI files at your site.
772
773 @end enumerate
774
775 To get more general instructions, retrieve the latest Texinfo package
776 (@pxref{Installing Texinfo documentation}).
777
778 @node Viewing Info files outside of Emacs, Informational files for Emacs, Printing a Texinfo file, Getting help
779 @section Can I view Info files without using Emacs?
780 @cindex Viewing Info files
781 @cindex Info file viewers
782 @cindex Alternative Info file viewers
783
784 Yes. Here are some alternative programs:
785
786 @itemize @bullet
787
788 @item Info, a stand-alone version of the Info program, comes as part of the
789 Texinfo package. @xref{Installing Texinfo documentation}, for details.
790
791 @item Xinfo, a stand-alone version of the Info program that runs under X
792 Windows. You can get it at
793 @uref{ftp://ftp.gnu.org/pub/gnu/xinfo/xinfo-1.01.01.tar.gz} and all
794 mirrors of @samp{ftp.gnu.org} (@pxref{Current GNU distributions} for a list).
795
796 @item Tkinfo, an Info viewer that runs under X Windows and uses Tcl/Tk. You
797 can get Tkinfo at @uref{http://math-www.uni-paderborn.de/~axel/tkinfo/}.
798
799 @end itemize
800
801 @node Informational files for Emacs, Help installing Emacs, Viewing Info files outside of Emacs, Getting help
802 @section What informational files are available for Emacs?
803 @cindex Informational files included with Emacs
804 @cindex Files included with Emacs
805 @cindex @file{COPYING}, description of file
806 @cindex @file{DISTRIB}, description of file
807 @cindex @file{FAQ}, description of file
808 @cindex @file{FTP}, description of file
809 @cindex @file{GNU}, description of file
810 @cindex @file{INTERVIEW}, description of file
811 @cindex @file{LPF}, description of file
812 @cindex @file{MACHINES}, description of file
813 @cindex @file{MAILINGLISTS}, description of file
814 @cindex @file{NEWS}, description of file
815 @cindex @file{SERVICE}, description of file
816 @cindex @file{SUN-SUPPORT}, description of file
817
818 This isn't a frequently asked question, but it should be! A variety of
819 informational files about Emacs and relevant aspects of the GNU project
820 are available for you to read.
821
822 The following files are available in the @file{etc} directory of the
823 Emacs distribution (@pxref{Filename conventions} if you're not sure where that is).
824
825 @table @file
826
827 @item COPYING
828 Emacs General Public License
829
830 @item DISTRIB
831 Emacs Availability Information, including the popular "Free Software
832 Foundation Order Form"
833
834 @item FAQ
835 Emacs Frequently Asked Questions (You're reading it)
836
837 @item FTP
838 How to get GNU Software by Internet FTP or by UUCP
839
840 @item GNU
841 The GNU Manifesto
842
843 @item INTERVIEW
844 Richard Stallman discusses his public-domain UNIX-compatible software
845 system with BYTE editors
846
847 @item LPF
848 Why you should join the League for Programming Freedom
849
850 @item MACHINES
851 Status of Emacs on Various Machines and Systems
852
853 @item MAILINGLISTS
854 GNU Project Electronic Mailing Lists
855
856 @item NEWS
857 Emacs news, a history of user-visible changes
858
859 @item SERVICE
860 GNU Service Directory
861
862 @item SUN-SUPPORT
863 including "Using Emacstool with GNU Emacs"
864
865 @end table
866
867 Latest versions of the above files also available at
868
869 @uref{ftp://ftp.gnu.org/pub/gnu/GNUinfo/}
870
871 More GNU information, including back issues of the "GNU's Bulletin", are
872 at
873
874 @uref{http://www.gnu.org/bulletins/bulletins.html} and
875
876 @uref{http://www.cs.pdx.edu/~trent/gnu/gnu.html}
877
878 @node Help installing Emacs, Obtaining the FAQ, Informational files for Emacs, Getting help
879 @section Where can I get help in installing Emacs?
880 @cindex Installation help
881 @cindex Help installing Emacs
882
883 @xref{Installing Emacs}, for some basic installation hints, and question
884 83 if you have problems with the installation.
885
886 The file @file{etc/SERVICE} (@pxref{Filename conventions} if you're not
887 sure where that is) lists companies and individuals willing to sell you
888 help in installing or using Emacs. An up-to-date version this file is
889 available on @samp{ftp.gnu.org} (@pxref{Informational files for Emacs}).
890
891 @node Obtaining the FAQ, , Help installing Emacs, Getting help
892 @section Where can I get the latest version of this FAQ?
893 @cindex FAQ, obtaining the
894 @cindex Latest FAQ version, obtaining the
895 @cindex Retrieving the latest FAQ version
896 @cindex E-mail, retrieving the FAQ via
897 @cindex Web, reading the FAQ on the
898
899 The Emacs FAQ is available in several ways:
900
901 @itemize @bullet
902
903 @item
904 Inside of Emacs itself. You can get it from selecting the "Emacs FAQ"
905 option from the "Help" menu at the top of any Emacs frame, or by typing
906 @kbd{C-h F} (@kbd{M-x view-emacs-FAQ}).
907
908 @item
909 Via USENET. If you can read news, the FAQ should be available in your
910 news spool, in both the @uref{news:gnu.emacs.help} and
911 @uref{news:comp.emacs} newsgroups. Every news reader should allow you
912 to read any news article that is still in the news spool, even if you
913 have read the article before. You may need to read the instructions for
914 your news reader to discover how to do this. In @file{rn}, this command
915 will do this for you at the article selection level:
916
917 @example
918 ?GNU Emacs Frequently Asked Questions?rc:m
919 @end example
920
921 In Gnus, you should type @kbd{C-u C-x C-s} from the @file{*Summary*}
922 buffer or @kbd{C-u @key{SPC}} from the @file{*Newsgroup*} buffer to view
923 all articles in a newsgroup.
924
925 If the FAQ articles have expired and been deleted from your news spool,
926 it might (or might not) do some good to complain to your news
927 administrator, because the most recent FAQ should not expire for a
928 while.
929
930 @item Via HTTP or FTP. You can always fetch the latest FAQ from
931
932 @uref{http://www.lerner.co.il/emacs/} and
933
934 @uref{ftp://ftp.lerner.co.il/pub/emacs/}
935
936 @item
937 In the Emacs distribution. Since Emacs 18.56, the FAQ at the time
938 of release has been part of the Emacs distribution as @file{etc/FAQ}
939 (@pxref{Filename conventions}).
940
941 @item
942 Via the World Wide Web. A hypertext version is available at
943
944 @uref{http://www.lerner.co.il/emacs/}
945
946 @item
947 Via anonymous ftp and e-mail from @file{rtfm.mit.edu} (and its mirror in
948 Europe), the main repository for FAQs and other items posted to
949 news.answers. The Emacs FAQs are available at
950
951 @uref{ftp://rtfm.mit.edu/pub/usenet/comp.emacs/} and
952
953 @uref{ftp://ftp.uni-paderborn.de/pub/doc/FAQ/comp/emacs/}
954
955 If you do not have access to anonymous FTP, you can access the archives
956 using the @file{rtfm.mit.edu} mail server. The Emacs FAQ can be
957 retrieved by sending mail to @email{mail-server@@rtfm.mit.edu} with a
958 blank subject and containing
959
960 @example
961 send usenet/news.answers/GNU-Emacs-FAQ/diffs
962 send usenet/news.answers/GNU-Emacs-FAQ/part1
963 send usenet/news.answers/GNU-Emacs-FAQ/part2
964 send usenet/news.answers/GNU-Emacs-FAQ/part3
965 send usenet/news.answers/GNU-Emacs-FAQ/part4
966 send usenet/news.answers/GNU-Emacs-FAQ/part5
967 @end example
968
969 For more information, send email to @email{mail-server@@rtfm.mit.edu}
970 with "help" and "index" in the body on separate lines.
971
972 @item
973 As the very last resort, you can e-mail a request to
974 @email{emacs-faq@@lerner.co.il}. Don't do this unless you have made a
975 serious effort to obtain the FAQ list via one of the methods listed
976 above.
977
978 @end itemize
979
980 @c ------------------------------------------------------------
981 @node Status of Emacs, Common requests, Getting help, Top
982 @chapter Status of Emacs
983 @cindex Status of Emacs
984
985 This section gives you basic information about Emacs, including its
986 latest version status.
987
988 @menu
989 * Origin of the term Emacs::
990 * Latest version of Emacs::
991 * New in Emacs 20::
992 @end menu
993
994 @node Origin of the term Emacs, Latest version of Emacs, Status of Emacs, Status of Emacs
995 @section Where does the name "Emacs" come from?
996 @cindex Origin of the term "Emacs"
997 @cindex Emacs name origin
998 @cindex TECO
999 @cindex Original version of Emacs
1000
1001 Emacs originally was an acronym for Editor MACroS. RMS says he "picked
1002 the name Emacs because @key{E} was not in use as an abbreviation on ITS at
1003 the time." The first Emacs was a set of macros written in 1976 at MIT
1004 by RMS for the editor TECO (Text Editor and COrrector, originally Tape
1005 Editor and COrrector) under ITS on a PDP-10. RMS had already extended
1006 TECO with a "real-time" full screen mode with reprogrammable keys.
1007 Emacs was started by @email{gls@@east.sun.com, Guy Steele} as a project
1008 to unify the many divergent TECO command sets and key bindings at MIT,
1009 and completed by RMS.
1010
1011 Many people have said that TECO code looks a lot like line noise; you
1012 can read more at @uref{news:alt.lang.teco}. Someone has written a TECO
1013 implementation in Emacs Lisp (to find it, @ref{Packages that do not come
1014 with Emacs}); it would be an interesting project to run the original
1015 TECO Emacs inside of Emacs.
1016
1017 For some not-so-serious alternative reasons for Emacs to have that
1018 name, check out @file{etc/JOKES} (@pxref{Filename conventions}).
1019
1020 @node Latest version of Emacs, New in Emacs 20, Origin of the term Emacs, Status of Emacs
1021 @section What is the latest version of Emacs?
1022 @cindex Version, latest
1023 @cindex Latest version
1024
1025 Emacs 20.5 is the current version as of this writing.
1026
1027 @node New in Emacs 20, , Latest version of Emacs, Status of Emacs
1028 @section What is different about Emacs 20?
1029 @cindex Differences between Emacs 19 and Emacs 20
1030 @cindex Emacs 20, new features in
1031 @cindex Recently introduced features
1032
1033 To find out what has changed in recent versions, type @kbd{C-h n}
1034 (@kbd{M-x view-emacs-news}). The oldest changes are at the bottom of
1035 the file, so you might want to read it starting there, rather than at
1036 the top.
1037
1038 The differences between Emacs versions 18 and 19 was rather dramatic;
1039 the introduction of frames, faces, and colors on windowing systems was
1040 obvious to even the most casual user.
1041
1042 There are differences between Emacs versions 19 and 20 as well, but many
1043 are more subtle or harder to find. Among the changes are the inclusion
1044 of MULE code for languages that use non-Latin characters, the "customize"
1045 facility for modifying variables without having to use Lisp, and
1046 automatic conversion of files from Macintosh, Microsoft, and Unix
1047 platforms.
1048
1049 A number of older Lisp packages, such as Gnus, Supercite and the
1050 calendar/diary, have been updated and enhanced to work with Emacs 20,
1051 and are now included with the standard distribution.
1052
1053
1054 @c ------------------------------------------------------------
1055 @node Common requests, Bugs and problems, Status of Emacs, Top
1056 @chapter Common requests
1057 @cindex Common requests
1058
1059 @menu
1060 * Setting up a customization file::
1061 * Debugging a customization file::
1062 * Displaying the current line or column::
1063 * Displaying the current filename in the titlebar::
1064 * Turning on abbrevs by default::
1065 * Turning on auto-fill by default::
1066 * Associating modes with files::
1067 * Working with unprintable characters::
1068 * Highlighting a region::
1069 * Controlling case sensitivity::
1070 * Wrapping words automatically::
1071 * Spell-checkers::
1072 * Checking TeX and *roff documents::
1073 * Changing load-path::
1074 * Using an already running Emacs process::
1075 * Compiler error messages::
1076 * Indenting switch statements::
1077 * Horizontal scrolling::
1078 * Overwrite mode::
1079 * Turning off beeping::
1080 * Turning the volume down::
1081 * Automatic indentation::
1082 * Matching parentheses::
1083 * Hiding #ifdef lines::
1084 * Repeating commands::
1085 * Valid X resources::
1086 * Evaluating Emacs Lisp code::
1087 * Changing the length of a Tab::
1088 * Inserting > at the beginning of each line::
1089 * Underlining paragraphs::
1090 * Repeating a command as many times as possible::
1091 * Forcing the cursor to remain in the same column::
1092 * Forcing Emacs to iconify itself::
1093 * Using regular expressions::
1094 * Replacing text across multiple files::
1095 * Documentation for etags::
1096 * Disabling backups::
1097 * Disabling auto-save-mode::
1098 * Modifying pull-down menus::
1099 * Deleting menus and menu options::
1100 * Turning on syntax highlighting::
1101 * Scrolling only one line::
1102 * Replacing highlighted text::
1103 * Editing MS-DOS files::
1104 * Filling paragraphs with a single space::
1105 @end menu
1106
1107 @node Setting up a customization file, Debugging a customization file, Common requests, Common requests
1108 @section How do I set up a @file{.emacs} file properly?
1109 @cindex @file{.emacs} file, setting up
1110 @cindex Init file, setting up
1111 @cindex Customization file, setting up
1112
1113 @inforef{Init File, Init File, emacs}
1114
1115 In general, new Emacs users should not have @file{.emacs} files, because
1116 it causes confusing non-standard behavior. Then they send questions to
1117 @email{help-gnu-emacs@@gnu.org} asking why Emacs isn't behaving as
1118 documented.
1119
1120 Emacs 20 includes the new @code{customize} facility, which can be
1121 invoked using @kbd{M-x customize @key{RET}}. This allows users who are
1122 unfamiliar with Emacs Lisp to modify their @file{.emacs} files in a
1123 relatively straightforward way, using menus rather than Lisp code. Not
1124 all packages support Customize as of this writing, but the number is
1125 growing fairly steadily.
1126
1127 While @code{customize} might indeed make it easier to configure Emacs,
1128 consider taking a bit of time to learn Emacs Lisp and modifying your
1129 @file{.emacs} directly. Simple configuration options are described
1130 rather completely in @inforef{Init File, Init File, emacs}, for users
1131 interested in performing frequently requested, basic tasks.
1132
1133 @node Debugging a customization file, Displaying the current line or column, Setting up a customization file, Common requests
1134 @section How do I debug a @file{.emacs} file?
1135 @cindex Debugging @file{.emacs} file
1136 @cindex @file{.emacs} debugging
1137 @cindex Init file debugging
1138 @cindex @samp{-debug-init}
1139
1140 Start Emacs with the @samp{-debug-init} command-line option. This
1141 enables the Emacs Lisp debugger before evaluating your @file{.emacs}
1142 file, and places you in the debugger if something goes wrong. The top
1143 line in the @file{trace-back} buffer will be the error message, and the
1144 second or third line of that buffer will display the Lisp code from your
1145 @file{.emacs} file that caused the problem.
1146
1147 You can also evaluate an individual function or argument to a function
1148 in your @file{.emacs} file by moving the cursor to the end of the
1149 function or argument and typing @kbd{C-x C-e} (@kbd{M-x
1150 eval-last-sexp}).
1151
1152 Use @kbd{C-h v} (@kbd{M-x describe-variable}) to check the value of
1153 variables which you are trying to set or use.
1154
1155 @node Displaying the current line or column, Displaying the current filename in the titlebar, Debugging a customization file, Common requests
1156 @section How do I make Emacs display the current line (or column) number?
1157 @cindex @code{line-number-mode}
1158 @cindex Displaying the current line or column
1159 @cindex Line number, displaying the current
1160 @cindex Column, displaying the current
1161 @cindex @code{mode-line-format}
1162
1163 To have Emacs automatically display the current line number of the point
1164 in the mode line, do @kbd{M-x line-number-mode}. You can also put the
1165 form
1166
1167 @lisp
1168 (setq line-number-mode t)
1169 @end lisp
1170
1171 in your @file{.emacs} file to achieve this whenever you start Emacs.
1172 Note that Emacs will not display the line number if the buffer is larger
1173 than the value of the variable @code{line-number-display-limit}.
1174
1175 As of Emacs 20, you can similarly display the current column with
1176 @kbd{M-x column-number-mode}, or by putting the form
1177
1178 @lisp
1179 (setq column-number-mode t)
1180 @end lisp
1181
1182 in your @file{.emacs} file.
1183
1184 The "%c" format specifier in the variable @code{mode-line-format} will
1185 insert the current column's value into the mode line. See the
1186 documentation for @code{mode-line-format} (using @kbd{C-h v
1187 mode-line-format @key{RET}}) for more information on how to set and use
1188 this variable.
1189
1190 Users of all Emacs versions can display the current column using
1191 @email{abraham@@iesd.auc.dk, Per Abrahamsen's} "column" package.
1192 @xref{Packages that do not come with Emacs}, for instructions on how to
1193 get it.
1194
1195 None of the vi emulation modes provide the "set number" capability of vi
1196 (as far as we know).
1197
1198 @node Displaying the current filename in the titlebar, Turning on abbrevs by default, Displaying the current line or column, Common requests
1199 @section How can I modify the titlebar to contain the current filename?
1200 @cindex Titlebar, displaying the current filename in
1201 @cindex Filename, displaying in the titlebar
1202 @cindex @code{frame-title-format}
1203
1204 The contains of an Emacs frame's titlebar is controlled by the variable
1205 @code{frame-title-format}, which has the same structure as the variable
1206 @code{mode-line-format}. (Use @kbd{C-h v} or @kbd{M-x
1207 describe-variable} to get information about one or both of these
1208 variables.)
1209
1210 By default, the titlebar for a frame does contain the name of the buffer
1211 currently being visited, except if there is a single frame. In such a
1212 case, the titlebar contains the name of the user and the machine at
1213 which Emacs was invoked. This is done by setting
1214 @code{frame-title-format} to the default value of
1215
1216 @lisp
1217 (multiple-frames "%b" ("" invocation-name "@@" system-name))
1218 @end lisp
1219
1220 To modify the behavior such that frame titlebars contain the buffer's
1221 name regardless of the number of existing frames, include the following
1222 in your @file{.emacs}:
1223
1224 @lisp
1225 (setq frame-title-format "%b")
1226 @end lisp
1227
1228 @node Turning on abbrevs by default, Turning on auto-fill by default, Displaying the current filename in the titlebar, Common requests
1229 @section How do I turn on abbrevs by default just in mode XXX?
1230 @cindex Abbrevs, turning on by default
1231
1232 Put this in your @file{.emacs} file:
1233
1234 @lisp
1235 (condition-case ()
1236 (quietly-read-abbrev-file)
1237 (file-error nil))
1238
1239 (add-hook 'XXX-mode-hook
1240 (function
1241 (lambda ()
1242 (setq abbrev-mode t))))
1243 @end lisp
1244
1245 @node Turning on auto-fill by default, Associating modes with files, Turning on abbrevs by default, Common requests
1246 @section How do I turn on @code{auto-fill-mode} by default?
1247 @cindex @code{auto-fill-mode}, activating automatically
1248 @cindex Filling automatically
1249 @cindex Automatic entry to @code{auto-fill-mode}
1250
1251 To turn on @code{auto-fill-mode} just once for one buffer, use @kbd{M-x
1252 auto-fill-mode}.
1253
1254 To turn it on for every buffer in a certain mode, you must use the hook
1255 for that mode. For example, to turn on @code{auto-fill} mode for all
1256 text buffers, including the following in your @file{.emacs} file:
1257
1258 @lisp
1259 (add-hook 'text-mode-hook 'turn-on-auto-fill)
1260 @end lisp
1261
1262 If you want @code{auto-fill} mode on in all major modes, do this:
1263
1264 @lisp
1265 (setq-default auto-fill-function 'do-auto-fill)
1266 @end lisp
1267
1268 @node Associating modes with files, Working with unprintable characters, Turning on auto-fill by default, Common requests
1269 @section How do I make Emacs use a certain major mode for certain files?
1270 @cindex Associating modes with files
1271 @cindex File extensions and modes
1272 @cindex @code{auto-mode-alist}, modifying
1273 @cindex Modes, associating with file extensions
1274
1275 If you want to use XXX mode for all files which end with the extension
1276 @samp{.YYY}, this will do it for you:
1277
1278 @lisp
1279 (setq auto-mode-alist (cons '("\\.YYY\\'" . XXX-mode) auto-mode-alist))
1280 @end lisp
1281
1282 Otherwise put this somewhere in the first line of any file you want to
1283 edit in XXX mode (in the second line, if the first line begins with
1284 @samp{#!}):
1285
1286 @example
1287 -*-XXX-*-
1288 @end example
1289
1290 Beginning with Emacs 19, the variable @code{interpreter-mode-alist}
1291 specifies which mode to use when loading a shell script. (Emacs
1292 determines which interpreter you're using by examining the first line of
1293 the file.) This feature only applies when the file name doesn't
1294 indicate which mode to use. Use @kbd{C-h v} (or @kbd{M-x
1295 describe-variable}) on @code{interpreter-mode-alist} to learn more.
1296
1297 @node Working with unprintable characters, Highlighting a region, Associating modes with files, Common requests
1298 @section How do I search for, delete, or replace unprintable (eight-bit or control) characters?
1299 @cindex Unprintable characters, working with
1300 @cindex Working with unprintable characters
1301 @cindex Control characters, working with
1302 @cindex Eight-bit characters, working with
1303 @cindex Searching for unprintable characters
1304 @cindex Regexps and unprintable characters
1305
1306 To search for a single character that appears in the buffer as, for
1307 example, @samp{\237}, you can type @kbd{C-s C-q 2 3 7}. (This assumes
1308 the value of @code{search-quote-char} is 17 (i.e., @kbd{C-q}).)
1309 Searching for ALL unprintable characters is best done with a regular
1310 expression ("regexp") search. The easiest regexp to use for the
1311 unprintable chars is the complement of the regexp for the printable
1312 chars.
1313
1314 @itemize @bullet
1315
1316 @item
1317 Regexp for the printable chars: @samp{[\t\n\r\f -~]}
1318
1319 @item
1320 Regexp for the unprintable chars: @samp{[^\t\n\r\f -~]}
1321
1322 @end itemize
1323
1324 To type these special characters in an interactive argument to
1325 @code{isearch-forward-regexp} or @code{re-search-forward}, you need to
1326 use @kbd{C-q}. (@samp{\t}, @samp{\n}, @samp{\r}, and @samp{\f} stand
1327 respectively for @key{TAB}, @key{LFD}, @key{RET}, and @kbd{C-l}.) So,
1328 to search for unprintable characters using @code{re-search-forward}:
1329
1330 @kbd{M-x re-search-forward @key{RET} [^ @key{TAB} C-q @key{LFD} C-q @key{RET} C-q C-l @key{SPC} -~] @key{RET}}
1331
1332 Using @code{isearch-forward-regexp}:
1333
1334 @kbd{M-C-s [^ @key{TAB} @key{RET} C-q @key{RET} C-q C-l @key{SPC} -~]}
1335
1336 To delete all unprintable characters, simply use replace-regexp:
1337
1338 @kbd{M-x replace-regexp @key{RET} [^ @key{TAB} C-q @key{LFD} C-q @key{RET} C-q C-l @key{SPC} -~] @key{RET} @key{RET}}
1339
1340 Replacing is similar to the above. To replace all unprintable
1341 characters with a colon, use:
1342
1343 M-x replace-regexp @key{RET} [^ @key{TAB} C-q @key{LFD} C-q @key{RET} C-q C-l @key{SPC} -~] @key{RET} : @key{RET}
1344
1345 @itemize @bullet
1346
1347 @item You don't need to quote @key{TAB} with either isearch or typing
1348 something in the minibuffer.
1349
1350 @end itemize
1351
1352 @node Highlighting a region, Controlling case sensitivity, Working with unprintable characters, Common requests
1353 @section How can I highlight a region of text in Emacs?
1354 @cindex Highlighting text
1355 @cindex Text, highlighting
1356 @cindex @code{transient-mark-mode}
1357 @cindex Region, highlighting a
1358
1359 If you are using a windowing system such as X, you can cause the region
1360 to be highlighted when the mark is active by including
1361
1362 @lisp
1363 (transient-mark-mode t)
1364 @end lisp
1365
1366 in your @file{.emacs} file. (Also see @xref{Turning on syntax highlighting}.)
1367
1368 @node Controlling case sensitivity, Wrapping words automatically, Highlighting a region, Common requests
1369 @section How do I control Emacs's case-sensitivity when searching/replacing?
1370 @cindex @code{case-fold-search}
1371 @cindex Case sensitivity of searches
1372 @cindex @code{case-replace}
1373 @cindex Searching without case sensitivity
1374 @cindex Ignoring case in searches
1375
1376 For searching, the value of the variable @code{case-fold-search}
1377 determines whether they are case sensitive:
1378
1379 @lisp
1380 (setq case-fold-search nil) ; make searches case sensitive
1381 (setq case-fold-search t) ; make searches case insensitive
1382 @end lisp
1383
1384 Similarly, for replacing the variable @code{case-replace} determines
1385 whether replacements preserve case.
1386
1387 To change the case sensitivity just for one major mode, use the major
1388 mode's hook. For example:
1389
1390 @lisp
1391 (add-hook 'XXX-mode-hook
1392 (function
1393 (lambda ()
1394 (setq case-fold-search nil))))
1395 @end lisp
1396
1397 @node Wrapping words automatically, Spell-checkers, Controlling case sensitivity, Common requests
1398 @section How do I make Emacs wrap words for me?
1399 @cindex Wrapping word automatically
1400 @cindex @code{auto-fill-mode}, introduction to
1401 @cindex Maximum line width, default value
1402 @cindex @code{fill-column}, default value
1403
1404 Use @code{auto-fill-mode}, activated by typing @kbd{M-x auto-fill-mode}.
1405 The default maximum line width is 70, determined by the variable
1406 @code{fill-column}. To learn how to turn this on automatically, @pxref{Turning on auto-fill by default}.
1407
1408 @node Spell-checkers, Checking TeX and *roff documents, Wrapping words automatically, Common requests
1409 @section Where can I get a better spelling checker for Emacs?
1410 @cindex Checking spelling
1411 @cindex Spelling, checking text documents
1412
1413 Use Ispell. @xref{Ispell}.
1414
1415 @node Checking TeX and *roff documents, Changing load-path, Spell-checkers, Common requests
1416 @section How can I spell-check @TeX{} or *roff documents?
1417 @cindex Spelling, checking @TeX{} documents
1418 @cindex @TeX{} documents, checking spelling in
1419
1420 Use Ispell. Ispell can handle @TeX{} and *roff documents.
1421 @xref{Ispell}.
1422
1423 @node Changing load-path, Using an already running Emacs process, Checking TeX and *roff documents, Common requests
1424 @section How do I change @code{load-path}?
1425 @cindex @code{load-path}, modifying
1426 @cindex Modifying @code{load-path}
1427 @cindex Adding to @code{load-path}
1428
1429 In general, you should only add to the @code{load-path}. You can add
1430 directory @var{/XXX/YYY} to the load path like this:
1431
1432 @lisp
1433 (setq load-path (cons "/XXX/YYY/" load-path))
1434 @end lisp
1435
1436 To do this relative to your home directory:
1437
1438 @lisp
1439 (setq load-path (cons "~/YYY/" load-path)
1440 @end lisp
1441
1442 @node Using an already running Emacs process, Compiler error messages, Changing load-path, Common requests
1443 @section How do I use an already running Emacs from another window?
1444 @cindex @code{emacsclient}
1445 @cindex Emacs server functions
1446 @cindex Using an existing Emacs process
1447
1448 @code{emacsclient}, which comes with Emacs, is for editing a file using
1449 an already running Emacs rather than starting up a new Emacs. It does
1450 this by sending a request to the already running Emacs, which must be
1451 expecting the request.
1452
1453 @itemize @bullet
1454
1455 @item
1456 Setup
1457
1458 Emacs must have executed the @code{server-start} function for
1459 @samp{emacsclient} to work. This can be done either by a command line
1460 option:
1461
1462 @example
1463 emacs -f server-start
1464 @end example
1465
1466 or by invoking @code{server-start} from @file{.emacs}:
1467
1468 @lisp
1469 (if (some conditions are met) (server-start))
1470 @end lisp
1471
1472 When this is done, Emacs starts a subprocess running a program called
1473 @samp{server}. @samp{server} creates a Unix domain socket, named
1474 @file{.emacs_server}, in the user's home directory.
1475
1476 To get your news reader, mail reader, etc., to invoke
1477 @samp{emacsclient}, try setting the environment variable @code{EDITOR}
1478 (or sometimes @code{VISUAL}) to the value @samp{emacsclient}. You may
1479 have to specify the full pathname of the @samp{emacsclient} program
1480 instead. Examples:
1481
1482 @example
1483 # csh commands:
1484 setenv EDITOR emacsclient
1485
1486 # using full pathname
1487 setenv EDITOR /usr/local/emacs/etc/emacsclient
1488
1489 # sh command:
1490 EDITOR=emacsclient ; export EDITOR
1491 @end example
1492
1493 @item Normal use
1494
1495 When @samp{emacsclient} is run, it connects to the @file{.emacs_server}
1496 socket and passes its command line options to @samp{server}. When
1497 @samp{server} receives these requests, it sends this information on the
1498 the Emacs process, which at the next opportunity will visit the files
1499 specified. (Line numbers can be specified just like with Emacs.) The
1500 user will have to switch to the Emacs window by hand. When the user is
1501 done editing a file, the user can type @kbd{C-x #} (or @kbd{M-x
1502 server-edit}) to indicate this. If there is another buffer requested by
1503 emacsclient, Emacs will switch to it; otherwise emacsclient will exit,
1504 signaling the calling program to continue.
1505
1506 @samp{emacsclient} and @samp{server} must be running on machines which
1507 share the same filesystem for this to work. The pathnames that
1508 @samp{emacsclient} specifies should be correct for the filesystem that
1509 the Emacs process sees. The Emacs process should not be suspended at
1510 the time @samp{emacsclient} is invoked. @samp{emacsclient} should
1511 either be invoked from another X window or from a shell window inside
1512 Emacs itself.
1513
1514 There is an enhanced version of @samp{emacsclient}/server called
1515 @samp{gnuserv} by @email{ange@@hplb.hpl.hp.com, Andy Norman} which is
1516 available in the Emacs Lisp Archive (@pxref{Packages that do not come
1517 with Emacs}). @samp{gnuserv} uses Internet domain sockets, so it can
1518 work across most network connections. It also supports the execution of
1519 arbitrary Emacs Lisp forms and does not require the client program to
1520 wait for completion.
1521
1522 The alpha version of an enhanced @samp{gnuserv} is available
1523 at
1524
1525 @uref{ftp://ftp.wellfleet.com/netman/psmith/emacs/gnuserv-2.1alpha.tar.gz}
1526
1527 @end itemize
1528
1529 @node Compiler error messages, Indenting switch statements, Using an already running Emacs process, Common requests
1530 @section How do I make Emacs recognize my compiler's funny error messages?
1531 @cindex Compiler error messages, recognizing
1532 @cindex Recognizing non-standard compiler errors
1533 @cindex Regexps for recognizing compiler errors
1534 @cindex Errors, recognizing compiler
1535
1536 The variable @code{compilation-error-regexp-alist} helps control how
1537 Emacs parses your compiler output. It is a list of triples of the form:
1538 @code{(@var{regexp} @var{file-idx} @var{line-idx})}, where @var{regexp}, @var{file-idx} and
1539 @var{line-idx} are strings. To help determine what the constituent
1540 elements should be, load @file{compile.el} and then use @kbd{C-h v
1541 compilation-error-regexp-alist @key{RET}}
1542
1543 to see the current value. A good idea is to look at @file{compile.el}
1544 itself as the comments included for this variable are quite useful ---
1545 the regular expressions required for your compiler's output may be very
1546 close to one already provided. Once you have determined the proper
1547 regexps, use the following to inform Emacs of your changes:
1548
1549 @lisp
1550 (setq compilation-error-regexp-alist
1551 (cons '(REGEXP FILE-IDX LINE-IDX)
1552 compilation-error-regexp-alist))
1553 @end lisp
1554
1555 @node Indenting switch statements, Horizontal scrolling, Compiler error messages, Common requests
1556 @section How do I change the indentation for @code{switch}?
1557 @cindex @code{switch}, indenting
1558 @cindex Indenting of @code{switch}
1559
1560 Many people want to indent their @code{switch} statements like this:
1561
1562 @example
1563 f()
1564 @{
1565 switch(x) @{
1566 case A:
1567 x1;
1568 break;
1569 case B:
1570 x2;
1571 break;
1572 default:
1573 x3;
1574 @}
1575 @}
1576 @end example
1577
1578 The solution at first appears to be: set @code{c-indent-level} to 4 and
1579 @code{c-label-offset} to -2. However, this will give you an indentation
1580 spacing of four instead of two.
1581
1582 The solution is to use @code{cc-mode} (the default mode for C
1583 programming in Emacs 20) and add the following line:
1584
1585 @lisp
1586 (c-set-offset 'case-label '+)
1587 @end lisp
1588
1589 There appears to be no way to do this with the old @code{c-mode}.
1590
1591 @node Horizontal scrolling, Overwrite mode, Indenting switch statements, Common requests
1592 @section How can I make Emacs automatically scroll horizontally?
1593 @cindex @code{hscroll-mode}
1594 @cindex Horizontal scrolling
1595 @cindex Scrolling horizontally
1596
1597 Use @code{hscroll-mode}, included in Emacs 20. Here is some information from
1598 the documentation, available by typing @kbd{C-h f hscroll-mode @key{RET}}:
1599
1600 Automatically scroll horizontally when the point moves off the
1601 left or right edge of the window.
1602
1603 @itemize @minus
1604
1605 @item Type @kbd{M-x hscroll-mode} to enable it in the current buffer.
1606 @item Type @kbd{M-x hscroll-global-mode} to enable it in every buffer.
1607 @item @code{turn-on-hscroll} is useful in mode hooks as in:
1608
1609 @lisp
1610 (add-hook 'text-mode-hook 'turn-on-hscroll)
1611 @end lisp
1612
1613 @item @code{hscroll-margin} controls how close the cursor can get to the
1614 edge of the window.
1615
1616 @item @code{hscroll-step-percent} controls how far to jump once we decide to do so.
1617
1618 @end itemize
1619
1620 @node Overwrite mode, Turning off beeping, Horizontal scrolling, Common requests
1621 @section How do I make Emacs "typeover" or "overwrite" instead of inserting?
1622 @cindex @key{Insert}
1623 @cindex @code{overwrite-mode}
1624 @cindex Overwriting existing text
1625 @cindex Toggling @code{overwrite-mode}
1626
1627 @kbd{M-x overwrite-mode} (a minor mode). This toggles
1628 @code{overwrite-mode} on and off, so exiting from @code{overwrite-mode}
1629 is as easy as another @kbd{M-x overwrite-mode}.
1630
1631 On some workstations, @key{Insert} toggles @code{overwrite-mode} on and off.
1632
1633 @node Turning off beeping, Turning the volume down, Overwrite mode, Common requests
1634 @section How do I stop Emacs from beeping on a terminal?
1635 @cindex Beeping, turning off
1636 @cindex Visible bell
1637 @cindex Bell, visible
1638
1639 @email{martin@@cc.gatech.edu, Martin R. Frank} writes:
1640
1641 Tell Emacs to use the "visible bell" instead of the audible bell, and
1642 set the visible bell to nothing.
1643
1644 That is, put the following in your @code{TERMCAP} environment variable
1645 (assuming you have one):
1646
1647 @example
1648 ... :vb=: ...
1649 @end example
1650
1651 And evaluate the following Lisp form:
1652
1653 @example
1654 (setq visible-bell t)
1655 @end example
1656
1657 @node Turning the volume down, Automatic indentation, Turning off beeping, Common requests
1658 @section How do I turn down the bell volume in Emacs running under X Windows?
1659 @cindex Bell, volume of
1660 @cindex Volume of bell
1661
1662 You can adjust the bell volume and duration for all programs with the
1663 shell command @file{xset}.
1664
1665 Invoking @file{xset} without any arguments produces some basic information,
1666 including the following:
1667
1668 @example
1669 usage: xset [-display host:dpy] option ...
1670 To turn bell off:
1671 -b b off b 0
1672 To set bell volume, pitch and duration:
1673 b [vol [pitch [dur]]] b on
1674 @end example
1675
1676 @node Automatic indentation, Matching parentheses, Turning the volume down, Common requests
1677 @section How do I tell Emacs to automatically indent a new line to the indentation of the previous line?
1678 @cindex Indenting new lines
1679 @cindex New lines, indenting of
1680 @cindex Previous line, indenting according to
1681
1682 Such behavior is automatic in Emacs 20. From the NEWS file for Emacs
1683 20.2:
1684
1685 @example
1686 ** In Text mode, now only blank lines separate paragraphs. This makes
1687 it possible to get the full benefit of Adaptive Fill mode in Text mode,
1688 and other modes derived from it (such as Mail mode). @key{TAB} in Text
1689 mode now runs the command @code{indent-relative}; this makes a practical
1690 difference only when you use indented paragraphs.
1691
1692 As a result, the old Indented Text mode is now identical to Text mode,
1693 and is an alias for it.
1694
1695 If you want spaces at the beginning of a line to start a paragraph, use
1696 the new mode, Paragraph Indent Text mode.
1697 @end example
1698
1699 If you have @code{auto-fill-mode} on (@pxref{Turning on auto-fill by
1700 default}), you can tell Emacs to prefix every line with a certain
1701 character sequence, the "fill prefix." Type the prefix at the beginning
1702 of a line, position point after it, and then type @kbd{C-x .}
1703 (@code{set-fill-prefix}) to set the fill prefix. Thereafter,
1704 auto-filling will automatically put the fill prefix at the beginning of
1705 new lines, and @kbd{M-q} (@code{fill-paragraph}) will maintain any fill
1706 prefix when refilling the paragraph.
1707
1708 If you have paragraphs with different levels of indentation, you will
1709 have to set the fill prefix to the correct value each time you move to a
1710 new paragraph. To avoid this hassle, try one of the many packages
1711 available from the Emacs Lisp Archive (@pxref{Packages that do not come
1712 with Emacs}.) Look up "fill" and "indent" in the Lisp Code Directory
1713 for guidance.
1714
1715 @node Matching parentheses, Hiding #ifdef lines, Automatic indentation, Common requests
1716 @section How do I show which parenthesis matches the one I'm looking at?
1717 @cindex Parentheses, matching
1718 @cindex @file{paren.el}
1719 @cindex Highlighting matching parentheses
1720 @cindex Pairs of parentheses, highlighting
1721 @cindex Matching parentheses
1722
1723 As of version 19, Emacs comes with @file{paren.el}, which (when loaded)
1724 will automatically highlight matching parentheses whenever point (i.e.,
1725 the cursor) is located over one. To load @file{paren.el} automatically,
1726 include the line
1727
1728 @lisp
1729 (require 'paren)
1730 @end lisp
1731
1732 in your @file{.emacs} file. @email{shutkoa@@ugsolutions.com, Alan Shutko}
1733 reports that as of version 20.1, you must also call @code{show-paren-mode} in
1734 your @file{.emacs} file:
1735
1736 @lisp
1737 (show-paren-mode 1)
1738 @end lisp
1739
1740 @code{customize} will let you turn on @code{show-paren-mode}. Use
1741 @kbd{M-x customize-group @key{RET} paren-showing @key{RET}}. From
1742 within @code{customize}, you can also go directly to the "paren-showing"
1743 group.
1744
1745 Alternatives to paren include:
1746
1747 @itemize @bullet
1748
1749 @item
1750 If you're looking at a right parenthesis (or brace or bracket) you can
1751 delete it and reinsert it. Emacs will blink the cursor on the matching
1752 parenthesis.
1753
1754 @item
1755 @kbd{M-C-f} (@code{forward-sexp}) and @kbd{M-C-b} (@code{backward-sexp})
1756 will skip over one set of balanced parentheses, so you can see which
1757 parentheses match. (You can train it to skip over balanced brackets
1758 and braces at the same time by modifying the syntax @key{TAB}le.)
1759
1760 @item
1761 Here is some Emacs Lisp that will make the @key{%} key show the matching
1762 parenthesis, like in vi. In addition, if the cursor isn't over a
1763 parenthesis, it simply inserts a % like normal.
1764
1765 @lisp
1766 ;; By an unknown contributor
1767
1768 (global-set-key "%" 'match-paren)
1769
1770 (defun match-paren (arg)
1771 "Go to the matching paren if on a paren; otherwise insert %."
1772 (interactive "p")
1773 (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
1774 ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
1775 (t (self-insert-command (or arg 1)))))
1776 @end lisp
1777
1778 @end itemize
1779
1780 @node Hiding #ifdef lines, Repeating commands, Matching parentheses, Common requests
1781 @section In C mode, can I show just the lines that will be left after @code{#ifdef} commands are handled by the compiler?
1782 @cindex @code{#ifdef}, selective display of
1783 @cindex @code{hide-ifdef-mode}
1784 @cindex Hiding @code{#ifdef} text
1785 @cindex Selectively displaying @code{#ifdef} code
1786
1787 @kbd{M-x hide-ifdef-mode}. (This is a minor mode.) You might also want
1788 to try @file{cpp.el}, available at the Emacs Lisp Archive
1789 (@pxref{Packages that do not come with Emacs}).
1790
1791 @node Repeating commands, Valid X resources, Hiding #ifdef lines, Common requests
1792 @section Is there an equivalent to the @code{.} (dot) command of vi?
1793 @cindex Repeating commands as with vi
1794 @cindex Command, repeat last
1795 @cindex @code{.}, equivalent to vi command
1796
1797 (@code{.} is the redo command in vi. It redoes the last insertion/deletion.)
1798
1799 As of Emacs 20.3, there is indeed a @code{repeat} command (@kbd{C-x .})
1800 that repeats the last command. If you preface it with a prefix
1801 argument, the prefix arg is applied to the command.
1802
1803 You can also type @kbd{C-x @key{ESC} @key{ESC}}
1804 (@code{repeat-complex-command}) to reinvoke commands that used the
1805 minibuffer to get arguments. In @code{repeat-complex-command} you can
1806 type @kbd{M-p} and @kbd{M-n} to scan through all the different complex
1807 commands you've typed.
1808
1809 To repeat a set of commands, use keyboard macros. (@inforef{Keyboard
1810 Macros, Keyboard Macros, emacs}.)
1811
1812 If you're really desperate for the @code{.} command, use VIPER, which comes
1813 with Emacs, and which appears to support it. (@xref{VIPER}.)
1814
1815 @node Valid X resources, Evaluating Emacs Lisp code, Repeating commands, Common requests
1816 @section What are the valid X resource settings (i.e., stuff in .Xdefaults)?
1817 @cindex Resources, X
1818 @cindex X resources
1819 @cindex Setting X resources
1820
1821 @inforef{Resources X, Resources X, emacs}.
1822
1823 You can also use a resource editor, such as editres (for X11R5 and
1824 onwards), to look at the resource names for the menu bar, assuming Emacs
1825 was compiled with the X toolkit.
1826
1827 @node Evaluating Emacs Lisp code, Changing the length of a Tab, Valid X resources, Common requests
1828 @section How do I execute ("evaluate") a piece of Emacs Lisp code?
1829 @cindex Evaluating Lisp code
1830 @cindex Lisp forms, evaluating
1831
1832 There are a number of ways to execute ("evaluate," in Lisp lingo) an
1833 Emacs Lisp "form":
1834
1835 @itemize @bullet
1836
1837 @item
1838 If you want it evaluated every time you run Emacs, put it in a file
1839 named @file{.emacs} in your home directory. This is known as your ".emacs
1840 file," and contains all of your personal customizations.
1841
1842 @item
1843 You can type the form in the @file{*scratch*} buffer, and then type
1844 @key{LFD} (or @kbd{C-j}) after it. The result of evaluating the form
1845 will be inserted in the buffer.
1846
1847 @item
1848 In @code{emacs-lisp-mode}, typing @kbd{M-C-x} evaluates a top-level form
1849 before or around point.
1850
1851 @item
1852 Typing @kbd{C-x C-e} in any buffer evaluates the Lisp form immediately
1853 before point and prints its value in the echo area.
1854
1855 @item
1856 Typing @kbd{M-:} or @kbd{M-x eval-expression} allows you to type a Lisp
1857 form in the minibuffer which will be evaluated.
1858
1859 @item
1860 You can use @kbd{M-x load-file} to have Emacs evaluate all the Lisp
1861 forms in a file. (To do this from Lisp use the function @code{load}
1862 instead.)
1863
1864 The functions @code{load-library}, @code{eval-region},
1865 @code{eval-current-buffer}, @code{require}, and @code{autoload} are also
1866 useful; @pxref{Emacs Lisp documentation} if you want to learn more about
1867 them.
1868
1869 @end itemize
1870
1871 @node Changing the length of a Tab, Inserting > at the beginning of each line, Evaluating Emacs Lisp code, Common requests
1872 @section How do I change Emacs's idea of the @key{TAB} character's length?
1873 @cindex Tab length
1874 @cindex Length of tab character
1875 @cindex @code{default-tab-width}
1876
1877 Set the variable @code{default-tab-width}. For example, to set
1878 @key{TAB} stops every 10 characters, insert the following in your
1879 @file{.emacs} file:
1880
1881 @lisp
1882 (setq default-tab-width 10)
1883 @end lisp
1884
1885 Do not confuse variable @code{tab-width} with variable
1886 @code{tab-stop-list}. The former is used for the display of literal
1887 @key{TAB} characters. The latter controls what characters are inserted
1888 when you press the @key{TAB} character in certain modes.
1889
1890 @node Inserting > at the beginning of each line, Underlining paragraphs, Changing the length of a Tab, Common requests
1891 @section How do I insert @samp{>} at the beginning of every line?
1892 @cindex Prefix character, inserting in mail/news replies
1893 @cindex Replies to mail/news, inserting a prefix character
1894 @cindex @code{mail-yank-prefix}
1895 @cindex Mail replies, inserting a prefix character
1896 @cindex News replies, inserting a prefix character
1897
1898 To do this to an entire buffer, type @kbd{M-< M-x replace-regexp
1899 @key{RET} ^ @key{RET} > @key{RET}}.
1900
1901 To do this to a region, use @code{string-rectangle} (@kbd{C-x r t}).
1902 Set the mark (@kbd{C-@key{SPC}}) at the beginning of the first line you
1903 want to prefix, move the cursor to last line to be prefixed, and type
1904 @kbd{C-x r t > @key{RET}}. To do this for the whole buffer, type
1905 @kbd{C-x h C-x r t > @key{RET}}.
1906
1907 If you are trying to prefix a yanked mail message with @samp{>}, you
1908 might want to set the variable @code{mail-yank-prefix}. Better yet, get
1909 the Supercite package (@pxref{Supercite}), which provides flexible
1910 citation for yanked mail and news messages. @xref{Changing the included
1911 text prefix}, for additional information.
1912
1913 @node Underlining paragraphs, Repeating a command as many times as possible, Inserting > at the beginning of each line, Common requests
1914 @section How do I insert "_^H" before each character in a region to get an underlined paragraph?
1915 @cindex Underlining a region of text
1916 @cindex @code{underline-region}
1917
1918 @kbd{M-x underline-region}.
1919
1920 @node Repeating a command as many times as possible, Forcing the cursor to remain in the same column, Underlining paragraphs, Common requests
1921 @section How do I repeat a command as many times as possible?
1922 @cindex Repeating commands
1923 @cindex Commands, repeating
1924
1925 Use @kbd{C-x (} and @kbd{C-x )} to make a keyboard macro that invokes
1926 the command and then type @kbd{M-0 C-x e}.
1927
1928 Any messages your command prints in the echo area will be suppressed.
1929
1930 @node Forcing the cursor to remain in the same column, Forcing Emacs to iconify itself, Repeating a command as many times as possible, Common requests
1931 @section How do I make Emacs behave like this: when I go up or down, the cursor should stay in the same column even if the line is too short?
1932 @cindex @code{picture-mode}
1933 @cindex Remaining in the same column, regardless of contents
1934 @cindex Vertical movement in empty documents
1935
1936 @kbd{M-x picture-mode}.
1937
1938 @node Forcing Emacs to iconify itself, Using regular expressions, Forcing the cursor to remain in the same column, Common requests
1939 @section How do I tell Emacs to iconify itself?
1940 @cindex Iconification under X Windows
1941 @cindex X Windows and iconification
1942 @cindex Suspending Emacs
1943
1944 @kbd{C-z} iconifies Emacs when running under X Windows and suspends Emacs
1945 otherwise. @inforef{Misc X, Misc X, emacs}.
1946
1947 @node Using regular expressions, Replacing text across multiple files, Forcing Emacs to iconify itself, Common requests
1948 @section How do I use regexps (regular expressions) in Emacs?
1949 @cindex Regexps
1950 @cindex Regular expressions
1951 @cindex Differences between Unix and Emacs regexps
1952 @cindex Unix regeps, differences from Emacs
1953 @cindex Text strings, putting regexps in
1954
1955 @inforef{Regexps, Regexps, emacs}.
1956
1957 The "or" operator is @samp{\|}, not @samp{|}, and the grouping operators
1958 are @samp{\(} and @samp{\)}. Also, the string syntax for a backslash is
1959 @samp{\\}. To specify a regular expression like @samp{xxx\(foo\|bar\)}
1960 in a Lisp string, use @samp{xxx\\(foo\\|bar\\)}.
1961
1962 Notice the doubled backslashes!
1963
1964 @itemize @bullet
1965
1966 @item Unlike in Unix @file{grep}, @file{sed}, etc., a complement
1967 character set (@samp{[^...]}) can match a newline character (@key{LFD}
1968 aka @kbd{C-j} aka @samp{\n}), unless newline is mentioned as one of the
1969 characters not to match.
1970
1971 @item The character syntax regexps (e.g., @samp{\sw}) are not
1972 meaningful inside character set regexps (e.g., @samp{[aeiou]}). (This
1973 is actually typical for regexp syntax.)
1974
1975 @end itemize
1976
1977 @node Replacing text across multiple files, Documentation for etags, Using regular expressions, Common requests
1978 @section How do I perform a replace operation across more than one file?
1979 @cindex Replacing strings across files
1980 @cindex Multiple files, replacing across
1981 @cindex Files, replacing strings across multiple
1982
1983 The "tags" feature of Emacs includes the command
1984 @code{tags-query-replace} which performs a query-replace across all the
1985 files mentioned in the TAGS file. @inforef{Tags Search, Tags Search,
1986 emacs}.
1987
1988 As of Emacs 19.29, Dired mode (@kbd{M-x dired @key{RET}}, or @kbd{C-x
1989 d}) supports the command @code{dired-do-query-replace}, which allows
1990 users to replace regular expressions in multiple files.
1991
1992 @node Documentation for etags, Disabling backups, Replacing text across multiple files, Common requests
1993 @section Where is the documentation for @file{etags}?
1994 @cindex Documentation for @file{etags}
1995 @cindex @file{etags}, documentation for
1996
1997 The @file{etags} man page should be in the same place as the
1998 @file{emacs} man page.
1999
2000 Quick command-line switch descriptions are also available. For example,
2001 @samp{etags -H}.
2002
2003 @node Disabling backups, Disabling auto-save-mode, Documentation for etags, Common requests
2004 @section How do I disable backup files?
2005 @cindex Backups, disabling
2006 @cindex Disabling backups
2007
2008 You probably don't want to do this, since backups are useful.
2009
2010 To avoid seeing backup files (and other "uninteresting" files) in Dired,
2011 load dired-x by adding the following to your @file{.emacs} file:
2012
2013 @lisp
2014 (add-hook 'dired-load-hook
2015 (function (lambda ()
2016 (load "dired-x"))))
2017 @end lisp
2018
2019 With dired-x loaded, @kbd{M-o} toggles omitting in each dired buffer.
2020 You can make omitting the default for new dired buffers by putting the
2021 following in your @file{.emacs}:
2022
2023 @lisp
2024 (setq initial-dired-omit-files-p t)
2025 @end lisp
2026
2027 If you're tired of seeing backup files whenever you do an "ls" at the
2028 Unix shell, try GNU ls with the "-B" option. GNU ls is part of the GNU
2029 fileutils package, available at mirrors of @samp{ftp.gnu.org} (@pxref{Current GNU distributions} ).
2030
2031 To disable or change how backups are made, see "Backup Names" in the
2032 on-line manual.
2033
2034 @node Disabling auto-save-mode, Modifying pull-down menus, Disabling backups, Common requests
2035 @section How do I disable @code{auto-save-mode}?
2036 @cindex Disabling @code{auto-save-mode}
2037 @cindex Auto-saving
2038 @cindex Saving at frequent intervals
2039
2040 You probably don't want to do this, since auto-saving is useful,
2041 especially when Emacs or your computer crashes while you are editing a
2042 document.
2043
2044 Instead, you might want to change the variable
2045 @code{auto-save-interval}, which specifies how many keystrokes Emacs
2046 waits before auto-saving. Increasing this value forces Emacs to wait
2047 longer between auto-saves, which might annoy you less.
2048
2049 You might also want to look into Sebastian Kremer's @code{auto-save}
2050 package, available from the Lisp Code Archive (@pxref{Packages that do not come
2051 with Emacs}). This
2052 package also allows you to place all auto-save files in one directory,
2053 such as @file{/tmp}.
2054
2055 To disable or change how @code{auto-save-mode} works, see "Auto Save" in the
2056 on-line manual.
2057
2058 @node Modifying pull-down menus, Deleting menus and menu options, Disabling auto-save-mode, Common requests
2059 @section How can I create or modify new pull-down menu options?
2060 @cindex Pull-down menus, creating or modifying
2061 @cindex Menus, creating or modifying
2062 @cindex Creating new menu options
2063 @cindex Modifying pull-down menus
2064 @cindex Menus and keymaps
2065 @cindex Keymaps and menus
2066
2067 Each menu title (e.g., Buffers, File, Edit) represents a local or global
2068 keymap. Selecting a menu title with the mouse displays that keymap's
2069 non-nil contents in the form of a menu.
2070
2071 So to add a menu option to an existing menu, all you have to do is add a
2072 new definition to the appropriate keymap. Adding a "forward word"
2073 command to the "Edit" menu thus requires the following Lisp code:
2074
2075 @lisp
2076 (define-key global-map
2077 [menu-bar edit forward]
2078 '("Forward word" . forward-word))
2079 @end lisp
2080
2081 The first line adds the entry to the global keymap, which includes
2082 global menu bar entries. Replacing the reference to @code{global-map}
2083 with a local keymap would add this menu option only within a particular
2084 mode.
2085
2086 The second line describes the path from the menu-bar to the new entry.
2087 Placing this menu entry underneath the "File" menu would mean changing
2088 the word "edit" in the second line to "file."
2089
2090 The third line is a cons cell whose first element is the title that will
2091 be displayed, and whose second element is the function that will be
2092 called when that menu option is invoked.
2093
2094 To add a new menu, rather than a new option to an existing menu, we must
2095 define an entirely new keymap:
2096
2097 @lisp
2098 (define-key global-map [menu-bar words]
2099 (cons "Words" (make-sparse-keymap "Words")))
2100 @end lisp
2101
2102 The above code creates a new sparse keymap, gives it the name "Words",
2103 and attaches it to the global menu bar. Adding the "forward word"
2104 command to this new menu would thus require the following code:
2105
2106 @lisp
2107 (define-key global-map
2108 [menu-bar words forward]
2109 '("Forward word" . forward-word))
2110 @end lisp
2111
2112 Note that because of the way keymaps work, menu options are displayed
2113 with the more recently defined items at the top. Thus if you were to
2114 define menu options "foo", "bar", and "baz" (in that order), menu option
2115 "baz" would appear at the top, and "foo" would be at the bottom.
2116
2117 One way to avoid this problem is to use the function @code{define-key-after},
2118 which works the same as @code{define-key}, but lets you modify where items
2119 appear. The following Lisp code would insert the "forward word" function
2120 in the "edit" menu immediately following the "undo" option:
2121
2122 @lisp
2123 (define-key-after
2124 (lookup-key global-map [menu-bar edit])
2125 [forward]
2126 '("Forward word" . forward-word)
2127 'undo)
2128 @end lisp
2129
2130 Note how the second and third arguments to @code{define-key-after} are
2131 different from those of @code{define-key}, and that we have added a new
2132 (final) argument, the function after which our new key should be
2133 defined.
2134
2135 To move a menu option from one position to another, simply evaluate
2136 @code{define-key-after} with the appropriate final argument.
2137
2138 More detailed information --- and more examples of how to create and
2139 modify menu options --- are in the Emacs Lisp Reference Manual, under
2140 "Keymaps". (@pxref{Emacs Lisp documentation} for information on this
2141 manual.)
2142
2143 @node Deleting menus and menu options, Turning on syntax highlighting, Modifying pull-down menus, Common requests
2144 @section How do I delete menus and menu options?
2145 @cindex Deleting menus and menu options
2146 @cindex Menus, deleting
2147
2148 The simplest way to remove a menu is to set its keymap to @samp{nil}.
2149 For example, to delete the "Words" menu (@pxref{Modifying pull-down
2150 menus}), use:
2151
2152 @lisp
2153 (define-key global-map [menu-bar words] nil)
2154 @end lisp
2155
2156 Similarly, removing a menu option requires redefining a keymap entry to
2157 @code{nil}. For example, to delete the "Forward word" menu option from the
2158 "Edit" menu (we added it in @ref{Modifying pull-down menus}), use:
2159
2160 @lisp
2161 (define-key global-map [menu-bar edit forward] nil)
2162 @end lisp
2163
2164 @node Turning on syntax highlighting, Scrolling only one line, Deleting menus and menu options, Common requests
2165 @section How do I turn on syntax highlighting?
2166 @cindex Syntax highlighting
2167 @cindex @code{font-lock-mode}
2168 @cindex Highlighting based on syntax
2169 @cindex Colorizing text
2170 @cindex FAQ, @code{font-lock-mode}
2171
2172 @code{font-lock-mode} is the standard way to have Emacs perform syntax
2173 highlighting. With @code{font-lock-mode} invoked, different types of
2174 text will appear in different colors. For instance, if you turn on
2175 @code{font-lock-mode} in a programming mode, variables will appear in one
2176 face, keywords in a second, and comments in a third.
2177
2178 Earlier versions of Emacs supported hilit19, a similar package. Use of
2179 hilit19 is now considered non-standard, although @file{hilit19.el} comes
2180 with the stock Emacs distribution. It is no longer maintained.
2181
2182 To turn @code{font-lock-mode} on within an existing buffer, use @kbd{M-x
2183 font-lock-mode @key{RET}}.
2184
2185 To automatically invoke @code{font-lock-mode} when a particular major
2186 mode is invoked, set the major mode's hook. For example, to fontify all
2187 @code{c-mode} buffers, add the following to your @file{.emacs} file:
2188
2189 @lisp
2190 (add-hook 'c-mode-hook 'turn-on-font-lock)
2191 @end lisp
2192
2193 To automatically invoke @code{font-lock-mode} for all major modes, you
2194 can turn on @code{global-font-lock-mode} by including the following line
2195 in your @file{.emacs} file:
2196
2197 @lisp
2198 (global-font-lock-mode 1)
2199 @end lisp
2200
2201 This instructs Emacs to turn on font-lock mode in those buffers for
2202 which a font-lock mode definition has been provided (in the variable
2203 @code{font-lock-global-modes}). If you edit a file in
2204 @code{pie-ala-mode}, and no font-lock definitions have been provided for
2205 @code{pie-ala} files, then the above setting will have no effect on that
2206 particular buffer.
2207
2208 Highlighting with @code{font-lock-mode} can take quite a while, and thus
2209 different levels of decoration are available, from slight to gaudy. To
2210 control how decorated your buffers should become, set the value of
2211 @code{font-lock-maximum-decoration} in your @file{.emacs} file, with a
2212 @code{nil} value indicating default (usually minimum) decoration, and a
2213 @code{t} value indicating the maximum decoration. For the gaudiest
2214 possible look, then, include the line
2215
2216 @lisp
2217 (setq font-lock-maximum-decoration t)
2218 @end lisp
2219
2220 in your @file{.emacs} file. You can also set this variable such that
2221 different modes are highlighted in a different ways; for more
2222 information, see the documentation for
2223 @code{font-lock-maximum-decoration} with @kbd{C-h v} (or @kbd{M-x
2224 describe-variable @key{RET}}).
2225
2226 You might also want to investigate @code{fast-lock-mode} and
2227 @code{lazy-lock-mode}, versions of @code{font-lock-mode} that speed up
2228 highlighting. The advantage of @code{lazy-lock-mode} is that it only
2229 fontifies buffers when certain conditions are met, such as after a
2230 certain amount of idle time, or after you have finished scrolling
2231 through text. See the documentation for @code{lazy-lock-mode} by typing @kbd{C-h f
2232 @code{lazy-lock-mode}} (@kbd{M-x describe-function @key{RET}
2233 lazy-lock-mode @key{RET}}).
2234
2235 Also see the documentation for the function @code{font-lock-mode},
2236 available by typing @kbd{C-h f font-lock-mode} (@kbd{M-x
2237 describe-function @key{RET} font-lock-mode @key{RET}}).
2238
2239 For more information on font-lock mode, take a look at the
2240 @code{font-lock-mode} FAQ, maintained by
2241 @email{jari.aalto@@ntc.nokia.com, Jari Aalto} at
2242
2243 @uref{ftp://cs.uta.fi/pub/ssjaaa/ema-font.gui}
2244
2245 To print buffers with the faces (i.e., colors and fonts) intact, use
2246 @kbd{M-x ps-print-buffer-with-faces} or @kbd{M-x
2247 ps-print-region-with-faces}.
2248
2249 @node Scrolling only one line, Replacing highlighted text, Turning on syntax highlighting, Common requests
2250 @section How can I force Emacs to scroll only one line when I move past the bottom of the screen?
2251 @cindex Scrolling only one line
2252 @cindex Reducing the increment when scrollng
2253
2254 Place the following Lisp form in your @file{.emacs} file:
2255
2256 @lisp
2257 (setq scroll-step 1)
2258 @end lisp
2259
2260 @inforef{Scrolling, Scrolling, emacs}.
2261
2262 @node Replacing highlighted text, Editing MS-DOS files, Scrolling only one line, Common requests
2263 @section How can I replace highlighted text with what I type?
2264 @cindex @code{delete-selection-mode}
2265 @cindex Replacing highlighted text
2266 @cindex Highlighing and replacing text
2267
2268 Use @code{delete-selection mode}, which you can start automatically by
2269 placing the following Lisp form in your @file{.emacs} file:
2270
2271 @lisp
2272 (delete-selection-mode t)
2273 @end lisp
2274
2275 According to the documentation string for delete-selection mode (which
2276 you can read using @kbd{M-x describe-function @key{RET}
2277 delete-selection-mode @key{RET}}):
2278
2279 @quotation
2280 When ON, typed text replaces the selection if the selection is active.
2281 When OFF, typed text is just inserted at point.
2282 @end quotation
2283
2284 This mode also allows you to delete (not kill) the highlighted region by
2285 pressing @key{DEL}.
2286
2287 @node Editing MS-DOS files, Filling paragraphs with a single space, Replacing highlighted text, Common requests
2288 @section How can I edit MS-DOS files using Emacs?
2289 @cindex Editing MS-DOS files
2290 @cindex MS-DOS files, editing
2291 @cindex Microsoft files, editing
2292 @cindex Windows files, editing
2293
2294 As of Emacs 20, detection and handling of MS-DOS (and Windows) files is
2295 performed transparently. You can open MS-DOS files on a Unix system,
2296 edit it, and save it without having to worry about the file format.
2297
2298 When editing an MS-DOS style file, a backslash (@samp{\}) will appear in
2299 the mode line.
2300
2301 If you are running an earlier version of Emacs, get @code{crypt++} from
2302 the Emacs Lisp Archive (@pxref{Packages that do not come with Emacs}).
2303 Among other things, @code{crypt++} transparently modifies MS-DOS files
2304 as they are loaded and saved, allowing you to ignore the different
2305 conventions that Unix and MS-DOS have for delineating the end of a line.
2306
2307 @node Filling paragraphs with a single space, , Editing MS-DOS files, Common requests
2308 @section How can I tell Emacs to fill paragraphs with a single space after each period?
2309 @cindex One space following periods
2310 @cindex Single space following periods
2311 @cindex Periods, one space following
2312
2313 @email{ulm@@vsnhd1.cern.ch, Ulrich Mueller} suggests adding the
2314 following two lines to your @file{.emacs} file:
2315
2316 @lisp
2317 (setq sentence-end "[.?!][]\"')@}]*\\($\\|[ \t]\\)[ \t\n]*")
2318 (setq sentence-end-double-space nil)
2319 @end lisp
2320
2321 @c ------------------------------------------------------------
2322 @node Bugs and problems, Compiling and installing Emacs, Common requests, Top
2323 @chapter Bugs and problems
2324 @cindex Bugs and problems
2325
2326 @menu
2327 * Problems with very large files::
2328 * ^M in the shell buffer::
2329 * Shell process exits abnormally::
2330 * Termcap/Terminfo entries for Emacs::
2331 * Spontaneous entry into isearch-mode::
2332 * Problems talking to certain hosts::
2333 * Errors with init files::
2334 * Emacs ignores X resources::
2335 * Emacs takes a long time to visit files::
2336 * Editing files with $ in the name::
2337 * Shell mode loses the current directory::
2338 * Security risks with Emacs::
2339 * Dired claims that no file is on this line::
2340 @end menu
2341
2342 @node Problems with very large files, ^M in the shell buffer, Bugs and problems, Bugs and problems
2343 @section Does Emacs have problems with files larger than 8 megabytes?
2344 @cindex Very large files, opening
2345 @cindex Large files, opening
2346 @cindex Opening very large files
2347 @cindex Maximum file size
2348 @cindex Files, maximum size
2349
2350 Old versions (i.e., anything before 19.29) of Emacs had problems editing
2351 files larger than 8 megabytes. As of version 19.29, the maximum buffer
2352 size is at least 2^27-1, or 134,217,727 bytes.
2353
2354 If you are using an older version of Emacs and cannot upgrade, you will
2355 have to recompile. @email{lnz@@lucid.com, Leonard N. Zubkoff} suggests
2356 putting the following two lines in @file{src/config.h} before compiling
2357 Emacs to allow for 26-bit integers and pointers (and thus file sizes of
2358 up to 33,554,431 bytes):
2359
2360 @example
2361 #define VALBITS 26
2362 #define GCTYPEBITS 5
2363 @end example
2364
2365 This method may result in "ILLEGAL DATATYPE" and other random errors on
2366 some machines.
2367
2368 @email{daveg@@csvax.cs.caltech.edu, David Gillespie} explains how this
2369 problems crops up; while his numbers are true only for pre-19.29
2370 versions of Emacs, the theory remains the same with current versions.
2371
2372 @quotation
2373 Emacs is largely written in a dialect of Lisp; Lisp is a freely-typed
2374 language in the sense that you can put any value of any type into any
2375 variable, or return it from a function, and so on. So each value
2376 must carry a "tag" along with it identifying what kind of thing it is,
2377 e.g., integer, pointer to a list, pointer to an editing buffer, and so
2378 on. Emacs uses standard 32-bit integers for data objects, taking the
2379 top 8 bits for the tag and the bottom 24 bits for the value. So
2380 integers (and pointers) are somewhat restricted compared to true C
2381 integers and pointers.
2382 @end quotation
2383
2384 @node ^M in the shell buffer, Shell process exits abnormally, Problems with very large files, Bugs and problems
2385 @section How do I get rid of @samp{^M} or echoed commands in my shell buffer?
2386 @cindex Shell buffer, echoed commands and @samp{^M} in
2387 @cindex Echoed commands in @code{shell-mode}
2388
2389 Try typing @kbd{M-x shell-strip-ctrl-m @key{RET}} while in @code{shell-mode} to
2390 make them go away. If that doesn't work, you have several options:
2391
2392 For tcsh, put this in your @file{.cshrc} (or @file{.tcshrc}) file:
2393
2394 @example
2395 if ($?EMACS) then
2396 if ("$EMACS" == t) then
2397 if ($?tcsh) unset edit
2398 stty nl
2399 endif
2400 endif
2401 @end example
2402
2403 Or put this in your @file{.emacs_tcsh} file:
2404
2405 @example
2406 unset edit
2407 stty nl
2408 @end example
2409
2410 Alternatively, use @file{csh} in your shell buffers instead of
2411 @file{tcsh}. One way is:
2412
2413 @lisp
2414 (setq explicit-shell-file-name "/bin/csh")
2415 @end lisp
2416
2417 and another is to do this in your @file{.cshrc} (or @file{.tcshrc})
2418 file:
2419
2420 @example
2421 setenv ESHELL /bin/csh
2422 @end example
2423
2424 (You must start Emacs over again with the environment variable properly
2425 set for this to take effect.)
2426
2427 You can also set the @code{ESHELL} environment variable in Emacs Lisp
2428 with the following Lisp form,
2429
2430 @lisp
2431 (setenv "ESHELL" "/bin/csh")
2432 @end lisp
2433
2434 On a related note: If your shell is echoing your input line in the shell
2435 buffer, you might want to try the following command in your shell
2436 start-up file:
2437
2438 @example
2439 stty -icrnl -onlcr -echo susp ^Z
2440 @end example
2441
2442 @node Shell process exits abnormally, Termcap/Terminfo entries for Emacs, ^M in the shell buffer, Bugs and problems
2443 @section Why do I get "Process shell exited abnormally with code 1"?
2444 @cindex Abnormal exits from @code{shell-mode}
2445 @cindex @code{shell-mode} exits
2446
2447 The most likely reason for this message is that the @samp{env} program
2448 is not properly installed. Compile this program for your architecture,
2449 and install it with @samp{a+x} permission in the architecture-dependent
2450 Emacs program directory. (You can find what this directory is at your
2451 site by inspecting the value of the variable @code{exec-directory} by
2452 typing @kbd{C-h v exec-directory @key{RET}}.)
2453
2454 You should also check for other programs named @samp{env} in your path
2455 (e.g., SunOS has a program named @file{/usr/bin/env}). We don't
2456 understand why this can cause a failure and don't know a general
2457 solution for working around the problem in this case.
2458
2459 The @samp{make clean} command will remove @samp{env} and other vital
2460 programs, so be careful when using it.
2461
2462 It has been reported that this sometimes happened when Emacs was started
2463 as an X client from an xterm window (i.e., had a controlling tty) but the
2464 xterm was later terminated.
2465
2466 See also @samp{PROBLEMS} (in the top-level directory when you unpack the
2467 Emacs source) for other possible causes of this message.
2468
2469 @node Termcap/Terminfo entries for Emacs, Spontaneous entry into isearch-mode, Shell process exits abnormally, Bugs and problems
2470 @section Where is the termcap/terminfo entry for terminal type "emacs"?
2471 @cindex Termcap
2472 @cindex Terminfo
2473 @cindex Emacs entries for termcap/terminfo
2474
2475 The termcap entry for terminal type @samp{emacs} is ordinarily put in
2476 the @samp{TERMCAP} environment variable of subshells. It may help in
2477 certain situations (e.g., using rlogin from shell buffer) to add an
2478 entry for @samp{emacs} to the system-wide termcap file. Here is a
2479 correct termcap entry for @samp{emacs}:
2480
2481 @example
2482 emacs:tc=unknown:
2483 @end example
2484
2485 To make a terminfo entry for "emacs", use "tic" or "captoinfo." You need
2486 to generate @file{/usr/lib/terminfo/e/emacs}. It may work to simply copy
2487 @file{/usr/lib/terminfo/d/dumb} to @file{/usr/lib/terminfo/e/emac}s.
2488
2489 Having a termcap/terminfo entry will not enable the use of full screen
2490 programs in shell buffers. Use @kbd{M-x terminal-emulator} for that
2491 instead.
2492
2493 A workaround to the problem of missing termcap/terminfo entries is to
2494 change terminal type "emacs" to type "dumb" or "unknown" in your shell
2495 start up file. "csh" users could put this in their .cshrc files:
2496
2497 @example
2498 if ("$term" == emacs) set term=dumb
2499 @end example
2500
2501 @node Spontaneous entry into isearch-mode, Problems talking to certain hosts, Termcap/Terminfo entries for Emacs, Bugs and problems
2502 @section Why does Emacs spontaneously start displaying "I-search:" and beeping?
2503 @cindex Spontaneous entry into isearch-mode
2504 @cindex isearch-mode, spontaneous entry into
2505 @cindex Beeping without obvious reason
2506
2507 Your terminal (or something between your terminal and the computer) is
2508 sending @kbd{C-s} and @kbd{C-q} for flow control, and Emacs is receiving
2509 these characters and interpreting them as commands. (The @kbd{C-s}
2510 character normally invokes the @code{isearch-forward} command.) For
2511 possible solutions, @pxref{Handling C-s and C-q with flow control}.
2512
2513 @node Problems talking to certain hosts, Errors with init files, Spontaneous entry into isearch-mode, Bugs and problems
2514 @section Why can't Emacs talk to certain hosts (or certain hostnames)?
2515 @cindex Hosts, Emacs cannot talk to
2516 @cindex @code{gethostbyname}, problematic version
2517
2518 The problem may be that Emacs is linked with a wimpier version of
2519 @code{gethostbyname} than the rest of the programs on the machine. This
2520 is often manifested as a message on startup of "X server not responding.
2521 Check your @samp{DISPLAY} environment variable." or a message of
2522 "Unknown host" from @code{open-network-stream}.
2523
2524 On a Sun, this may be because Emacs had to be linked with the static C
2525 library. The version of @code{gethostbyname} in the static C library
2526 may only look in @file{/etc/hosts} and the NIS (YP) maps, while the
2527 version in the dynamic C library may be smart enough to check DNS in
2528 addition to or instead of NIS. On a Motorola Delta running System V
2529 R3.6, the version of @code{gethostbyname} in the standard library works,
2530 but the one that works with NIS doesn't (the one you get with -linet).
2531 Other operating systems have similar problems.
2532
2533 Try these options:
2534
2535 @itemize @bullet
2536
2537 @item
2538 Explicitly add the host you want to communicate with to @file{/etc/hosts}.
2539
2540 @item
2541 Relink Emacs with this line in @file{src/config.h}:
2542
2543 @example
2544 #define LIBS_SYSTEM -lresolv
2545 @end example
2546
2547 @item
2548 Replace @code{gethostbyname} and friends in @file{libc.a} with more
2549 useful versions such as the ones in @file{libresolv.a}. Then relink
2550 Emacs.
2551
2552 @item
2553 If you are actually running NIS, make sure that "ypbind" is properly
2554 told to do DNS lookups with the correct command line switch.
2555
2556 @end itemize
2557
2558 @node Errors with init files, Emacs ignores X resources, Problems talking to certain hosts, Bugs and problems
2559 @section Why does Emacs say "Error in init file"?
2560 @cindex Error in @file{.emacs}
2561 @cindex Error in init file
2562 @cindex Init file, errors in
2563 @cindex @file{.emacs} file, errors in
2564 @cindex Debugging @file{.emacs} file
2565
2566 An error occurred while loading either your @file{.emacs} file or the
2567 system-wide file @file{lisp/default.el}.
2568
2569 For information on how to debug your @file{.emacs} file,
2570 @pxref{Debugging a customization file}.
2571
2572 It may be the case that you need to load some package first, or use a
2573 hook that will be evaluated after the package is loaded. A common case
2574 of this is explained in @ref{Terminal setup code works after Emacs has
2575 begun}.
2576
2577 @node Emacs ignores X resources, Emacs takes a long time to visit files, Errors with init files, Bugs and problems
2578 @section Why does Emacs ignore my X resources (my .Xdefaults file)?
2579 @cindex X resources being ignored
2580 @cindex Ignored X resources
2581 @cindex @file{.Xdefaults}
2582
2583 As of version 19, Emacs searches for X resources in the files specified
2584 by the following environment variables:
2585
2586 @itemize @bullet
2587
2588 @item @code{XFILESEARCHPATH}
2589 @item @code{XUSERFILESEARCHPATH}
2590 @item @code{XAPPLRESDIR}
2591
2592 @end itemize
2593
2594 This emulates the functionality provided by programs written using Xt.
2595
2596 @code{XFILESEARCHPATH} and @code{XUSERFILESEARCHPATH} should be a list
2597 of file names separated by colons. @code{XAPPLRESDIR} should be a list
2598 of directory names separated by colons.
2599
2600 Emacs searches for X resources:
2601
2602 @enumerate
2603
2604 @item specified on the command line, with the @samp{-xrm RESOURCESTRING} option,
2605 @item then in the value of the @samp{XENVIRONMENT} environment variable,
2606
2607 @itemize @minus
2608
2609 @item or if that is unset, in the file named @samp{~/.Xdefaults-HOSTNAME} if it exists (where @samp{HOSTNAME} is the hostname of the machine Emacs is running on),
2610
2611 @end itemize
2612
2613 @item then in the screen-specific and server-wide resource properties provided by the server,
2614
2615 @itemize @minus
2616
2617 @item or if those properties are unset, in the file named ~/.Xdefaults if it exists,
2618
2619 @end itemize
2620
2621 @item then in the files listed in @samp{XUSERFILESEARCHPATH},
2622
2623 @itemize @minus
2624
2625 @item or in files named @file{LANG/Emacs} in directories listed in @samp{XAPPLRESDIR} (where @samp{LANG} is the value of the @samp{LANG} environment variable), if the @samp{LANG} environment variable is set,
2626 @item or in files named Emacs in the directories listed in @samp{XAPPLRESDIR}
2627 @item or in @file{~/LANG/Emacs} (if the @samp{LANG} environment variable is set),
2628 @item or in @file{~/Emacs},
2629
2630 @end itemize
2631
2632 @item then in the files listed in @code{XFILESEARCHPATH}.
2633
2634 @end enumerate
2635
2636 @node Emacs takes a long time to visit files, Editing files with $ in the name, Emacs ignores X resources, Bugs and problems
2637 @section Why does Emacs take 20 seconds to visit a file?
2638 @cindex Visiting files takes a long time
2639 @cindex Delay when visiting files
2640 @cindex Files, take a long time to visit
2641
2642 Old versions of Emacs (i.e., versions before Emacs 20.x) often
2643 encountered this when the master lock file, @file{!!!SuperLock!!!} has
2644 been left in the lock directory somehow. Delete it.
2645
2646 @email{meuer@@geom.umn.edu, Mark Meuer} says that NeXT NFS has a bug
2647 where an exclusive create succeeds but returns an error status. This
2648 can cause the same problem. Since Emacs's file locking doesn't work
2649 over NFS anyway, the best solution is to recompile Emacs with
2650 @code{CLASH_DETECTION} undefined.
2651
2652 @node Editing files with $ in the name, Shell mode loses the current directory, Emacs takes a long time to visit files, Bugs and problems
2653 @section How do I edit a file with a @samp{$} in its name?
2654 @cindex Editing files with @samp{$} in the name
2655 @cindex @samp{$} in filenames
2656 @cindex Filenames containing @samp{$}, editing
2657
2658 When entering a filename in the minibuffer, Emacs will attempt to expand
2659 a @samp{$} followed by a word as an environment variable. To suppress
2660 this behavior, type @kbd{$$} instead.
2661
2662 @node Shell mode loses the current directory, Security risks with Emacs, Editing files with $ in the name, Bugs and problems
2663 @section Why does shell mode lose track of the shell's current directory?
2664 @cindex Current directory and @code{shell-mode}
2665 @cindex @code{shell-mode} and current directory
2666 @cindex Directory, current in @code{shell-mode}
2667
2668 Emacs has no way of knowing when the shell actually changes its
2669 directory. This is an intrinsic limitation of Unix. So it tries to
2670 guess by recognizing @samp{cd} commands. If you type "cd" followed by a
2671 directory name with a variable reference (@samp{cd $HOME/bin}) or with a
2672 shell metacharacter (@samp{cd ../lib*}), Emacs will fail to correctly
2673 guess the shell's new current directory. A huge variety of fixes and
2674 enhancements to shell mode for this problem have been written to handle
2675 this problem. Check the Lisp Code Directory (@pxref{Finding a package
2676 with particular functionality}).
2677
2678 You can tell Emacs the shell's current directory with the command
2679 @kbd{M-x dirs}.
2680
2681 @node Security risks with Emacs, Dired claims that no file is on this line, Shell mode loses the current directory, Bugs and problems
2682 @section Are there any security risks in Emacs?
2683 @cindex Security with Emacs
2684 @cindex @samp{movemail} and security
2685 @cindex @code{file-local-variable} and security
2686 @cindex Synthetic X events and security
2687 @cindex X events and security
2688
2689 @itemize @bullet
2690
2691 @item The @file{movemail} incident (No, this is not a risk.)
2692
2693 In his book @emph{The Cuckoo's Egg}, Cliff Stoll describes this in
2694 chapter 4. The site at LBL had installed the @file{etc/movemail}
2695 program setuid root. (As of version 19, @file{movemail} is in your
2696 architecture-specific directory; type @kbd{C-h v exec-directory
2697 @key{RET}} to see what it is.) Since @file{movemail} had not been
2698 designed for this situation, a security hole was created and users could
2699 get root privileges.
2700
2701 @file{movemail} has since been changed so that this security hole will
2702 not exist, even if it is installed setuid root. However,
2703 @file{movemail} no longer needs to be installed setuid root, which
2704 should eliminate this particular risk.
2705
2706 We have heard unverified reports that the 1988 Internet worm took
2707 advantage of this configuration problem.
2708
2709 @item The @code{file-local-variable} feature (Yes, a risk, but easy to change.)
2710
2711 There is an Emacs feature that allows the setting of local values for
2712 variables when editing a file by including specially formatted text near
2713 the end of the file. This feature also includes the ability to have
2714 arbitrary Emacs Lisp code evaluated when the file is visited.
2715 Obviously, there is a potential for Trojan horses to exploit this
2716 feature.
2717
2718 Emacs 18 allowed this feature by default; users could disable it by
2719 setting the variable @code{inhibit-local-variables} to a non-nil value.
2720
2721 As of Emacs 19, Emacs has a list of local variables that create a
2722 security risk. If a file tries to set one of them, it asks the user to
2723 confirm whether the variables should be set. You can also tell Emacs
2724 whether to allow the evaluation of Emacs Lisp code found at the bottom
2725 of files by setting the variable @code{enable-local-eval}.
2726
2727 For more information, @inforef{File Variables, File Variables, emacs}.
2728
2729 @item Synthetic X events (Yes, a risk; use @samp{MIT-MAGIC-COOKIE-1} or better.)
2730
2731 Emacs accepts synthetic X events generated by the SendEvent request as
2732 though they were regular events. As a result, if you are using the
2733 trivial host-based authentication, other users who can open X
2734 connections to your X workstation can make your Emacs process do
2735 anything, including run other processes with your privileges.
2736
2737 The only fix for this is to prevent other users from being able to open
2738 X connections. The standard way to prevent this is to use a real
2739 authentication mechanism, such as @samp{MIT-MAGIC-COOKIE-1}. If using
2740 the @file{xauth} program has any effect, then you are probably using
2741 @samp{MIT-MAGIC-COOKIE-1}. Your site may be using a superior
2742 authentication method; ask your system administrator.
2743
2744 If real authentication is not a possibility, you may be satisfied by
2745 just allowing hosts access for brief intervals while you start your X
2746 programs, then removing the access. This reduces the risk somewhat by
2747 narrowing the time window when hostile users would have access, but
2748 @emph{does not eliminate the risk}.
2749
2750 On most computers running Unix and X Windows, you enable and disable
2751 access using the @file{xhost} command. To allow all hosts access to
2752 your X server, use
2753
2754 @example
2755 xhost +
2756 @end example
2757
2758 at the shell prompt, which (on an HP machine, at least) produces the
2759 following message:
2760
2761 @example
2762 access control disabled, clients can connect from any host
2763 @end example
2764
2765 To deny all hosts access to your X server (except those explicitly
2766 allowed by name), use
2767
2768 @example
2769 xhost -
2770 @end example
2771
2772 On the test HP computer, this command generated the following message:
2773
2774 @example
2775 access control enabled, only authorized clients can connect
2776 @end example
2777
2778 @end itemize
2779
2780 @node Dired claims that no file is on this line, , Security risks with Emacs, Bugs and problems
2781 @section Dired says, "no file on this line" when I try to do something.
2782 @cindex Dired does not see a file
2783
2784 Chances are you're using a localized version of Unix that doesn't use US
2785 date format in dired listings. You can check this by looking at dired
2786 listings or by typing @code{ls -l} to a shell and looking at the dates that
2787 come out.
2788
2789 Dired uses a regular expression to find the beginning of a file name.
2790 In a long Unix-style directory listing ("ls -l"), the file name starts
2791 after the date. The regexp has thus been written to look for the date,
2792 the format of which can vary on non-US systems.
2793
2794 There are two approaches to solving this. The first one involves
2795 setting things up so that "ls -l" outputs US date format. This can be
2796 done by setting the locale. See your OS manual for more information.
2797
2798 The second approach involves changing the regular expression used by
2799 dired, @code{dired-move-to-filename-regexp}.
2800
2801 @c ------------------------------------------------------------
2802 @node Compiling and installing Emacs, Finding Emacs and related packages, Bugs and problems, Top
2803 @chapter Compiling and installing Emacs
2804 @cindex Compiling and installing Emacs
2805
2806 @menu
2807 * Installing Emacs::
2808 * Updating Emacs::
2809 * Problems building Emacs::
2810 * Linking with -lX11 fails::
2811 @end menu
2812
2813 @node Installing Emacs, Updating Emacs, Compiling and installing Emacs, Compiling and installing Emacs
2814 @section How do I install Emacs?
2815 @cindex Installing Emacs
2816 @cindex Unix systems, installing Emacs on
2817 @cindex Downloading and installing Emacs
2818 @cindex Retrieving and installing Emacs
2819 @cindex Building Emacs from source
2820 @cindex Source code, building Emacs from
2821 @cindex Unpacking and installing Emacs
2822
2823 This answer is meant for users of Unix and Unix-like systems. Users of
2824 other operating systems should see the series of questions beginning
2825 with @ref{Emacs for MS-DOS}, which describe where to get non-Unix source
2826 and binaries. These packages should come with installation
2827 instructions.
2828
2829 For Unix and Unix-like systems, the easiest way is often to compile it
2830 from scratch. You will need:
2831
2832 @itemize @bullet
2833
2834 @item
2835 Emacs sources. @xref{Current GNU distributions}, for a list of ftp sites
2836 that make them available. On @file{ftp.gnu.org}, the main GNU
2837 distribution site, sources are available at
2838
2839 @uref{ftp://ftp.gnu.org/pub/gnu/emacs/emacs-20.5.tar.gz}
2840
2841 The above will obviously change as new versions of Emacs come out. For
2842 instance, when Emacs 21 is released, it will most probably be
2843 available at
2844
2845 @uref{ftp://ftp.gnu.org/pub/gnu/emacs/emacs-21.1.tar.gz}
2846
2847 Again, you should use one of the GNU mirror sites (@xref{Current GNU
2848 distributions}, and adjust the URL accordingly) so as to reduce load on
2849 @file{ftp.gnu.org}.
2850
2851 @item
2852 @code{gzip}, the GNU compression utility. You can get @code{gzip} via
2853 anonymous ftp at mirrors of @file{ftp.gnu.org} sites; it should compile
2854 and install without much trouble on most systems. Once you have
2855 retrieved the Emacs sources, you will probably be able to uncompress
2856 them with the command
2857
2858 @example
2859 gunzip --verbose emacs-20.5.tar.gz
2860 @end example
2861
2862 changing the Emacs version (20.5), as necessary. Once gunzip has
2863 finished doing its job, a file by the name of "emacs-20.5.tar" should
2864 be in your build directory.
2865
2866 @item
2867 @file{tar}, the "tape archiving" program, which moves multiple files
2868 into and out of archive files, or "tarfiles." All of the files
2869 comprising the Emacs source come in a single tarfile, and must be
2870 extracted using @file{tar} before you can build Emacs. Typically, the
2871 extraction command would look like
2872
2873 @example
2874 tar -xvvf emacs-20.5.tar
2875 @end example
2876
2877 The @samp{x} indicates that we want to extract files from this tarfile,
2878 the two @samp{v}s force verbose output, and the @samp{f} tells
2879 @file{tar} to use a disk file, rather than one on tape.
2880
2881 If you're using GNU @file{tar} (available at mirrors of
2882 @file{ftp.gnu.org}), you can combine this step and the previous one by
2883 using the command
2884
2885 @example
2886 tar -zxvvf emacs-20.5.tar.gz
2887 @end example
2888
2889 The additional @samp{z} at the beginning of the options list tells GNU tar
2890 to uncompress the file with gunzip before extracting the tarfile's
2891 components.
2892
2893 @end itemize
2894
2895 At this point, the Emacs sources (all 25+ megabytes of them) should be
2896 sitting in a directory called @file{emacs-20.5}. On most common Unix and
2897 Unix-like systems, you should be able to compile Emacs (with X Windows
2898 support) with the following commands:
2899
2900 @example
2901 cd emacs-20.5 # change directory to emacs-20.5
2902 ./configure # configure Emacs for your particular system
2903 make # use Makefile to build components, then Emacs
2904 @end example
2905
2906 If the @code{make} completes successfully, the odds are fairly good that
2907 the build has gone well. (@pxref{Problems building Emacs} if you weren't
2908 successful.)
2909
2910 By default, Emacs is installed in the following directories:
2911
2912 @table @file
2913
2914 @item /usr/local/bin
2915 binaries
2916
2917 @item /usr/local/share/emacs/20.xx
2918 Lisp code and support files
2919
2920 @item /usr/local/info
2921 Info documentation
2922
2923 @end table
2924
2925 To install files in those default directories, become the superuser and
2926 type
2927
2928 @example
2929 make install
2930 @end example
2931
2932 Note that @code{make install} will overwrite @file{/usr/local/bin/emacs}
2933 and any Emacs Info files that might be in @file{/usr/local/info}.
2934
2935 Much more verbose instructions (with many more hints and suggestions)
2936 come with the Emacs sources, in the file @file{INSTALL}.
2937
2938 @node Updating Emacs, Problems building Emacs, Installing Emacs, Compiling and installing Emacs
2939 @section How do I update Emacs to the latest version?
2940 @cindex Updating Emacs
2941
2942 @xref{Installing Emacs}, and follow the instructions there for
2943 installation.
2944
2945 Most files are placed in version-specific directories. Emacs 20.5, for
2946 instance, places files in @file{/usr/local/share/emacs/20.5}.
2947
2948 Upgrading should overwrite only, @file{/usr/local/bin/emacs} (the Emacs
2949 binary) and documentation in @file{/usr/local/info}. Back up these
2950 files before you upgrade, and you shouldn't have too much trouble.
2951
2952 @node Problems building Emacs, Linking with -lX11 fails, Updating Emacs, Compiling and installing Emacs
2953 @section What should I do if I have trouble building Emacs?
2954 @cindex Problems building Emacs
2955 @cindex Errors when building Emacs
2956
2957 First look in the file @file{PROBLEMS} (in the top-level directory when
2958 you unpack the Emacs source) to see if there is already a solution for
2959 your problem. Next, look for other questions in this FAQ that have to
2960 do with Emacs installation and compilation problems.
2961
2962 If you'd like to have someone look at your problem and help solve it,
2963 @pxref{Help installing Emacs}.
2964
2965 If you cannot find a solution in the documentation, send a message to
2966 @email{bug-gnu-emacs@@gnu.org}.
2967
2968 Please do not post it to @uref{news:gnu.emacs.help} or send e-mail to
2969 @email{help-gnu-emacs@@gnu.org}. For further guidelines,
2970 @pxref{Guidelines for newsgroup postings} and @ref{Reporting bugs}.
2971
2972 @node Linking with -lX11 fails, , Problems building Emacs, Compiling and installing Emacs
2973 @section Why does linking Emacs with -lX11 fail?
2974 @cindex Linking with -lX11 fails
2975 @cindex lX11, linking fails with
2976
2977 Emacs needs to be linked with the static version of the X11 library,
2978 @file{libX11.a}. This may be missing.
2979
2980 Under OpenWindows, you may need to use "add_services" to add the
2981 "OpenWindows Programmers" optional software category from the CD-ROM.
2982
2983 Under HP-UX 8.0, you may need to run "update" again to load the X11-PRG
2984 "fileset". This may be missing even if you specified "all filesets" the
2985 first time. If @file{libcurses.a} is missing, you may need to load the
2986 "Berkeley Development Option."
2987
2988 @email{zoo@@armadillo.com, David Zuhn} says that MIT X builds shared
2989 libraries by default, and only shared libraries, on those platforms that
2990 support them. These shared libraries can't be used when undumping
2991 temacs (the last stage of the Emacs build process). To get regular
2992 libraries in addition to shared libraries, add this to @file{site.cf}:
2993
2994 @example
2995 #define ForceNormalLib YES
2996 @end example
2997
2998 Other systems may have similar problems. You can always define
2999 CANNOT_DUMP and link with the shared libraries instead.
3000
3001 To get the Xmenu stuff to work, you need to find a copy of MIT's
3002 @file{liboldX.a}.
3003
3004 @c ------------------------------------------------------------
3005 @node Finding Emacs and related packages, Major packages and programs, Compiling and installing Emacs, Top
3006 @chapter Finding Emacs and related packages
3007 @cindex Finding Emacs and related packages
3008
3009 @menu
3010 * Finding Emacs on the Internet::
3011 * Finding a package with particular functionality::
3012 * Packages that do not come with Emacs::
3013 * Submitting to the Emacs Lisp Archive::
3014 * Current GNU distributions::
3015 * Difference between Emacs and XEmacs::
3016 * Emacs for MS-DOS::
3017 * Emacs for Windows::
3018 * Emacs for OS/2::
3019 * Emacs for Atari ST::
3020 * Emacs for the Amiga ::
3021 * Emacs for NeXTSTEP::
3022 * Emacs for Apple computers::
3023 * Emacs for VMS and DECwindows::
3024 * Modes for various languages::
3025 * Translating names to IP addresses::
3026 @end menu
3027
3028 @node Finding Emacs on the Internet, Finding a package with particular functionality, Finding Emacs and related packages, Finding Emacs and related packages
3029 @section Where can I get Emacs on the net (or by snail mail)?
3030 @cindex Finding Emacs on the Internet
3031 @cindex Snail mail, ordering Emacs via
3032 @cindex Postal service, ordering Emacs via
3033 @cindex Distribution, retrieving Emacs
3034 @cindex Internet, retreiving from
3035
3036 Look in the files @file{etc/DISTRIB} and @file{etc/FTP} for information
3037 on nearby archive sites and @file{etc/ORDERS} for mail orders. If you
3038 don't already have Emacs, @pxref{Informational files for Emacs} for how
3039 to get these files.
3040
3041 @xref{Installing Emacs}, for information on how to obtain and build the latest
3042 version of Emacs, and @pxref{Current GNU distributions} for a list of
3043 archive sites that make GNU software available.
3044
3045 @node Finding a package with particular functionality, Packages that do not come with Emacs, Finding Emacs on the Internet, Finding Emacs and related packages
3046 @section How do I find a Emacs Lisp package that does XXX?
3047 @cindex Package, finding
3048 @cindex Finding an Emacs Lisp package
3049 @cindex Functionality, finding a particular package
3050
3051 First of all, you should check to make sure that the package isn't
3052 already available. For example, typing @kbd{M-x apropos @key{RET}
3053 wordstar @key{RET}} lists all functions and variables containing the
3054 string @samp{wordstar}.
3055
3056 It is also possible that the package is on your system, but has not been
3057 loaded. To see which packages are available for loading, look through
3058 your computer's lisp directory (@pxref{Filename conventions}). The Lisp
3059 source to most most packages contains a short description of how they
3060 should be loaded, invoked, and configured --- so before you use or
3061 modify a Lisp package, see if the author has provided any hints in the
3062 source code.
3063
3064 If a package does not come with Emacs, check the Lisp Code Directory.
3065 The LCD was originally maintained by @email{brennan@@hal.com, Dave
3066 Brennan}, but was recently taken over by @email{toby@@world.std.com,
3067 toby knudsen}, who maintains @uref{http://www.emacs.org}. The LCD is
3068 currently being reorganized and updated, but you can meanwhile find many
3069 packages at @uref{ftp://ftp.emacs.org/pub}.
3070
3071 For now, you can search through the LCD with @file{lispdir.el}, which is
3072 in the process of being updated. Download it from the LCD, in the
3073 @file{emacs-lisp-attic/misc} directory, and then evaluate the following
3074 Lisp form (@pxref{Evaluating Emacs Lisp code}):
3075
3076 @lisp
3077 (setq lisp-code-directory
3078 "/anonymous@@ftp.emacs.org:pub/emacs-lisp-attic/emacs-lisp/LCD-datafile.gz"
3079 elisp-archive-host "ftp.emacs.org"
3080 elisp-archive-directory "/pub/emacs-lisp-attic/emacs-lisp/")
3081 @end lisp
3082
3083 Once you have installed @file{lispdir.el}, you can use @kbd{M-x
3084 lisp-dir-apropos} to search the listing. For example, @kbd{M-x
3085 lisp-dir-apropos @key{RET} ange-ftp @key{RET}} produces this output:
3086
3087 @example
3088 GNU Emacs Lisp Code Directory Apropos --- "ange-ftp"
3089 "~/" refers to archive.cis.ohio-state.edu:pub/elisp-archive/
3090
3091 ange-ftp (4.18) 15-Jul-1992
3092 Andy Norman, <ange@@hplb.hpl.hp.com>
3093 ~/packages/ange-ftp.tar.Z
3094 transparent FTP Support for GNU Emacs
3095 auto-save (1.19) 01-May-1992
3096 Sebastian Kremer, <sk@@thp.uni-koeln.de>
3097 ~/misc/auto-save.el.Z
3098 Safer autosaving with support for ange-ftp and /tmp
3099 ftp-quik (1.0) 28-Jul-1993
3100 Terrence Brannon, <tb06@@pl122f.eecs.lehigh.edu>
3101 ~/modes/ftp-quik.el.Z
3102 Quik access to dired'ing of ange-ftp and normal paths
3103 @end example
3104
3105 @node Packages that do not come with Emacs, Submitting to the Emacs Lisp Archive, Finding a package with particular functionality, Finding Emacs and related packages
3106 @section Where can I get Emacs Lisp packages that don't come with Emacs?
3107 @cindex Unbundled packages
3108 @cindex Finding other packages
3109 @cindex Lisp packages that do not come with Emacs
3110 @cindex Packages, those that do not come with Emacs
3111 @cindex Emacs Lisp Archive, description of
3112 @cindex Archive, description of the Emacs Lisp
3113
3114 First, check the Lisp Code Directory to find the name of the package you
3115 are looking for (@pxref{Finding a package with particular
3116 functionality}). Next, check local archives and the Emacs Lisp Archive
3117 to find a copy of the relevant files. If you still haven't found it,
3118 you can send e-mail to the author asking for a copy. If you find Emacs
3119 Lisp code that doesn't appear in the LCD, please submit a copy to the
3120 LCD (@pxref{Submitting to the Emacs Lisp Archive}).
3121
3122 You can access the Emacs Lisp Archive at
3123
3124 @uref{ftp://archive.cis.ohio-state.edu/pub/emacs-lisp/}
3125
3126 Retrieve and read the file @file{README} first.
3127
3128 @itemize @bullet
3129
3130 @item The archive maintainers do not have time to answer individual
3131 requests for packages or the list of packages in the archive. If you
3132 cannot use FTP or UUCP to access the archive yourself, try to find a
3133 friend who can, but please don't ask the maintainers.
3134
3135 @item Any files with names ending in @samp{.Z}, @samp{.z}, or @samp{.gz} are
3136 compressed, so you should use "binary" mode in FTP to retrieve them.
3137 You should also use binary mode whenever you retrieve any files with
3138 names ending in @samp{.elc}.
3139
3140 @end itemize
3141
3142 @node Submitting to the Emacs Lisp Archive, Current GNU distributions, Packages that do not come with Emacs, Finding Emacs and related packages
3143 @section How do I submit code to the Emacs Lisp Archive?
3144 @cindex Submitting code to the Emacs Lisp Archive
3145 @cindex Emacs Lisp Archive, submissions to
3146 @cindex Lisp Archive, submissions to
3147 @cindex Archive, submitting to the Emacs Lisp
3148
3149 Guidelines and procedures for submission to the archive can be found in
3150 the file @file{GUIDELINES} in the archive directory (@ref{Packages that
3151 do not come with Emacs}). It covers documentation, copyrights,
3152 packaging, submission, and the Lisp Code Directory Record. Anonymous
3153 FTP uploads are not permitted. Instead, all submissions are mailed to
3154 @email{elisp-archive@@cis.ohio-state.edu}. The @file{lispdir.el}
3155 package has a function named @code{submit-lcd-entry} which will help you
3156 with this.
3157
3158 @node Current GNU distributions, Difference between Emacs and XEmacs, Submitting to the Emacs Lisp Archive, Finding Emacs and related packages
3159 @section Where can I get other up-to-date GNU stuff?
3160 @cindex Current GNU distributions
3161 @cindex Sources for current GNU distributions
3162 @cindex Stuff, current GNU
3163 @cindex Up-to-date GNU stuff
3164 @cindex Finding current GNU software
3165 @cindex Official GNU software sites
3166
3167 The most up-to-date official GNU software is normally kept at
3168
3169 @uref{ftp://ftp.gnu.org/pub/gnu}
3170
3171 Read the files @file{etc/DISTRIB} and @file{etc/FTP} for more
3172 information.
3173
3174 A list of sites mirroring @samp{ftp.gnu.org} can be found at
3175
3176 @uref{http://www.gnu.org/order/ftp.html}
3177
3178 @node Difference between Emacs and XEmacs, Emacs for MS-DOS, Current GNU distributions, Finding Emacs and related packages
3179 @section What is the difference between Emacs and XEmacs (formerly "Lucid Emacs")?
3180 @cindex XEmacs
3181 @cindex Difference Emacs and XEmacs
3182 @cindex Lucid Emacs
3183 @cindex Epoch
3184
3185 First of all, they're both GNU Emacs. XEmacs is just as much a later
3186 version of GNU Emacs as the FSF-distributed version. This FAQ refers to
3187 the latest version to be distributed by the FSF as "Emacs," partly
3188 because the XEmacs maintainers now refer to their product using the
3189 "XEmacs" name, and partly because there isn't any accurate way to
3190 differentiate between the two without getting mired in paragraphs of
3191 legalese and history.
3192
3193 XEmacs, which began life as Lucid Emacs, is based on an early version of
3194 Emacs 19 and Epoch, an X-aware version of Emacs 18.
3195
3196 Emacs (i.e., the version distributed by the FSF) has a larger installed
3197 base and now always contains the MULE multilingual facilities.
3198 XEmacs can do some clever tricks with X Windows, such as
3199 putting arbitrary graphics in a buffer. Similar facilities have been
3200 implemented for Emacs as part of a new redisplay implementation for
3201 Emacs 21, expected to be released after Emacs 20.5.
3202 Emacs and XEmacs each come with
3203 Lisp packages that are lacking in the other; RMS says that the FSF would
3204 include more packages that come with XEmacs, but that the XEmacs
3205 maintainers don't always keep track of the authors of contributed code,
3206 which makes it impossible for the FSF to have certain legal papers
3207 signed. (Without these legal papers, the FSF will not distribute Lisp
3208 packages with Emacs.) The two versions have some
3209 significant differences at the Lisp programming level.
3210
3211 Many XEmacs features have found their way into recent versions of Emacs,
3212 and more features can be expected in the future, but there are still many
3213 differences between the two.
3214
3215 @node Emacs for MS-DOS, Emacs for Windows, Difference between Emacs and XEmacs, Finding Emacs and related packages
3216 @section Where can I get Emacs for my PC running MS-DOS?
3217 @cindex MS-DOS, Emacs for
3218 @cindex DOS, Emacs for
3219 @cindex Compiling Emacs for DOS
3220 @cindex Emacs for MS-DOS
3221 @cindex Tools needed to compile Emacs under DOS
3222
3223 A pre-built binary distribution of Emacs is available from the Simtel
3224 archives. This version apparently works under MS-DOS and Windows (3.x,
3225 95x, and NT) and supports long file names under Windows 9x. More
3226 information is available from
3227
3228 @uref{ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/emacs.README}
3229
3230 The binary itself is available in the files em1934*.zip in the
3231 directory
3232
3233 @uref{ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/}
3234
3235 If you prefer to compile Emacs for yourself, you can do so with the
3236 current distribution directly. You will need a 386 (or
3237 better) processor, and to be running MS-DOS 3.0 or later. According to
3238 @email{eliz@@is.elta.co.il, Eli Zaretskii} and
3239 @email{hankedr@@dms.auburn.edu, Darrel Hankerson}, you will need the
3240 following:
3241
3242 @table @emph
3243
3244 @item Compiler
3245 djgpp version 1.12 maint 1 or later. Djgpp 2.0 or later is
3246 recommended, since 1.x is being phased out. Djgpp 2 supports
3247 long filenames under Windows 9x.
3248
3249 You can get the latest release of djgpp by retrieving all of
3250 the files in
3251
3252 @uref{ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp}
3253
3254 @item Gunzip and tar
3255 The easiest way is to use "djtar" which comes with djgpp v2.x,
3256 because it can open gzip'ed tarfiles (i.e., those ending with
3257 ".tar.gz") in one step. Djtar comes in "djdev201.zip", from
3258 the URL mentioned above.
3259
3260 @item make, mv, sed, and rm
3261 All of these utilities are available at
3262
3263 @uref{ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu}
3264
3265 16-bit utilities can be found in GNUish, at
3266
3267 @uref{ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish}
3268
3269 @end table
3270
3271 The files @file{INSTALL} and @file{PROBLEMS} in the top-level directory
3272 of the Emacs source contains some additional information regarding Emacs
3273 under MS-DOS.
3274
3275 For a list of other MS-DOS implementations of Emacs (and Emacs
3276 look-alikes), consult the list of "Emacs implementations and literature,"
3277 available at
3278
3279 @uref{ftp://rtfm.mit.edu/pub/usenet/comp.emacs/}
3280
3281 Note that while many of these programs look similar to Emacs, they often
3282 lack certain features, such as the Emacs Lisp extension language.
3283
3284 @node Emacs for Windows, Emacs for OS/2, Emacs for MS-DOS, Finding Emacs and related packages
3285 @section Where can I get Emacs for Microsoft Windows
3286 @cindex FAQ for NT Emacs
3287 @cindex Microsoft Windows, Emacs for
3288 @cindex Windows NT, Emacs for
3289 @cindex Windows '95 and '98, Emacs for
3290
3291 For information on Emacs for Windows 95 and NT, read the FAQ produced by
3292 @email{voelker@@cs.washington.edu, Geoff Voelker}, available at
3293
3294 @uref{http://www.gnu.org/software/emacs/windows/ntemacs.html}
3295
3296 @xref{Emacs for MS-DOS}, for Windows 3.1.
3297
3298 @node Emacs for OS/2, Emacs for Atari ST, Emacs for Windows, Finding Emacs and related packages
3299 @section Where can I get Emacs for my PC running OS/2?
3300 @cindex OS/2, Emacs for
3301
3302 Emacs 19.33 is ported for emx on OS/2 2.0 or 2.1, and is available at
3303
3304 @uref{ftp://hobbes.nmsu.edu/pub/os2/apps/editors/emacs/v19.33/}
3305
3306 @node Emacs for Atari ST, Emacs for the Amiga , Emacs for OS/2, Finding Emacs and related packages
3307 @section Where can I get Emacs for my Atari ST?
3308 @cindex Atari ST, Emacs for
3309 @cindex TOS, Emacs for
3310
3311 Roland Schäuble reports that Emacs 18.58 running on plain TOS and MiNT
3312 is available at
3313 @uref{ftp://atari.archive.umich.edu/Editors/Emacs-18-58/1858b-d3.zoo}.
3314
3315 @node Emacs for the Amiga , Emacs for NeXTSTEP, Emacs for Atari ST, Finding Emacs and related packages
3316 @section Where can I get Emacs for my Amiga?
3317 @cindex Amiga, Emacs for
3318
3319 The files you need are available at
3320
3321 @uref{ftp://ftp.wustl.edu/pub/aminet/util/gnu/}
3322
3323 @email{dgilbert@@gamiga.guelphnet.dweomer.org, David Gilbert} has released a
3324 beta version of Emacs 19.25 for the Amiga. You can get the binary at
3325
3326 @uref{ftp://ftp.wustl.edu/pub/aminet/util/gnu/a2.0bEmacs-bin.lha}
3327
3328 @node Emacs for NeXTSTEP, Emacs for Apple computers, Emacs for the Amiga , Finding Emacs and related packages
3329 @section Where can I get Emacs for NeXTSTEP?
3330 @cindex NeXTSTEP, Emacs for
3331
3332 Emacs.app is a NeXTSTEP version of Emacs 19.34 which supports colors,
3333 menus, and multiple frames. You can get it from
3334
3335 @uref{ftp://next-ftp.peak.org/pub/next/apps/emacs/Emacs_for_NeXTstep.4.20a1.NIHS.b.tar.gz}
3336
3337 @node Emacs for Apple computers, Emacs for VMS and DECwindows, Emacs for NeXTSTEP, Finding Emacs and related packages
3338 @section Where can I get Emacs for my Apple computer?
3339 @cindex Apple computers, Emacs for
3340
3341 An unofficial port of GNU Emacs 18.59 to the Macintosh is available at a
3342 number of ftp sites, the home being
3343 @uref{ftp://ftp.cs.cornell.edu/pub/parmet/Emacs-1.17.sit.bin}.
3344
3345 A port of Emacs 20.4 is available at
3346 @uref{http://www.cs.hku.hk/~choi/emacs/index.html}.
3347
3348 Apple's forthcoming "OS X" is based largely on NeXTSTEP and OpenStep.
3349 @xref{Emacs for NeXTSTEP}, for more details about that version.
3350
3351 @node Emacs for VMS and DECwindows, Modes for various languages, Emacs for Apple computers, Finding Emacs and related packages
3352 @section Where do I get Emacs that runs on VMS under DECwindows?
3353 @cindex DECwindows, Emacs for
3354 @cindex VMS, Emacs for
3355
3356 Up-to-date information about GNU software (including Emacs) for VMS is
3357 available at @uref{http://vms.gnu.org/}.
3358
3359 @node Modes for various languages, Translating names to IP addresses, Emacs for VMS and DECwindows, Finding Emacs and related packages
3360 @section Where can I get modes for Lex, Yacc/Bison, Bourne shell, csh, C++, Objective-C, Pascal, Java, and Awk?
3361 @cindex Awk, mode for
3362 @cindex @code{awk-mode}
3363 @cindex Bison, mode for
3364 @cindex Bourne Shell, mode for
3365 @cindex C++, mode for
3366 @cindex Java, mode for
3367 @cindex Lex mode
3368 @cindex Objective-C, mode for
3369 @cindex @code{pascal-mode}
3370 @cindex Shell mode
3371 @cindex Yacc mode
3372 @cindex @file{csh} mode
3373 @cindex @code{sh-mode}
3374 @cindex @code{cc-mode}
3375
3376 Most of these modes are now available in standard Emacs distribution.
3377 To get additional modes, look in the Lisp Code Directory (@pxref{Finding
3378 a package with particular functionality}). For C++, if you use
3379 @code{lisp-dir-apropos}, you must specify the pattern with something
3380 like @kbd{M-x lisp-dir-apropos @key{RET} c\+\+ @key{RET}}.
3381
3382 Barry Warsaw's @code{cc-mode} now works for C, C++, Objective-C, and
3383 Java code. You can get the latest version from the Emacs Lisp Archive;
3384 @pxref{Packages that do not come with Emacs} for details. A FAQ for
3385 @code{cc-mode} is available at
3386 @uref{http://www.python.org/emacs/cc-mode/}.
3387
3388 @node Translating names to IP addresses, , Modes for various languages, Finding Emacs and related packages
3389 @section What is the IP address of XXX.YYY.ZZZ?
3390 @cindex Translating names to IP addresses
3391 @cindex IP addresses from names
3392 @cindex Using BIND to translate addresses
3393 @cindex DNS and IP addresses
3394
3395 If you are on a Unix machine, try using the @samp{nslookup} command,
3396 included in the Berkeley BIND package. For example, to find the IP
3397 address of @samp{ftp.gnu.org}, you would type @code{nslookup
3398 ftp.gnu.org}.
3399
3400 Your computer should then provide the IP address of that computer.
3401
3402 If your site's nameserver is deficient, you can use IP addresses to FTP
3403 files. You can get this information by
3404
3405 * E-mail:
3406
3407 @example
3408 To: dns@@[134.214.84.25] (to grasp.insa-lyon.fr)
3409 Body: ip XXX.YYY.ZZZ (or "help" for more information
3410 and options - no quotes)
3411 @end example
3412
3413 or:
3414
3415 @example
3416 To: resolve@@[147.31.254.130] (to laverne.cs.widener.edu)
3417 Body: site XXX.YYY.ZZZ
3418 @end example
3419
3420 @c ------------------------------------------------------------
3421 @node Major packages and programs, Key bindings, Finding Emacs and related packages, Top
3422 @chapter Major packages and programs
3423 @cindex Major packages and programs
3424
3425 @menu
3426 * VM::
3427 * Supercite::
3428 * Calc::
3429 * VIPER::
3430 * AUC-TeX::
3431 * BBDB::
3432 * Ispell::
3433 * w3-mode::
3434 * EDB::
3435 * Mailcrypt::
3436 * JDE::
3437 * Patch::
3438 @end menu
3439
3440 @node VM, Supercite, Major packages and programs, Major packages and programs
3441 @section VM (View Mail) --- another mail reader within Emacs, with MIME support
3442 @cindex VM
3443 @cindex Alternative mail software
3444 @cindex View Mail
3445 @cindex E-mail reader, VM
3446
3447 @table @b
3448
3449 @item Author
3450 @email{kyle@@uunet.uu.net, Kyle Jones}
3451
3452 @item Latest version
3453 6.72
3454
3455 @item Distribution
3456 @uref{ftp://ftp.wonderworks.com/pub/vm/vm.tar.gz}
3457
3458 @item Informational newsgroup/mailing list
3459 @uref{news:gnu.emacs.vm.info}@*
3460 Subscription requests to @email{info-vm-request@@uunet.uu.net}@*
3461 Submissions to @email{info-vm@@uunet.uu.net}
3462
3463 @item Bug reports newsgroup/mailing list
3464 @uref{news:gnu.emacs.vm.bug}@*
3465 Subscription requests to @email{bug-vm-request@@uunet.uu.net}@*
3466 Submissions to @email{bug-vm@@uunet.uu.net}
3467 @end table
3468
3469 VM 6 works with Emacs 20.4, and may cause problems with Emacs 20.3 and
3470 below. (Note that many people seem to use Emacs 20.3 with VM 6, without
3471 any problems.) Risk-averse users might wish to try VM 5.97, available
3472 from @uref{ftp://ftp.wonderworks.com/pub/vm/, the same FTP site}.
3473
3474 @node Supercite, Calc, VM, Major packages and programs
3475 @section Supercite --- mail and news citation package within Emacs
3476 @cindex Supercite
3477 @cindex Superyank
3478 @cindex Mail and news citations
3479 @cindex News and mail citations
3480 @cindex Citations in mail and news
3481
3482 @table @b
3483
3484 @item Author
3485 @email{bwarsaw@@cen.com, Barry Warsaw}
3486
3487 @item Latest version
3488 3.1 (comes with Emacs 20)
3489
3490 @item Distribution
3491 @uref{http://www.python.org/emacs/supercite.tar.gz}
3492
3493 @item Mailing list
3494 Subscription requests to @email{supercite-request@@python.org}@*
3495 Submissions @email{supercite@@python.org}
3496
3497 @end table
3498
3499 Superyank is an old version of Supercite.
3500
3501 @node Calc, VIPER, Supercite, Major packages and programs
3502 @section Calc --- poor man's Mathematica within Emacs
3503 @cindex Programmable calculator
3504 @cindex Calc
3505
3506 @table @b
3507
3508 @item Author
3509 @email{daveg@@csvax.cs.caltech.edu, Dave Gillespie}
3510
3511 @item Latest version
3512 2.02f
3513
3514 @item Distribution
3515 @uref{ftp://ftp.gnu.org/pub/gnu/calc/calc-2.02f.tar.gz}
3516
3517 @end table
3518
3519 @node VIPER, AUC-TeX, Calc, Major packages and programs
3520 @section VIPER --- vi emulation for Emacs
3521 @cindex vi emulation
3522 @cindex VIPER
3523 @cindex Emulation of vi
3524
3525 Since Emacs 19.29, the preferred vi emulation in Emacs is VIPER
3526 (@kbd{M-x viper-mode @key{RET}}), which comes with Emacs. It extends
3527 and supersedes VIP (including VIP 4.3) and provides vi emulation at
3528 several levels, from one that closely follows vi to one that departs
3529 from vi in several significant ways.
3530
3531 For Emacs 19.28 and earlier, the following version of VIP is generally
3532 better than the one distributed with Emacs:
3533
3534 @table @b
3535 @item Author
3536 @email{sane@@cs.uiuc.edu, Aamod Sane}
3537
3538 @item Latest version
3539 4.3
3540
3541 @item Distribution
3542 @uref{ftp://archive.cis.ohio-state.edu/pub/emacs-lisp/modes/vip-mode.tar.Z}
3543
3544 @end table
3545
3546 @node AUC-TeX, BBDB, VIPER, Major packages and programs
3547 @section AUC TeX --- enhanced LaTeX mode with debugging facilities
3548 @cindex Mode for @TeX{}
3549 @cindex @TeX{} mode
3550 @cindex AUC-TeX mode for editing @TeX{}
3551 @cindex Writing and debugging @TeX{}
3552
3553 @table @b
3554
3555 @item Authors
3556 @email{krab@@iesd.auc.dk, Kresten Krab Thorup} and@*
3557 @email{abraham@@iesd.auc.dk, Per Abrahamsen}
3558
3559 @item Latest version
3560 9.9p
3561
3562 @item Distribution
3563 @uref{ftp://sunsite.auc.dk/packages/auctex/auctex.tar.gz}
3564
3565 @item Web site
3566 @uref{http://sunsite.auc.dk/auctex/}
3567
3568 @item Mailing list:
3569 Subscription requests to @email{auc-tex-request@@iesd.auc.dk}@*
3570 Submissions to @email{auc-tex@@iesd.auc.dk}@*
3571 Development team is at @email{auc-tex_mgr@@iesd.auc.dk}
3572
3573 @end table
3574
3575 @node BBDB, Ispell, AUC-TeX, Major packages and programs
3576 @section BBDB --- personal Info Rolodex integrated with mail/news readers
3577 @cindex BBDB
3578 @cindex Rolodex-like functionality
3579 @cindex Integrated contact database
3580 @cindex Contact database
3581 @cindex Big Brother Database
3582 @cindex Address book
3583
3584 @table @b
3585
3586 @item Maintainer
3587 @email{simmonmt@@acm.org, Matt Simmons}
3588
3589 @item Latest version
3590 2.00
3591
3592 @item Distribution
3593 @uref{http://www.netcom.com/~simmonmt/bbdb/index.html}
3594
3595 @item Mailing lists
3596 Subscription requests to @email{info-bbdb-request@@xemacs.org}@*
3597 Submissions to @email{info-bbdb@@xemacs.org}@*
3598 Release announcements: @email{bbdb-announce-request@@xemacs.org}
3599
3600 @end table
3601
3602 @node Ispell, w3-mode, BBDB, Major packages and programs
3603 @section Ispell --- spell checker in C with interface for Emacs
3604 @cindex Spell-checker
3605 @cindex Checking spelling
3606 @cindex Ispell
3607
3608 @table @b
3609
3610 @item Author
3611 @email{geoff@@itcorp.com, Geoff Kuenning}
3612
3613 @item Latest version
3614 3.1.20
3615
3616 @item Distribution
3617 @uref{ftp://ftp.cs.ucla.edu/pub/ispell/ispell-3.1.20.tar.gz}@*
3618
3619 @item Web site
3620 @uref{http://fmg-www.cs.ucla.edu/geoff/ispell.html}
3621
3622 @end table
3623
3624 @itemize @bullet
3625
3626 @item Do not ask Geoff to send you the latest version of Ispell. He does not have free e-mail.
3627
3628 @item This Ispell program is distinct from GNU Ispell 4.0. GNU Ispell
3629 4.0 is no longer a supported product.
3630
3631 @end itemize
3632
3633 @node w3-mode, EDB, Ispell, Major packages and programs
3634 @section w3-mode --- A World Wide Web browser inside of Emacs
3635 @cindex WWW browser
3636 @cindex Web browser
3637 @cindex Browser in Emacs
3638 @cindex @code{w3-mode}
3639
3640 @table @b
3641
3642 @item Author
3643 @email{wmperry@@spry.com, Bill Perry}
3644
3645 @item Latest version
3646 4.0pre.39
3647
3648 @item Distribution
3649 @uref{ftp://ftp.cs.indiana.edu/pub/elisp/w3/w3.tar.gz}
3650
3651 @item Mailing lists
3652 Receive announcements from @email{w3-announce-request@@indiana.edu}@*
3653 Become a beta tester at @email{w3-beta-request@@indiana.edu}@*
3654 Help to develop @code{w3-mode} at @email{w3-dev@@indiana.edu}
3655
3656 @end table
3657
3658 @node EDB, Mailcrypt, w3-mode, Major packages and programs
3659 @section EDB --- Database program for Emacs; replaces forms editing modes
3660 @cindex EDB
3661 @cindex Database
3662 @cindex Forms mode
3663
3664 @table @b
3665 @item Author
3666 @email{mernst@@theory.lcs.mit.edu, Michael Ernst}
3667
3668 @item Latest version
3669 1.21
3670
3671 @item Distribution
3672 @uref{ftp://theory.lcs.mit.edu/pub/emacs/edb}
3673
3674 @end table
3675
3676 @node Mailcrypt, JDE, EDB, Major packages and programs
3677 @section Mailcrypt --- PGP interface within Emacs mail and news
3678 @cindex PGP
3679 @cindex GPG
3680 @cindex Interface to PGP from Emacs mail and news
3681 @cindex News, interface to PGP from
3682 @cindex Mail, interface to PGP from
3683 @cindex Encryption software, interface to
3684
3685 @table @b
3686
3687 @item Authors
3688 @email{patl@@lcs.mit.edu, Patrick J. LoPresti} and @email{jin@@atype.com, Jin S. Choi}
3689
3690 @item Maintainer
3691 @email{lbudney@@pobox.com, Len Budney}
3692
3693 @item Latest version
3694 3.5.3
3695
3696 @item Distribution
3697 @uref{http://www.nb.net/~lbudney/linux/software/mailcrypt/mailcrypt-3.5.3.tar.gz}
3698
3699 @item Web site
3700 @uref{http://www.nb.net/~lbudney/linux/software/mailcrypt.html}
3701
3702 @end table
3703
3704 @node JDE, Patch, Mailcrypt, Major packages and programs
3705 @section JDE --- Integrated development environment for Java
3706 @cindex Java development environment
3707 @cindex Integrated Java development environment
3708 @cindex JDE
3709
3710 @table @b
3711
3712 @item Author
3713 @email{paulk@@mathworks.com, Paul Kinnucan}
3714
3715 @item Mailing list
3716 jde-subscribe@@sunsite.auc.dk
3717
3718 @item Latest version
3719 2.1.1
3720
3721 @item Web site
3722 @uref{http://sunsite.auc.dk/jde/}
3723
3724 @end table
3725
3726 @node Patch, , JDE, Major packages and programs
3727 @section Patch --- program to apply "diffs" for updating files
3728 @cindex Updating files with diffs
3729 @cindex Patching source files with diffs
3730 @cindex Diffs and patching
3731 @cindex @file{patch}
3732
3733 @table @b
3734
3735 @item Author
3736 @email{lwall@@wall.org, Larry Wall} (with GNU modifications)
3737
3738 @item Latest version
3739 2.5
3740
3741 @item Distribution
3742 @xref{Current GNU distributions}.
3743
3744 @end table
3745
3746 @c ------------------------------------------------------------
3747 @node Key bindings, Alternate character sets, Major packages and programs, Top
3748 @chapter Key bindings
3749 @cindex Key bindings
3750
3751 @menu
3752 * Binding keys to commands::
3753 * Invalid prefix characters::
3754 * Terminal setup code works after Emacs has begun::
3755 * Using function keys under X::
3756 * Working with function and arrow keys::
3757 * X key translations for Emacs::
3758 * Handling C-s and C-q with flow control::
3759 * Binding C-s and C-q::
3760 * Backspace invokes help::
3761 * stty and Backspace key::
3762 * Swapping keys::
3763 * Producing C-XXX with the keyboard::
3764 * No Meta key::
3765 * No Escape key::
3766 * Compose Character::
3767 * Binding combinations of modifiers and function keys::
3768 * Meta key does not work in xterm::
3769 * ExtendChar key does not work as Meta::
3770 @end menu
3771
3772 @node Binding keys to commands, Invalid prefix characters, Key bindings, Key bindings
3773 @section How do I bind keys (including function keys) to commands?
3774 @cindex Binding keys to commands
3775 @cindex Keys, binding to commands
3776 @cindex Commands, binding keys to
3777
3778 Keys can be bound to commands either interactively or in your
3779 @file{.emacs} file. To interactively bind keys for all modes, type
3780 @kbd{M-x global-set-key @key{RET} KEY CMD @key{RET}}.
3781
3782 To bind a key just in the current major mode, type @kbd{M-x local-set-key @key{RET} KEY CMD @key{RET}}.
3783
3784 See @inforef{Key Bindings, Key Bindings, emacs} for further details.
3785
3786 To bind keys on starting Emacs or on starting any given mode, use the
3787 following "trick": First bind the key interactively, then immediately
3788 type @kbd{C-x @key{ESC} @key{ESC} C-a C-k C-g}. Now, the command needed
3789 to bind the key is in the kill ring, and can be yanked into your
3790 @file{.emacs} file. If the key binding is global, no changes to the
3791 command are required. For example,
3792
3793 @lisp
3794 (global-set-key (quote [f1]) (quote help-for-help))
3795 @end lisp
3796
3797 can be placed directly into the @file{.emacs} file. If the key binding is
3798 local, the command is used in conjunction with the "add-hook" command.
3799 For example, in tex-mode, a local binding might be
3800
3801 @lisp
3802 (add-hook 'tex-mode-hook
3803 (function (lambda ()
3804 (local-set-key (quote [f1]) (quote help-for-help)))))
3805 @end lisp
3806
3807
3808 @itemize @bullet
3809
3810 @item Control characters in key sequences, in the form yanked from the
3811 kill ring are given in their graphic form --- i.e., @key{CTRL} is shown
3812 as @samp{^}, @key{TAB} as a set of spaces (usually 8), etc. You may
3813 want to convert these into their vector or string forms.
3814
3815 @item If a prefix key of the character sequence to be bound is already
3816 bound as a complete key, then you must unbind it before the new
3817 binding. For example, if "ESC @{" is previously bound:
3818
3819 @lisp
3820 (global-unset-key [?\e ?@{]) ;; or
3821 (local-unset-key [?\e ?@{])
3822 @end lisp
3823
3824 @item Aside from commands and "lambda lists," a vector or string also
3825 can be bound to a key and thus treated as a macro. For example:
3826
3827 @lisp
3828 (global-set-key [f10] [?\C-x?\e?\e?\C-a?\C-k?\C-g]) ;; or
3829 (global-set-key [f10] "\C-x\e\e\C-a\C-k\C-g")
3830 @end lisp
3831
3832 @end itemize
3833
3834 @node Invalid prefix characters, Terminal setup code works after Emacs has begun, Binding keys to commands, Key bindings
3835 @section Why does Emacs say "Key sequence XXX uses invalid prefix characters"?
3836 @cindex Prefix characters, invalid
3837 @cindex Invalid prefix characters
3838 @cindex Misspecified key sequences
3839
3840 Usually, one of two things has happened. In one case, the control
3841 character in the key sequence has been misspecified (e.g. @samp{C-f}
3842 used instead of @samp{\C-f} within a Lisp expression). In the other
3843 case, a "prefix key" in the keystroke sequence you were trying to bind
3844 was already bound as a "complete key." Historically, the @samp{ESC [}
3845 prefix was usually the problem, in which case you should evaluate either
3846 of these forms before attempting to bind the key sequence:
3847
3848 @lisp
3849 (global-unset-key [?\e ?[]) ;; or
3850 (global-unset-key "\e[")
3851 @end lisp
3852
3853 @node Terminal setup code works after Emacs has begun, Using function keys under X, Invalid prefix characters, Key bindings
3854 @section Why doesn't this [terminal or window-system setup] code work in my @file{.emacs} file, but it works just fine after Emacs starts up?
3855 @cindex Terminal setup code in @file{.emacs}
3856
3857 During startup, Emacs initializes itself according to a given code/file
3858 order. If some of the code executed in your @file{.emacs} file needs to
3859 be postponed until the initial terminal or window-system setup code has
3860 been executed but is not, then you will experience this problem (this
3861 code/file execution order is not enforced after startup).
3862
3863 To postpone the execution of Emacs Lisp code until after terminal or
3864 window-system setup, treat the code as a "lambda list" and set the value
3865 of either the @code{term-setup-hook} or @code{window-setup-hook}
3866 variable to this "lambda function." For example,
3867
3868 @lisp
3869 (setq term-setup-hook
3870 (function
3871 (lambda ()
3872 (cond ((string-match "\\`vt220" (or (getenv "TERM") ""))
3873 ;; Make vt220's "Do" key behave like M-x:
3874 (global-set-key [do] 'execute-extended-command))
3875 ))))
3876 @end lisp
3877
3878 For information on what Emacs does every time it is started, see the
3879 @file{lisp/startup.el} file.
3880
3881 @node Using function keys under X, Working with function and arrow keys, Terminal setup code works after Emacs has begun, Key bindings
3882 @section How do I use function keys under X Windows?
3883 @cindex Function keys
3884 @cindex X Windows and function keys
3885 @cindex Binding function keys
3886
3887 With Emacs 19, functions keys under X are bound like any other key. @xref{Binding keys to commands}, for details.
3888
3889 @node Working with function and arrow keys, X key translations for Emacs, Using function keys under X, Key bindings
3890 @section How do I tell what characters or symbols my function or arrow keys emit?
3891 @cindex Working with arrow keys
3892 @cindex Arrow keys, symbols generated by
3893 @cindex Working with function keys
3894 @cindex Function keys, symbols generated by
3895 @cindex Symbols generated by function keys
3896
3897 Type @kbd{C-h c} then the function or arrow keys. The command will
3898 return either a function key symbol or character sequence (see the
3899 Emacs on-line documentation for an explanation). This works for other
3900 keys as well.
3901
3902 @node X key translations for Emacs, Handling C-s and C-q with flow control, Working with function and arrow keys, Key bindings
3903 @section How do I set the X key "translations" for Emacs?
3904 @cindex X key translations
3905 @cindex Key translations under X
3906 @cindex Translations for keys under X
3907
3908 Emacs is not written using the Xt library by default, so there are no
3909 "translations" to be set. (We aren't sure how to set such translations
3910 if you do build Emacs with Xt; please let us know if you've done this!)
3911
3912 The only way to affect the behavior of keys within Emacs is through
3913 "xmodmap" (outside Emacs) or @code{define-key} (inside Emacs). The
3914 @code{define-key} command should be used in conjunction with the
3915 @code{function-key-map} map. For instance,
3916
3917 @lisp
3918 (define-key function-key-map [M-@key{TAB}] [?\M-\t])
3919 @end lisp
3920
3921 defines the @kbd{M-@key{TAB}} key sequence.
3922
3923 @node Handling C-s and C-q with flow control, Binding C-s and C-q, X key translations for Emacs, Key bindings
3924 @section How do I handle @kbd{C-s} and @kbd{C-q} being used for flow control?
3925 @cindex Flow control, @kbd{C-s} and @kbd{C-q} with
3926 @cindex @kbd{C-s} and @kbd{C-q} with flow control
3927
3928 @kbd{C-s} and @kbd{C-q} are used in the XON/XOFF flow control protocol.
3929 This messes things up when you're using Emacs, because Emacs binds these
3930 keys to commands by default. Because Emacs won't honor them as flow
3931 control characters, too many of these characters are not passed on and
3932 overwhelm output buffers. Sometimes, intermediate software using
3933 XON/XOFF flow control will prevent Emacs from ever seeing @kbd{C-s} and
3934 @kbd{C-q}.
3935
3936 Possible solutions:
3937
3938 @itemize @bullet
3939
3940 @item Disable the use of @kbd{C-s} and @kbd{C-q} for flow control.
3941
3942 You need to determine the cause of the flow control.
3943
3944 @itemize @minus
3945
3946 @item your terminal
3947
3948 Your terminal may use XON/XOFF flow control to have time to display
3949 all the characters it receives. For example, VT series terminals do
3950 this. It may be possible to turn this off from a setup menu. For
3951 example, on a VT220 you may select "No XOFF" in the setup menu. This
3952 is also true for some terminal emulation programs on PCs.
3953
3954 When you turn off flow control at the terminal, you will also need to
3955 turn it off at the other end, which might be at the computer you are
3956 logged in to or at some terminal server in between.
3957
3958 If you turn off flow control, characters may be lost; using a printer
3959 connected to the terminal may fail. You may be able to get around
3960 this problem by modifying the "termcap" entry for your terminal to
3961 include extra NUL padding characters.
3962
3963 @item a modem
3964
3965 If you are using a dialup connection, the modems may be using
3966 XON/XOFF flow control. It's not clear how to get around this.
3967
3968 @item a router or terminal server
3969
3970 Some network box between the terminal and your computer may be using
3971 XON/XOFF flow control. It may be possible to make it use some other
3972 kind of flow control. You will probably have to ask your local
3973 network experts for help with this.
3974
3975 @item tty and/or pty devices
3976
3977 If your connection to Emacs goes through multiple tty and/or pty
3978 devices, they may be using XON/XOFF flow control even when it is not
3979 necessary.
3980
3981 @email{eirik@@theory.tn.cornell.edu, Eirik Fuller} writes:
3982
3983 @quotation
3984 Some versions of "rlogin" (and possibly telnet) do not pass flow
3985 control characters to the remote system to which they connect. On
3986 such systems, Emacs on the remote system cannot disable flow
3987 control on the local system. Sometimes "rlogin -8" will avoid this
3988 problem.
3989
3990 One way to cure this is to disable flow control on the local host
3991 (the one running rlogin, not the one running rlogind) using the
3992 stty command, before starting the rlogin process. On many systems,
3993 @samp{stty start u stop u} will do this.
3994
3995 Some versions of @samp{tcsh} will prevent even this from working. One
3996 way around this is to start another shell before starting rlogin,
3997 and issue the @samp{stty} command to disable flow control from that shell.
3998 @end quotation
3999
4000 Use @samp{stty -ixon} instead of @samp{stty start u stop u} on some systems.
4001
4002 @end itemize
4003
4004 @item Make Emacs speak the XON/XOFF flow control protocol.
4005
4006 You can make Emacs treat @kbd{C-s} and @kbd{C-q} as flow control characters by
4007 evaluating the form
4008
4009 @lisp
4010 (enable-flow-control)
4011 @end lisp
4012
4013 to unconditionally enable flow control or
4014
4015 @lisp
4016 (enable-flow-control-on "vt100" "h19")
4017 @end lisp
4018
4019 (using your terminal names instead of @samp{vt100} or @samp{h19}) to
4020 enable selectively. These commands will automatically swap @kbd{C-s}
4021 and @kbd{C-q} to @kbd{C-\} and @kbd{C-^}. Variables can be used to
4022 change the default swap keys (@code{flow-control-c-s-replacement} and
4023 @code{flow-control-c-q-replacement}).
4024
4025 If you are fixing this for yourself, simply put the form in your
4026 @file{.emacs} file. If you are fixing this for your entire site, the
4027 best place to put it is in the @file{lisp/site-start.el} file. Putting
4028 this form in @file{lisp/default.el} has the problem that if the user's
4029 @file{.emacs} file has an error, this will prevent
4030 @file{lisp/default.el} from being loaded and Emacs may be unusable for
4031 the user, even for correcting their @file{.emacs} file (unless they're
4032 smart enough to move it to another name).
4033
4034 @end itemize
4035
4036 For further discussion of this issue, read the file @file{PROBLEMS} (in
4037 the top-level directory when you unpack the Emacs source).
4038
4039 @node Binding C-s and C-q, Backspace invokes help, Handling C-s and C-q with flow control, Key bindings
4040 @section How do I bind @kbd{C-s} and @kbd{C-q} (or any key) if these keys are filtered out?
4041 @cindex Binding @kbd{C-s} and @kbd{C-q}
4042 @cindex @kbd{C-s} and @kbd{C-q}, binding
4043
4044 To bind @kbd{C-s} and @kbd{C-q}, use either @code{enable-flow-control}
4045 or @sc{enable-flow-control-on}. @xref{Handling C-s and C-q with flow
4046 control}, for usage and implementation details.
4047
4048 To bind other keys, use @code{keyboard-translate}. @xref{Swapping keys},
4049 for usage details. To do this for an entire site, you should swap the
4050 keys in @file{lisp/site-start.el}. @xref{Handling C-s and C-q with flow
4051 control}, for an explanation of why @file{lisp/default.el} should not be
4052 used.
4053
4054 @itemize @bullet
4055
4056 @item If you do this for an entire site, the users will be confused by
4057 the disparity between what the documentation says and how Emacs
4058 actually behaves.
4059
4060 @end itemize
4061
4062 @node Backspace invokes help, stty and Backspace key, Binding C-s and C-q, Key bindings
4063 @section Why does the @key{Backspace} key invoke help?
4064 @cindex Backspace key invokes help
4065 @cindex Help invoked by Backspace
4066
4067 The @key{Backspace} key (on most keyboards) generates ASCII code 8.
4068 @kbd{C-h} sends the same code. In Emacs by default @kbd{C-h} invokes
4069 help-command. This is intended to be easy to remember since the first
4070 letter of @samp{help} is @samp{h}. The easiest solution to this problem
4071 is to use @kbd{C-h} (and @key{Backspace}) for help and @key{DEL} (the
4072 @key{Delete} key) for deleting the previous character.
4073
4074 For many people this solution may be problematic:
4075
4076 @itemize @bullet
4077
4078 @item
4079 They normally use @key{Backspace} outside of Emacs for deleting the
4080 previous character. This can be solved by making @key{DEL} the command
4081 for deleting the previous character outside of Emacs. On many Unix
4082 systems, this command will remap @key{DEL}:
4083
4084 @example
4085 stty erase `^?'
4086 @end example
4087
4088 @item
4089 The person may prefer using the @key{Backspace} key for deleting the
4090 previous character because it is more conveniently located on their
4091 keyboard or because they don't even have a separate Delete key. In
4092 this case, the @key{Backspace} key should be made to behave like
4093 @key{Delete}. There are several methods.
4094
4095 @item
4096 Some terminals (e.g., VT3## terminals) allow the character generated
4097 by the @key{Backspace} key to be changed from a setup menu.
4098
4099 @item
4100 You may be able to get a keyboard that is completely programmable.
4101
4102 @item
4103 Under X or on a dumb terminal, it is possible to swap the
4104 @key{Backspace} and @key{Delete} keys inside Emacs:
4105
4106 @lisp
4107 (keyboard-translate ?\C-h ?\C-?)
4108 @end lisp
4109
4110 @xref{Swapping keys}, for further details of "keyboard-translate".
4111
4112 @item
4113 Another approach is to switch key bindings and put help on @kbd{C-x h}
4114 instead:
4115
4116 @lisp
4117 (global-set-key "\C-h" 'delete-backward-char)
4118
4119 ;;; overrides mark-whole-buffer
4120 (global-set-key "\C-xh" 'help-command)
4121 @end lisp
4122
4123 Other popular key bindings for help are @kbd{M-?} and @kbd{C-x ?}.
4124
4125 Don't try to bind @key{DEL} to @code{help-command}, because there are
4126 many modes that have local bindings of @key{DEL} that will interfere.
4127
4128 @end itemize
4129
4130 @node stty and Backspace key, Swapping keys, Backspace invokes help, Key bindings
4131 @section Why doesn't Emacs look at the @file{stty} settings for @key{Backspace} vs. @key{Delete}?
4132 @cindex @file{stty} and Emacs
4133 @cindex Backspace and @file{stty}
4134 @cindex Delete and @file{stty}
4135
4136 Good question!
4137
4138 @node Swapping keys, Producing C-XXX with the keyboard, stty and Backspace key, Key bindings
4139 @section How do I swap two keys?
4140 @cindex Swapping keys
4141 @cindex Keys, swapping
4142 @cindex @code{keyboard-translate}
4143
4144 In Emacs 19, you can swap two keys (or key sequences) by using the
4145 @code{keyboard-translate} function. For example, to turn @kbd{C-h} into
4146 @key{DEL} and @key{DEL} to @kbd{C-h}, use
4147
4148 @lisp
4149 (keyboard-translate ?\C-h ?\C-?) ; translate `C-h' to DEL
4150 (keyboard-translate ?\C-? ?\C-h) ; translate DEL to `C-h'.
4151 @end lisp
4152
4153 The first key sequence of the pair after the function identifies what is
4154 produced by the keyboard; the second, what is matched for in the
4155 keymaps.
4156
4157 Keyboard translations are not the same as key bindings in keymaps.
4158 Emacs contains numerous keymaps that apply in different situations, but
4159 there is only one set of keyboard translations, and it applies to every
4160 character that Emacs reads from the terminal. Keyboard translations
4161 take place at the lowest level of input processing; the keys that are
4162 looked up in keymaps contain the characters that result from keyboard
4163 translation.
4164
4165 @inforef{Keyboard Translations, Keyboard Translations, emacs}.
4166
4167 @node Producing C-XXX with the keyboard, No Meta key, Swapping keys, Key bindings
4168 @section How do I produce C-XXX with my keyboard?
4169 @cindex Producing control characters
4170 @cindex Generating control characters
4171 @cindex Control characters, generating
4172
4173 On terminals (but not under X), some common "aliases" are:
4174
4175 @table @asis
4176
4177 @item @kbd{C-2} or @kbd{C-@key{SPC}}
4178 @kbd{C-@@}
4179
4180 @item @kbd{C-6}
4181 @kbd{C-^}
4182
4183 @item @kbd{C-7} or @kbd{C-S--}
4184 @kbd{C-_}
4185
4186 @item @kbd{C-4}
4187 @kbd{C-\}
4188
4189 @item @kbd{C-5}
4190 @kbd{C-]}
4191
4192 @item @kbd{C-/}
4193 @kbd{C-?}
4194
4195 @end table
4196
4197 Often other aliases exist; use the @kbd{C-h c} command and try
4198 @key{CTRL} with all of the digits on your keyboard to see what gets
4199 generated. You can also try the @kbd{C-h w} command if you know the
4200 name of the command.
4201
4202 @node No Meta key, No Escape key, Producing C-XXX with the keyboard, Key bindings
4203 @section What if I don't have a @key{Meta} key?
4204 @cindex No @key{Meta} key
4205 @cindex @key{Meta} key, what to do if you lack it
4206
4207 Instead of typing @kbd{M-a}, you can type @kbd{@key{ESC} a}. In fact,
4208 Emacs converts @kbd{M-a} internally into @kbd{@key{ESC} a} anyway
4209 (depending on the value of @code{meta-prefix-char}). Note that you
4210 press @key{Meta} and @key{a} together, while you press @kbd{ESC},
4211 release it, and then press @key{a}.
4212
4213 @node No Escape key, Compose Character, No Meta key, Key bindings
4214 @section What if I don't have an @key{Escape} key?
4215 @cindex No Escape key
4216 @cindex Lacking an Escape key
4217 @cindex Escape key, lacking
4218
4219 Type @kbd{C-[} instead. This should send ASCII code 27 just like an
4220 Escape key would. @kbd{C-3} may also work on some terminal (but not
4221 under X). For many terminals (notably DEC terminals) @key{F11}
4222 generates @key{ESC}. If not, the following form can be used to bind it:
4223
4224 @lisp
4225 ;;; F11 is the documented ESC replacement on DEC terminals.
4226 (define-key function-key-map [f11] [?\e])
4227 @end lisp
4228
4229 @node Compose Character, Binding combinations of modifiers and function keys, No Escape key, Key bindings
4230 @section Can I make my @key{Compose Character} key behave like a @key{Meta} key?
4231 @cindex @key{Compose Character} key, using as @key{Meta}
4232 @cindex @key{Meta}, using @key{Compose Character} for
4233
4234 On a dumb terminal such as a VT220, no. It is rumored that certain
4235 VT220 clones could have their @key{Compose} key configured this way. If
4236 you're using X, you might be able to do this with the @file{xmodmap} program.
4237
4238 @node Binding combinations of modifiers and function keys, Meta key does not work in xterm, Compose Character, Key bindings
4239 @section How do I bind a combination of modifier key and function key?
4240 @cindex Modifiers and function keys
4241 @cindex Function keys and modifiers
4242 @cindex Binding modifiers and function keys
4243
4244 With Emacs 19 you can represent modified function keys in vector format
4245 by adding prefixes to the function key symbol. For example (from the
4246 on-line documentation):
4247
4248 @lisp
4249 (global-set-key [?\C-x right] 'forward-page)
4250 @end lisp
4251
4252 where @samp{?\C-x} is the Lisp character constant for the character @kbd{C-x}.
4253
4254 You can use the modifier keys @key{Control}, @key{Meta}, @key{Hyper},
4255 @key{Super}, @key{Alt}, and @key{Shift} with function keys. To
4256 represent these modifiers, prepend the strings @samp{C-}, @samp{M-},
4257 @samp{H-}, @samp{s-}, @samp{A-}, and @samp{S-} to the symbol name. Here
4258 is how to make @kbd{H-M-RIGHT} move forward a word:
4259
4260 @lisp
4261 (global-set-key [H-M-right] 'forward-word)
4262 @end lisp
4263
4264 @itemize @bullet
4265
4266 @item Not all modifiers are permitted in all situations. @key{Hyper},
4267 @key{Super}, and @key{Alt} are available only under X (provided there
4268 are such keys). Non-ASCII keys and mouse events (e.g. @kbd{C-=} and
4269 @kbd{mouse-1}) also fall under this category.
4270
4271 @end itemize
4272
4273 @xref{Binding keys to commands}, for general key binding instructions.
4274
4275 @node Meta key does not work in xterm, ExtendChar key does not work as Meta, Binding combinations of modifiers and function keys, Key bindings
4276 @section Why doesn't my @key{Meta} key work in an xterm window?
4277 @cindex @key{Meta} key and xterm
4278 @cindex Xterm and @key{Meta} key
4279
4280 Try all of these methods before asking for further help:
4281
4282 @itemize @bullet
4283
4284 @item
4285 You may have big problems using @file{mwm} as your window manager.
4286 (Does anyone know a good generic solution to allow the use of the
4287 @key{Meta} key in Emacs with @file{mwm}?)
4288
4289 @item
4290 For X11: Make sure it really is a @key{Meta} key. Use @file{xev} to
4291 find out what keysym your @key{Meta} key generates. It should be either
4292 @key{Meta}_L or @key{Meta}_R. If it isn't, use @file{xmodmap} to fix
4293 the situation.
4294
4295 @item
4296 Make sure the pty the xterm is using is passing 8 bit characters.
4297 @samp{stty -a} (or @samp{stty everything}) should show @samp{cs8} somewhere.
4298 If it shows @samp{cs7} instead, use @samp{stty cs8 -istrip} (or @samp{stty
4299 pass8}) to fix it.
4300
4301 @item
4302 If there is an rlogin connection between the xterm and the Emacs, the
4303 "-8" argument may need to be given to rlogin to make it pass all 8 bits
4304 of every character.
4305
4306 @item
4307 If the Emacs is running under Ultrix, it is reported that evaluating
4308 @code{(set-input-mode t nil)} helps.
4309
4310 @item
4311 If all else fails, you can make xterm generate @kbd{@key{ESC} W} when
4312 you type @kbd{M-W}, which is the same conversion Emacs would make if it
4313 got the @kbd{M-W} anyway. In X11R4, the following resource
4314 specification will do this:
4315
4316 @example
4317 XTerm.VT100.EightBitInput: false
4318 @end example
4319
4320 (This changes the behavior of the @code{insert-eight-bit} action.)
4321
4322 With older xterms, you can specify this behavior with a translation:
4323
4324 @example
4325 XTerm.VT100.Translations: #override \
4326 Meta<KeyPress>: string(0x1b) insert()
4327 @end example
4328
4329 You might have to replace @samp{Meta} with @samp{Alt}.
4330
4331 @end itemize
4332
4333 @node ExtendChar key does not work as Meta, , Meta key does not work in xterm, Key bindings
4334 @section Why doesn't my @key{ExtendChar} key work as a @key{Meta} key under HP-UX 8.0 and 9.x?
4335 @cindex @key{ExtendChar} key as @key{Meta}
4336 @cindex @key{Meta}, using @key{ExtendChar} for
4337
4338 This is a result of an internationalization extension in X11R4 and the
4339 fact that HP is now using this extension. Emacs assumes that
4340 XLookupString returns the same result regardless of the @key{Meta} key
4341 state which is no longer necessarily true. Until Emacs is fixed, the
4342 temporary kludge is to run this command after each time the X server is
4343 started but preferably before any xterm clients are:
4344
4345 @example
4346 xmodmap -e 'remove mod1 = Mode_switch'
4347 @end example
4348
4349 This will disable the use of the extra keysyms systemwide, which may be
4350 undesirable if you actually intend to use them.
4351
4352 @c ------------------------------------------------------------
4353 @node Alternate character sets, Mail and news, Key bindings, Top
4354 @chapter Alternate character sets
4355 @cindex Alternate character sets
4356
4357 @menu
4358 * Emacs does not display 8-bit characters::
4359 * Inputting eight-bit characters::
4360 * Kanji and Chinese characters::
4361 * Right-to-left alphabets::
4362 @end menu
4363
4364 @node Emacs does not display 8-bit characters, Inputting eight-bit characters, Alternate character sets, Alternate character sets
4365 @section How do I make Emacs display 8-bit characters?
4366 @cindex Displaying eight-bit characters
4367 @cindex Eight-bit characters, displaying
4368
4369 Emacs 19 has built-in support for eight-bit characters. See
4370 @inforef{European Display, European Display, emacs}, from which this
4371 excerpt is taken:
4372
4373 @quotation
4374 Some European languages use accented letters and other special symbols.
4375 The ISO 8859 Latin-1 character set defines character codes for many
4376 European languages in the range 160 to 255.
4377
4378 Emacs can display those characters according to Latin-1, provided the
4379 terminal or font in use supports them. The @kbd{M-x
4380 standard-display-european} command toggles European character display
4381 mode. With a numeric argument, @kbd{M-x standard-display-european}
4382 enables European character display if and only if the argument is
4383 positive.
4384
4385 Some operating systems let you specify the language you are using by
4386 setting a locale. Emacs handles one common special case of this: if
4387 your locale name for character types contains the string "8859-1" or
4388 "88591", Emacs automatically enables European character display mode
4389 when it starts up.
4390 @end quotation
4391
4392 @node Inputting eight-bit characters, Kanji and Chinese characters, Emacs does not display 8-bit characters, Alternate character sets
4393 @section How do I input eight-bit characters?
4394 @cindex Entering eight-bit characters
4395 @cindex Eight-bit characters, entering
4396
4397 @inforef{European Display, European Display, emacs}, from which this is
4398 taken:
4399
4400 @quotation
4401 If you enter non-ASCII ISO Latin-1 characters often, you might find ISO
4402 Accents mode convenient. When this minor mode is enabled, @key{`},
4403 @key{'}, @key{"}, @key{^}, @key{/} and @key{~} modify the following
4404 letter by adding the corresponding diacritical mark to it, if possible.
4405 To enable or disable ISO Accents mode, use the command @kbd{M-x
4406 iso-accents-mode}. This command affects only the current buffer.
4407
4408 To enter one of those six special characters, type the character,
4409 followed by a space. Some of those characters have a corresponding
4410 "dead key" accent character in the ISO Latin-1 character set; to enter
4411 that character, type the corresponding ASCII character twice. For
4412 example, @kbd{''} enters the Latin-1 character acute-accent (character
4413 code 0264).
4414 @end quotation
4415
4416 @node Kanji and Chinese characters, Right-to-left alphabets, Inputting eight-bit characters, Alternate character sets
4417 @section Where can I get an Emacs that handles kanji, Chinese, or other character sets?
4418 @cindex Kanji, handling with Emacs
4419 @cindex Chinese, handling with Emacs
4420 @cindex Japanese, handling with Emacs
4421 @cindex Korean, handling with Emacs
4422
4423 Emacs 20 now includes many of the features of MULE, the Multilingual
4424 Enhancement of Emacs. @xref{Installing Emacs}, for information on where
4425 to find and download Emacs.
4426
4427 @node Right-to-left alphabets, , Kanji and Chinese characters, Alternate character sets
4428 @section Where is an Emacs that can handle Semitic (right-to-left) alphabets?
4429 @cindex Right-to-left alphabets
4430 @cindex Hebrew, handling with Emacs
4431 @cindex Semitic alphabets
4432
4433 Emacs 20 supports Hebrew characters (ISO 8859-8), but does not yet
4434 support right-to-left character entry.
4435
4436 @email{joel@@exc.com, Joel M. Hoffman} has written a Lisp package called
4437 @file{hebrew.el} that allows right-to-left editing of Hebrew. It
4438 reportedly works out of the box with Emacs 19, but requires patches for
4439 Emacs 18. Write to Joel if you want the patches or package.
4440
4441 @file{hebrew.el} requires a Hebrew screen font, but no other Hardware support.
4442 Joel has a screen font for PCs running MS-DOS and Linux.
4443
4444 You might also try to query archie for files named with "hebrew";
4445 several ftp sites in Israel may also have the necessary files.
4446
4447 @c ------------------------------------------------------------
4448 @node Mail and news, Concept index, Alternate character sets, Top
4449 @chapter Mail and news
4450 @cindex Mail and news
4451
4452 @menu
4453 * Changing the included text prefix::
4454 * Saving a copy of outgoing mail::
4455 * Expanding aliases when sending mail::
4456 * Rmail thinks all messages are one big one::
4457 * Sorting the messages in an Rmail folder::
4458 * Rmail writes to /usr/spool/mail::
4459 * Recovering mail files when Rmail munges them::
4460 * Replying to the sender of a message::
4461 * MIME with Emacs mail packages::
4462 * Automatically starting a mail or news reader::
4463 * Reading news with Emacs::
4464 * Gnus does not work with NNTP::
4465 * Viewing articles with embedded underlining::
4466 * Saving a multi-part Gnus posting::
4467 * Starting Gnus faster::
4468 * Catching up in all newsgroups::
4469 * Killing based on nonstandard headers::
4470 * Removing flashing messages::
4471 * Catch-up is slow in Gnus::
4472 * Gnus hangs for a long time::
4473 * Learning more about Gnus::
4474 @end menu
4475
4476 @node Changing the included text prefix, Saving a copy of outgoing mail, Mail and news, Mail and news
4477 @section How do I change the included text prefix in mail/news followups?
4478 @cindex Prefix in mail/news followups, changing
4479 @cindex Included text prefix, changing
4480 @cindex Setting the included text character
4481
4482 If you read mail with Rmail or news with Gnus, set the variable
4483 @code{mail-yank-prefix}. For VM, set @code{vm-included-text-prefix}.
4484 For mh-e, set @code{mh-ins-buf-prefix}.
4485
4486 For fancier control of citations, use Supercite. @xref{Supercite}.
4487
4488 To prevent Emacs from including various headers of the replied-to
4489 message, set the value of @code{mail-yank-ignored-headers} to an
4490 appropriate regexp.
4491
4492 @node Saving a copy of outgoing mail, Expanding aliases when sending mail, Changing the included text prefix, Mail and news
4493 @section How do I save a copy of outgoing mail?
4494 @cindex Saving a copy of outgoing mail
4495 @cindex Copying outgoing mail to a file
4496 @cindex Filing outgoing mail
4497 @cindex Automatic filing of outgoing mail
4498 @cindex Mail, saving outgoing automatically
4499
4500 You can either mail yourself a copy by including a @samp{BCC} header in the
4501 mail message, or store a copy of the message directly to a file by
4502 including an @samp{FCC} header.
4503
4504 If you use standard mail, you can automatically create a @samp{BCC} to
4505 yourself by putting
4506
4507 @lisp
4508 (setq mail-self-blind t)
4509 @end lisp
4510
4511 in your @file{.emacs} file. You can automatically include an "FCC:" field by
4512 putting something like the following in your @file{.emacs} file:
4513
4514 @lisp
4515 (setq mail-archive-file-name (expand-file-name "~/outgoing"))
4516 @end lisp
4517
4518 The output file will be in Unix mail format, which can be read directly
4519 by VM, but not always by Rmail. @xref{Learning how to do something}.
4520
4521 If you use @code{mh-e}, add an @samp{FCC} or @samp{BCC} field to your
4522 components file.
4523
4524 It does not work to put "set record filename" in the @file{.mailrc}
4525 file.
4526
4527 @node Expanding aliases when sending mail, Rmail thinks all messages are one big one, Saving a copy of outgoing mail, Mail and news
4528 @section Why doesn't Emacs expand my aliases when sending mail?
4529 @cindex Expanding aliases when sending mail
4530 @cindex Mail alias expansion
4531 @cindex Sending mail with aliases
4532
4533 @itemize @bullet
4534
4535 @item
4536 You must separate multiple addresses in the headers of the mail buffer
4537 with commas. This is because Emacs supports RFC822 standard addresses
4538 like this one:
4539
4540 @example
4541 To: Willy Smith <wks@@xpnsv.lwyrs.com>
4542 @end example
4543
4544 However, you do not need to --- and probably should not, unless your
4545 system's version of @file{/usr/ucb/mail} (aka mailx) supports RFC822
4546 -- separate addresses with commas in your @file{~/.mailrc} file.
4547
4548 @item
4549 Emacs normally only reads the @file{.mailrc} file once per session,
4550 when you start to compose your first mail message. If you edit
4551 .mailrc, you can type @kbd{M-x rebuild-mail-abbrevs @key{RET}} to
4552 make Emacs reread @file{~/.mailrc}.
4553
4554 @item
4555 If you like, you can expand mail aliases as abbrevs, as soon as you
4556 type them in. To enable this feature, execute the following:
4557
4558 @lisp
4559 (add-hook 'mail-setup-hook 'mail-abbrevs-setup)
4560 @end lisp
4561
4562 Note that the aliases are expanded automatically only after you type
4563 @key{RET} or a punctuation character (e.g. @kbd{,}). You can force their
4564 expansion by moving point to the end of the alias and typing @kbd{C-x a e}
4565 @kbd{M-x expand-abbrev}.
4566 @end itemize
4567
4568 @node Rmail thinks all messages are one big one, Sorting the messages in an Rmail folder, Expanding aliases when sending mail, Mail and news
4569 @section Why does Rmail think all my saved messages are one big message?
4570 @cindex Rmail thinks all messages are one large message
4571
4572 A file created through the @samp{FCC} field in a message is in Unix mail
4573 format, not the format that Rmail uses (BABYL format). Rmail will try
4574 to convert a Unix mail file into BABYL format on input, but sometimes it
4575 makes errors. For guaranteed safety, you can make the
4576 @file{saved-messages} file be an inbox for your Rmail file by using the
4577 function @code{set-rmail-inbox-list}.
4578
4579 @node Sorting the messages in an Rmail folder, Rmail writes to /usr/spool/mail, Rmail thinks all messages are one big one, Mail and news
4580 @section How can I sort the messages in my Rmail folder?
4581 @cindex Rmail, sorting messages in
4582 @cindex Folder, sorting messages in an Rmail
4583 @cindex Sorting messages in an Rmail folder
4584
4585 In Rmail, type @kbd{C-c C-s C-h} to get a list of sorting functions
4586 and their key bindings.
4587
4588 @node Rmail writes to /usr/spool/mail, Recovering mail files when Rmail munges them, Sorting the messages in an Rmail folder, Mail and news
4589 @section Why does Rmail need to write to @file{/usr/spool/mail}?
4590 @cindex Rmail and @file{/usr/spool/mail}
4591 @cindex @file{/usr/spool/mail} and Rmail
4592
4593 This is the behavior of the @file{movemail} program which Rmail uses.
4594 This indicates that @file{movemail} is configured to use lock files.
4595
4596 RMS writes:
4597
4598 @quotation
4599 Certain systems require lock files to interlock access to mail files.
4600 On these systems, @file{movemail} must write lock files, or you risk losing
4601 mail. You simply must arrange to let @file{movemail} write them.
4602
4603 Other systems use the flock system call to interlock access. On these
4604 systems, you should configure @file{movemail} to use @code{flock}.
4605 @end quotation
4606
4607 @node Recovering mail files when Rmail munges them, Replying to the sender of a message, Rmail writes to /usr/spool/mail, Mail and news
4608 @section How do I recover my mail files after Rmail munges their format?
4609 @cindex Recovering munged mail files
4610 @cindex Rmail munged my files
4611 @cindex Mail files, recovering those munged by Rmail
4612
4613 If you have just done @code{rmail-input} on a file and you don't want to
4614 save it in Rmail's format (called BABYL), just kill the buffer (with
4615 @kbd{C-x k}).
4616
4617 If you typed @kbd{M-x rmail} and it read some messages out of your inbox
4618 and you want to put them in a Unix mail file, use @kbd{C-o} on each
4619 message.
4620
4621 If you want to convert an existing file from BABYL format to Unix mail
4622 format, use the command @kbd{M-x unrmail}: it will prompt you for the
4623 input and output file names.
4624
4625 @node Replying to the sender of a message, MIME with Emacs mail packages, Recovering mail files when Rmail munges them, Mail and news
4626 @section How can I force Rmail to reply to the sender of a message, but not the other recipients?
4627 @cindex Replying only to the sender of a message
4628 @cindex Sender, replying only to
4629 @cindex Rmail, replying to the sender of a message in
4630
4631 @email{isaacson@@seas.upenn.edu, Ron Isaacson} says: When you hit
4632 @key{r} to reply in Rmail, by default it CCs all of the original
4633 recipients (everyone on the original @samp{To} and @samp{CC}
4634 lists). With a prefix argument (i.e., typing @kbd{C-u} before @key{r}),
4635 it replies only to the sender. However, going through the whole
4636 @kbd{C-u} business every time you want to reply is a pain. This is the
4637 best fix I've been able to come up with:
4638
4639 @lisp
4640 (defun rmail-reply-t ()
4641 "Reply only to the sender of the current message. (See rmail-reply.)"
4642 (interactive)
4643 (rmail-reply t))
4644
4645 (add-hook 'rmail-mode-hook
4646 '(lambda ()
4647 (define-key rmail-mode-map "r" 'rmail-reply-t)
4648 (define-key rmail-mode-map "R" 'rmail-reply)))
4649 @end lisp
4650
4651 @node MIME with Emacs mail packages, Automatically starting a mail or news reader, Replying to the sender of a message, Mail and news
4652 @section How can I get my favorite Emacs mail package to support MIME?
4653 @cindex MIME and Emacs mail packages
4654 @cindex Mail packages and MIME
4655 @cindex FAQ for MIME and Emacs
4656
4657 Read the Emacs MIME FAQ, maintained by @email{trey@@cs.berkeley.edu,
4658 MacDonald Hall Jackson} at
4659
4660 @uref{http://bmrc.berkeley.edu/~trey/emacs/mime.html}
4661
4662 Version 6.x of VM supports MIME. @xref{VM}.
4663
4664 @node Automatically starting a mail or news reader, Reading news with Emacs, MIME with Emacs mail packages, Mail and news
4665 @section How do I make Emacs automatically start my mail/news reader?
4666 @cindex Mail reader, starting automatically
4667 @cindex News reader, starting automatically
4668 @cindex Starting mail/news reader automatically
4669
4670 To start Emacs in Gnus:
4671
4672 @example
4673 emacs -f gnus
4674 @end example
4675
4676 in Rmail:
4677
4678 @example
4679 emacs -f rmail
4680 @end example
4681
4682 A more convenient way to start with Gnus:
4683
4684 @example
4685 alias gnus 'emacs -f gnus'
4686 gnus
4687 @end example
4688
4689 It is probably unwise to automatically start your mail or news reader
4690 from your @file{.emacs} file. This would cause problems if you needed to run
4691 two copies of Emacs at one time. Also, this would make it difficult for
4692 you to start Emacs quickly when you needed to.
4693
4694 @node Reading news with Emacs, Gnus does not work with NNTP, Automatically starting a mail or news reader, Mail and news
4695 @section How do I read news under Emacs?
4696 @cindex Reading news under Emacs
4697 @cindex Usenet reader in Emacs
4698 @cindex Gnus newsreader
4699
4700 Use @kbd{M-x gnus}. It is documented in Info (@pxref{Learning how to do something}).
4701
4702 @node Gnus does not work with NNTP, Viewing articles with embedded underlining, Reading news with Emacs, Mail and news
4703 @section Why doesn't Gnus work via NNTP?
4704 @cindex Gnus and NNTP
4705 @cindex NNTP, Gnus fails to work with
4706
4707 There is a bug in NNTP version 1.5.10, such that when multiple requests
4708 are sent to the NNTP server, the server only handles the first one
4709 before blocking waiting for more input which never comes. NNTP version
4710 1.5.11 claims to fix this.
4711
4712 You can work around the bug inside Emacs like this:
4713
4714 @lisp
4715 (setq nntp-maximum-request 1)
4716 @end lisp
4717
4718 You can find out what version of NNTP your news server is running by
4719 telnetting to the NNTP port (usually 119) on the news server machine
4720 (i.e., "telnet server-machine 119"). The server should give its version
4721 number in the welcome message. Type "quit" to get out.
4722
4723 @xref{Spontaneous entry into isearch-mode}, for some additional ideas.
4724
4725 @node Viewing articles with embedded underlining, Saving a multi-part Gnus posting, Gnus does not work with NNTP, Mail and news
4726 @section How do I view news articles with embedded underlining (e.g., ClariNews)?
4727 @cindex Underlining, embedded in news articles
4728 @cindex News articles with embedded underlining
4729 @cindex Embedded underlining in news articles
4730
4731 Underlining appears like this:
4732
4733 @example
4734 _^Hu_^Hn_^Hd_^He_^Hr_^Hl_^Hi_^Hn_^Hi_^Hn_^Hg
4735 @end example
4736
4737 @email{amanda@@iesd.auc.dk, Per Abrahamsen} suggests using the following
4738 code, which uses the underline face to turn such text into true
4739 underlining:
4740
4741 @lisp
4742 (defun gnus-article-prepare-overstrike ()
4743 ;; Prepare article for overstrike commands.
4744 (save-excursion
4745 (set-buffer gnus-article-buffer)
4746 (let ((buffer-read-only nil))
4747 (goto-char (point-min))
4748 (while (search-forward "\b" nil t)
4749 (let ((next (following-char))
4750 (previous (char-after (- (point) 2))))
4751 (cond ((eq next previous)
4752 (delete-region (- (point) 2) (point))
4753 (put-text-property (point) (1+ (point))
4754 'face 'bold))
4755 ((eq next ?_)
4756 (delete-region (1- (point)) (1+ (point)))
4757 (put-text-property (1- (point)) (point)
4758 'face 'underline))
4759 ((eq previous ?_)
4760 (delete-region (- (point) 2) (point))
4761 (put-text-property (point) (1+ (point))
4762 'face 'underline))))))))
4763
4764 (add-hook 'gnus-article-prepare-hook 'gnus-article-prepare-overstrike)
4765 @end lisp
4766
4767 If you prefer to do away with underlining altogether, you can
4768 destructively remove it with @kbd{M-x ununderline-region}; do this
4769 automatically via
4770
4771 @lisp
4772 (add-hook 'gnus-article-prepare-hook
4773 '(lambda () (ununderline-region (point-min) (point-max))))
4774 @end lisp
4775
4776 @node Saving a multi-part Gnus posting, Starting Gnus faster, Viewing articles with embedded underlining, Mail and news
4777 @section How do I save all the items of a multi-part posting in Gnus?
4778 @cindex Multi-part postings in Gnus, saving
4779 @cindex Saving multi-part postings in Gnus
4780 @cindex Gnus, saving multi-part postings in
4781
4782 Use @code{gnus-uu}. Type @kbd{C-c C-v C-h} in the Gnus summary buffer
4783 to see a list of available commands.
4784
4785 @node Starting Gnus faster, Catching up in all newsgroups, Saving a multi-part Gnus posting, Mail and news
4786 @section How do I make Gnus start up faster?
4787 @cindex Faster, starting Gnus
4788 @cindex Starting Gnus faster
4789 @cindex Gnus, starting faster
4790
4791 From the Gnus FAQ (@pxref{Learning more about Gnus}):
4792
4793 @quotation
4794 @email{pktiwari@@eos.ncsu.edu, Pranav Kumar Tiwari} writes: I posted
4795 the same query recently and I got an answer to it. I am going to
4796 repeat the answer. What you need is a newer version of gnus, version
4797 5.0.4+. I am using 5.0.12 and it works fine with me with the
4798 following settings:
4799
4800 @lisp
4801 (setq gnus-check-new-newsgroups nil
4802 gnus-read-active-file 'some
4803 gnus-nov-is-evil nil
4804 gnus-select-method '(nntp gnus-nntp-server))
4805 @end lisp
4806 @end quotation
4807
4808 @node Catching up in all newsgroups, Killing based on nonstandard headers, Starting Gnus faster, Mail and news
4809 @section How do I catch up all newsgroups in Gnus?
4810 @cindex Catching up all newsgroups in Gnus
4811 @cindex Gnus, Catching up all newsgroups in
4812
4813 In the @file{*Newsgroup*} buffer, type @kbd{M-< C-x ( c y C-x ) M-0 C-x e}
4814
4815 Leave off the initial @kbd{M-<} if you only want to catch up from point
4816 to the end of the @file{*Newsgroup*} buffer.
4817
4818 @node Killing based on nonstandard headers, Removing flashing messages, Catching up in all newsgroups, Mail and news
4819 @section Why can't I kill in Gnus based on the Newsgroups/Keywords/Control headers?
4820 @cindex Killing articles based on nonstandard headers
4821 @cindex Newsgroups header, killing articles based on
4822 @cindex Keywords header, killing articles based on
4823 @cindex Control header, killing articles based on
4824
4825 Gnus will complain that the @samp{Newsgroups}, @samp{Keywords}, and
4826 @samp{Control} headers are "Unknown header" fields.
4827
4828 For the @samp{Newsgroups} header, there is an easy workaround: kill on the
4829 @samp{Xref} header instead, which will be present on any cross-posted article
4830 (as long as your site carries the cross-post group).
4831
4832 If you really want to kill on one of these headers, you can do it like
4833 this:
4834
4835 @lisp
4836 (gnus-kill nil "^Newsgroups: .*\\(bad\\.group\\|worse\\.group\\)")
4837 @end lisp
4838
4839 @node Removing flashing messages, Catch-up is slow in Gnus, Killing based on nonstandard headers, Mail and news
4840 @section How do I get rid of flashing messages in Gnus for slow connections?
4841 @cindex Flashing Gnus messages, removing
4842 @cindex Removing flashing Gnus messages
4843 @cindex Slow connections causing flashing messages in Gnus
4844 @cindex Gnus, flashing messages in
4845
4846 Set @code{nntp-debug-read} to @code{nil}.
4847
4848 @node Catch-up is slow in Gnus, Gnus hangs for a long time, Removing flashing messages, Mail and news
4849 @section Why is catch up slow in Gnus?
4850 @cindex Slow catch up in Gnus
4851 @cindex Gnus is slow when catching up
4852 @cindex Crosspostings make Gnus catching up slow
4853
4854 Because Gnus is marking crosspostings read. You can control this with
4855 the variable @code{gnus-use-cross-reference}.
4856
4857 @node Gnus hangs for a long time, Learning more about Gnus, Catch-up is slow in Gnus, Mail and news
4858 @section Why does Gnus hang for a long time when posting?
4859 @cindex Hangs in Gnus
4860 @cindex Gnus hangs while posting
4861 @cindex Posting, Gnus hangs wile
4862
4863 @email{tale@@uunet.uu.net, David Lawrence} explains:
4864
4865 @quotation
4866 The problem is almost always interaction between NNTP and C News. NNTP
4867 POST asks C News's inews to not background itself but rather hang around
4868 and give its exit status so it knows whether the post was successful.
4869 (That wait will on some systems not return the exit status of the
4870 waited for job is a different sort of problem.) It ends up taking a
4871 long time because inews is calling relaynews, which often waits for
4872 another relaynews to free the lock on the news system so it can file the
4873 article.
4874
4875 My preferred solution is to change inews to not call relaynews, but
4876 rather use newsspool. This loses some error-catching functionality, but
4877 is for the most part safe as inews will detect a lot of the errors on
4878 its own. The C News folks have sped up inews, too, so speed should look
4879 better to most folks as that update propagates around.
4880 @end quotation
4881
4882 @node Learning more about Gnus, , Gnus hangs for a long time, Mail and news
4883 @section Where can I find out more about Gnus?
4884 @cindex FAQ for Gnus
4885 @cindex Gnus FAQ
4886 @cindex Learning more about GNU
4887
4888 Look for the Gnus FAQ, available at
4889
4890 @uref{http://www.ccs.neu.edu/software/contrib/gnus/}
4891
4892 @node Concept index, , Mail and news, Top
4893 @unnumbered Concept Index
4894 @printindex cp
4895
4896 @contents
4897 @bye