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