comparison man/faq.texi @ 25474:e87d80337a64

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