\input texinfo @c -*- coding: latin-1; mode: texinfo; -*-@c %**start of header@setfilename ../info/efaq@settitle GNU Emacs FAQ@c %**end of header@setchapternewpage odd@c This is used in many places@set VER 21.3@copyingCopyright 2001, 2002, 2003 Free Software Foundation, Inc.Copyright 1994,1995,1996,1997,1998,1999,2000 Reuven M. Lerner@*Copyright 1992,1993 Steven Byrnes@*Copyright 1990,1991,1992 Joseph Brian Wells@*@quotationThis list of frequently asked questions about GNU Emacs with answers(``FAQ'') may be translated into other languages, transformed into otherformats (e.g. Texinfo, Info, WWW, WAIS), and updated with new information.The same conditions apply to any derivative of the FAQ as apply to the FAQitself. Every copy of the FAQ must include this notice or an approvedtranslation, information on who is currently maintaining the FAQ and how tocontact them (including their e-mail address), and information on where thelatest version of the FAQ is archived (including FTP information).The FAQ may be copied and redistributed under these conditions, except thatthe FAQ may not be embedded in a larger literary work unless that workitself allows free copying and redistribution.[This version has been somewhat edited from the last-posted version(as of August 1999) for inclusion in the Emacs distribution.]@end quotation@end copying@dircategory Emacs@direntry* Emacs FAQ: (efaq). Frequently Asked Questions about Emacs.@end direntry@c The @titlepage stuff only appears in the printed version@titlepage@sp 10@center @titlefont{GNU Emacs FAQ}@c The following two commands start the copyright page.@page@vskip 0pt plus 1filll@insertcopying@end titlepage@node Top, FAQ notation, (dir), (dir)This is the GNU Emacs FAQ, last updated on @today{}.The FAQ is maintained as a Texinfo document, allowing us to create HTML,Info, and TeX documents from a single source file, and is slowly butsurely being improved. Please bear with us as we improve on thisformat. This FAQ is maintained as a part of GNU Emacs. If you findany errors, or have any suggestions, please use @kbd{M-x report-emacs-bug}to report them.@menu* FAQ notation::* General questions::* Getting help::* Status of Emacs::* Common requests::* Bugs and problems::* Compiling and installing Emacs::* Finding Emacs and related packages::* Major packages and programs::* Key bindings::* Alternate character sets::* Mail and news::* Concept index::@end menu@c ------------------------------------------------------------@node FAQ notation, General questions, Top, Top@chapter FAQ notation@cindex FAQ notationThis chapter describes notation used in the GNU Emacs FAQ, as well as inthe Emacs documentation. Consult this section if this is the first timeyou are reading the FAQ, or if you are confused by notation or termsused in the FAQ.@menu* Basic keys::* Extended commands::* On-line manual::* File-name conventions::* Common acronyms::@end menu@node Basic keys, Extended commands, FAQ notation, FAQ notation@section What do these mean: @kbd{C-h}, @kbd{C-M-a}, @key{RET}, @kbd{@key{ESC} a}, etc.?@cindex Basic keys@cindex Control key, notation for@cindex @key{Meta} key, notation for@cindex Control-Meta characters, notation for@cindex @kbd{C-h}, definition of@cindex @kbd{C-M-h}, definition of@cindex @key{DEL}, definition of@cindex @key{ESC}, definition of@cindex @key{LFD}, definition of@cindex @key{RET}, definition of@cindex @key{SPC}, definition of@cindex @key{TAB}, definition of@cindex Notation for keys@itemize @bullet@item@kbd{C-x}: press the @key{x} key while holding down the @key{Control} key@item@kbd{M-x}: press the @key{x} key while holding down the @key{Meta} key(if your computer doesn't have a @key{Meta} key, @pxref{No Meta key})@item@kbd{M-C-x}: press the @key{x} key while holding down both @key{Control}and @key{Meta}@item@kbd{C-M-x}: a synonym for the above@item@key{LFD}: Linefeed or Newline; same as @kbd{C-j}@item@key{RET}: @key{Return}, sometimes marked @key{Enter}; same as @kbd{C-m}@item@key{DEL}: @key{Delete}, usually @strong{not} the same as@key{Backspace}; same as @kbd{C-?} (see @ref{Backspace invokes help}, ifdeleting invokes Emacs help)@item@key{ESC}: Escape; same as @kbd{C-[}@item@key{TAB}: Tab; same as @kbd{C-i}@item@key{SPC}: Space bar@end itemizeKey sequences longer than one key (and some single-key sequences) arewritten inside quotes or on lines by themselves, like this:@display @kbd{M-x frobnicate-while-foo RET}@end display@noindentAny real spaces in such a key sequence should be ignored; only @key{SPC}really means press the space key.The @acronym{ASCII} code sent by @kbd{C-x} (except for @kbd{C-?}) is the valuethat would be sent by pressing just @key{x} minus 96 (or 64 forupper-case @key{X}) and will be from 0 to 31. On Unix and GNU/Linuxterminals, the @acronym{ASCII} code sent by @kbd{M-x} is the sum of 128 and the@acronym{ASCII} code that would be sent by pressing just @key{x}. Essentially,@key{Control} turns off bits 5 and 6 and @key{Meta} turns on bit7@footnote{DOS and Windows terminals don't set bit 7 when the @key{Meta} key ispressed.}.@kbd{C-?} (aka @key{DEL}) is @acronym{ASCII} code 127. It is a misnomer to call@kbd{C-?} a ``control'' key, since 127 has both bits 5 and 6 turned ON.Also, on very few keyboards does @kbd{C-?} generate @acronym{ASCII} code 127.@inforef{Text Characters, Text Characters, emacs}, and @inforef{Keys,Keys, emacs}, for more information. (@xref{On-line manual}, for moreinformation about Info.)@node Extended commands, On-line manual, Basic keys, FAQ notation@section What does @file{M-x @var{command}} mean?@cindex Extended commands@cindex Commands, extended@cindex M-x, meaning of@kbd{M-x @var{command}} means type @kbd{M-x}, then type the name of thecommand, then type @key{RET}. (@xref{Basic keys}, if you're not surewhat @kbd{M-x} and @key{RET} mean.)@kbd{M-x} (by default) invokes the command@code{execute-extended-command}. This command allows you to run anyEmacs command if you can remember the command's name. If you can'tremember the command's name, you can type @key{TAB} and @key{SPC} forcompletion, @key{?} for a list of possibilities, and @kbd{M-p} and@kbd{M-n} (or up-arrow and down-arrow on terminals that have theseediting keys) to see previous commands entered. An Emacs @dfn{command}is an @dfn{interactive} Emacs function.@cindex @key{Do} keyYour system administrator may have bound other key sequences to invoke@code{execute-extended-command}. A function key labeled @kbd{Do} is agood candidate for this, on keyboards that have such a key.If you need to run non-interactive Emacs functions, see @ref{EvaluatingEmacs Lisp code}.@node On-line manual, File-name conventions, Extended commands, FAQ notation@section How do I read topic XXX in the on-line manual?@cindex On-line manual, reading topics in@cindex Reading topics in the on-line manual@cindex Finding topics in the on-line manual@cindex Info, finding topics inWhen we refer you to some @var{topic} in the on-line manual, you canread this manual node inside Emacs (assuming nothing is broken) bytyping @kbd{C-h i m emacs @key{RET} m @var{topic} @key{RET}}.This invokes Info, the GNU hypertext documentation browser. If you don'talready know how to use Info, type @key{?} from within Info.If we refer to @var{topic}:@var{subtopic}, type @kbd{C-h i m emacs@key{RET} m @var{topic} @key{RET} m @var{subtopic} @key{RET}}.If these commands don't work as expected, your system administrator maynot have installed the Info files, or may have installed themimproperly. In this case you should complain.@xref{Getting a printed manual}, if you would like a paper copy of theEmacs manual.@node File-name conventions, Common acronyms, On-line manual, FAQ notation@section What are @file{etc/SERVICE}, @file{src/config.h}, and @file{lisp/default.el}?@cindex File-name conventions@cindex Conventions for file names@cindex Directories and files that come with EmacsThese are files that come with Emacs. The Emacs distribution is dividedinto subdirectories; the important ones are @file{etc}, @file{lisp}, and@file{src}.If you use Emacs, but don't know where it is kept on your system, startEmacs, then type @kbd{C-h v data-directory @key{RET}}. The directoryname displayed by this will be the full pathname of the installed@file{etc} directory. (This full path is recorded in the Emacs variable@code{data-directory}, and @kbd{C-h v} displays the value and thedocumentation of a variable.)The location of your Info directory (i.e., where on-line documentationis stored) is kept in the variable @code{Info-default-directory-list}. Use@kbd{C-h v Info-default-directory-list @key{RET}} to see the value ofthis variable, which will be a list of directory names. The lastdirectory in that list is probably where most Info files are stored. Bydefault, Info documentation is placed in @file{/usr/local/info}.Some of these files are available individually via FTP or e-mail; see@ref{Informational files for Emacs}. They all are available in thesource distribution. Many of the files in the @file{etc} directory arealso available via the Emacs @samp{Help} menu, or by typing @kbd{C-h ?}(@kbd{M-x help-for-help}).Your system administrator may have removed the @file{src} directory andmany files from the @file{etc} directory.@node Common acronyms, , File-name conventions, FAQ notation@section What are FSF, LPF, OSF, GNU, RMS, FTP, and GPL?@cindex FSF, definition of@cindex LPF, definition of@cindex OSF, definition of@cindex GNU, definition of@cindex RMS, definition of@cindex Stallman, Richard, acronym for@cindex Richard Stallman, acronym for@cindex FTP, definition of@cindex GPL, definition of@cindex Acronyms, definitions for@cindex Common acronyms, definitions for@table @asis@item FSFFree Software Foundation@item LPFLeague for Programming Freedom@item OSFOpen Software Foundation@item GNUGNU's Not Unix@item RMSRichard Matthew Stallman@item FTPFile Transfer Protocol@item GPLGNU General Public License@end tableAvoid confusing the FSF, the LPF, and the OSF. The LPF opposeslook-and-feel copyrights and software patents. The FSF aims to makehigh quality free software available for everyone. The OSF is aconsortium of computer vendors which develops commercial software forUnix systems.The word ``free'' in the title of the Free Software Foundation refers to``freedom,'' not ``zero dollars.'' Anyone can charge any price forGPL-covered software that they want to. However, in practice, thefreedom enforced by the GPL leads to low prices, because you can alwaysget the software for less money from someone else, since everyone hasthe right to resell or give away GPL-covered software.@c ------------------------------------------------------------@node General questions, Getting help, FAQ notation, Top@chapter General questions@cindex General questionsThis chapter contains general questions having to do with Emacs, theFree Software Foundation, and related organizations.@menu* The LPF::* Real meaning of copyleft::* Guidelines for newsgroup postings::* Newsgroup archives::* Reporting bugs::* Unsubscribing from Emacs lists::* Contacting the FSF::@end menu@node The LPF, Real meaning of copyleft, General questions, General questions@section What is the LPF?@cindex LPF, description of@cindex League for Programming Freedom@cindex Software patents, opposition to@cindex Patents for software, opposition toThe LPF opposes the expanding danger of software patents andlook-and-feel copyrights. To get more information, feel free to contactthe LPF via e-mail or otherwise. You may also contact@email{jbw@@cs.bu.edu, Joe Wells}; he will be happy to talk to youabout the LPF.You can find more information about the LPF in the file @file{etc/LPF}.More papers describing the LPF's views are available on the Internet andalso from @uref{http://lpf.ai.mit.edu/, the LPF home page}.@node Real meaning of copyleft, Guidelines for newsgroup postings, The LPF, General questions@section What is the real legal meaning of the GNU copyleft?@cindex Copyleft, real meaning of@cindex GPL, real meaning of@cindex General Public License, real meaning of@cindex Discussion of the GPLThe real legal meaning of the GNU General Public License (copyleft) willonly be known if and when a judge rules on its validity and scope.There has never been a copyright infringement case involving the GPL toset any precedents. Please take any discussion regarding this issue tothe newsgroup @uref{news:gnu.misc.discuss}, which was created to hold theextensive flame wars on the subject.RMS writes:@quotationThe legal meaning of the GNU copyleft is less important than the spirit,which is that Emacs is a free software project and that work pertainingto Emacs should also be free software. ``Free'' means that all usershave the freedom to study, share, change and improve Emacs. To makesure everyone has this freedom, pass along source code when youdistribute any version of Emacs or a related program, and give therecipients the same freedom that you enjoyed.@end quotation@node Guidelines for newsgroup postings, Newsgroup archives, Real meaning of copyleft, General questions@section What are appropriate messages for @uref{news:gnu.emacs.help}, @uref{news:gnu.emacs.bug}, @uref{news:comp.emacs}, etc.?@cindex Newsgroups, appropriate messages for@cindex GNU newsgroups, appropriate messages for@cindex Usenet groups, appropriate messages for@cindex Mailing lists, appropriate messages for@cindex Posting messages to newsgroups@cindex GNU mailing listsThe file @file{etc/MAILINGLISTS} describes the purpose of each GNUmailing list. (@xref{Informational files for Emacs}, if you want a copyof the file.) For those lists which are gatewayed with newsgroups, itlists both the newsgroup name and the mailing list address.The newsgroup @uref{news:comp.emacs} is for discussion of Emacs programsin general. This includes Emacs along with various otherimplementations, such as XEmacs, JOVE, MicroEmacs, Freemacs, MG,Unipress, CCA, and Epsilon.Many people post Emacs questions to @uref{news:comp.emacs} because theydon't receive any of the @code{gnu.*} newsgroups. Arguments have beenmade both for and against posting GNU-Emacs-specific material to@uref{news:comp.emacs}. You have to decide for yourself.Messages advocating ``non-free'' software are considered unacceptable onany of the @code{gnu.*} newsgroups except for @uref{news:gnu.misc.discuss},which was created to hold the extensive flame-wars on the subject.``Non-free'' software includes any software for which the end user can'tfreely modify the source code and exchange enhancements. Be careful toremove the @code{gnu.*} groups from the @samp{Newsgroups:} line whenposting a followup that recommends such software.@uref{news:gnu.emacs.bug} is a place where bug reports appear, but avoidposting bug reports to this newsgroup directly (@pxref{Reporting bugs}).@node Newsgroup archives, Reporting bugs, Guidelines for newsgroup postings, General questions@section Where can I get old postings to @uref{news:gnu.emacs.help} and other GNU groups?@cindex Archived postings from @code{gnu.emacs.help}@cindex Usenet archives for GNU groups@cindex Old Usenet postings for GNU groupsThe FSF has maintained archives of all of the GNU mailing lists for manyyears, although there may be some unintentional gaps in coverage. Thearchive is not particularly well organized or easy to retrieveindividual postings from, but pretty much everything is there.The archive is at @uref{ftp://ftp-mailing-list-archives.gnu.org}.The archive can be browsed over the web at@uref{http://mail.gnu.org/archive/html/, the GNU mail archive}.Web-based Usenet search services, such as@uref{http://groups.google.com, Google}, also archive the@code{gnu.*} groups.@node Reporting bugs, Unsubscribing from Emacs lists, Newsgroup archives, General questions@section Where should I report bugs and other problems with Emacs?@cindex Bug reporting@cindex Good bug reports@cindex How to submit a bug report@cindex Reporting bugsThe correct way to report Emacs bugs is by e-mail to@email{bug-gnu-emacs@@gnu.org}. Anything sent here also appears in thenewsgroup @uref{news:gnu.emacs.bug}, but please use e-mail instead ofnews to submit the bug report. This ensures a reliable return addressso you can be contacted for further details.Be sure to read the ``Bugs'' section of the Emacs manual before reportinga bug to bug-gnu-emacs! The manual describes in detail how to submit auseful bug report. (@xref{On-line manual}, if you don't know how to read themanual.)RMS says:@quotationSending bug reports to @email{help-gnu-emacs@@gnu.org} (which has theeffect of posting on @uref{news:gnu.emacs.help}) is undesirable becauseit takes the time of an unnecessarily large group of people, most ofwhom are just users and have no idea how to fix these problem.@email{bug-gnu-emacs@@gnu.org} reaches a much smaller group of peoplewho are more likely to know what to do and have expressed a wish toreceive more messages about Emacs than the others.@end quotationRMS says it is sometimes fine to post to @uref{news:gnu.emacs.help}:@quotationIf you have reported a bug and you don't hear about a possible fix,then after a suitable delay (such as a week) it is okay to post on@code{gnu.emacs.help} asking if anyone can help you.@end quotationIf you are unsure whether you have found a bug, consider the followingnon-exhaustive list, courtesy of RMS:@quotationIf Emacs crashes, that is a bug. If Emacs gets compilation errorswhile building, that is a bug. If Emacs crashes while building, thatis a bug. If Lisp code does not do what the documentation says itdoes, that is a bug.@end quotation@node Unsubscribing from Emacs lists, Contacting the FSF, Reporting bugs, General questions@section How do I unsubscribe from this mailing list?@cindex Unsubscribing from GNU mailing lists@cindex Removing yourself from GNU mailing listsIf you are receiving a GNU mailing list named @var{list}, you might beable to unsubscribe from it by sending a request to the address@email{@var{list}-request@@gnu.org}. However, this will not work if you arenot listed on the main mailing list, but instead receive the mail from adistribution point. In that case, you will have to track down at whichdistribution point you are listed. Inspecting the @samp{Received} headerson the mail messages may help, along with liberal use of the @samp{EXPN} or@samp{VRFY} sendmail commands through @samp{telnet @var{site-address}smtp}. Ask your postmaster for help, if you cannot figure out thesedetails.@node Contacting the FSF, , Unsubscribing from Emacs lists, General questions@section What is the current address of the FSF?@cindex Snail mail address of the FSF@cindex Postal address of the FSF@cindex Contracting the FSF@cindex Free Software Foundation, contacting@table @asis@item E-mailgnu@@gnu.org@item Telephone+1-617-542-5942@item Fax+1-617-542-2652@item World Wide Web@uref{http://www.gnu.org/}@item Postal addressFree Software Foundation@*59 Temple Place - Suite 330@*Boston, MA 02111-1307@*USA@*@end table@cindex Ordering GNU softwareFor details on how to order items directly from the FSF, see the@uref{http://www.gnu.org/order/order.html, GNU Web site}.@c ------------------------------------------------------------@node Getting help, Status of Emacs, General questions, Top@chapter Getting help@cindex Getting helpThis chapter tells you how to get help with Emacs@menu* Basic editing::* Learning how to do something::* Getting a printed manual::* Emacs Lisp documentation::* Installing Texinfo documentation::* Printing a Texinfo file::* Viewing Info files outside of Emacs::* Informational files for Emacs::* Help installing Emacs::* Obtaining the FAQ::@end menu@node Basic editing, Learning how to do something, Getting help, Getting help@section I'm just starting Emacs; how do I do basic editing?@cindex Basic editing with Emacs@cindex Beginning editing@cindex Tutorial, invoking the@cindex Self-paced tutorial, invoking the@cindex Help system, entering theType @kbd{C-h t} to invoke the self-paced tutorial. Just typing @kbd{C-h}enters the help system.Your system administrator may have changed @kbd{C-h} to act like@key{DEL} to deal with local keyboards. You can use @kbd{M-xhelp-for-help} instead to invoke help. To discover what key (if any)invokes help on your system, type @kbd{M-x where-is @key{RET}help-for-help @key{RET}}. This will print a comma-separated list of keysequences in the echo area. Ignore the last character in each keysequence listed. Each of the resulting key sequences invokes help.Emacs help works best if it is invoked by a single key whose valueshould be stored in the variable @code{help-char}.There is also a WWW-based tutorial for Emacs 18, much of which is alsorelevant for later versions of Emacs, available at@uref{http://kufacts.cc.ukans.edu/cwis/writeups/misc/emacsguide.html}@node Learning how to do something, Getting a printed manual, Basic editing, Getting help@section How do I find out how to do something in Emacs?@cindex Help for Emacs@cindex Learning to do something in Emacs@cindex Reference card for Emacs@cindex Overview of help systemsThere are several methods for finding out how to do things in Emacs.@itemize @bullet@cindex Reading the Emacs manual@itemThe complete text of the Emacs manual is available on-line via the Infohypertext reader. Type @kbd{C-h i} to invoke Info. Typing @key{h}immediately after entering Info will provide a short tutorial on how touse it.@cindex Lookup a subject in a manual@cindex Index search in a manual@itemTo quickly locate the section of the manual which discusses a certainissue, or describes a command or a variable, type @kbd{C-h i m emacs@key{RET} i @var{topic} @key{RET}}, where @var{topic} is the name of thetopic, the command, or the variable which you are looking for. If thisdoes not land you on the right place in the manual, press @kbd{,}(comma) repeatedly until you find what you need. (The @kbd{i} and@kbd{,} keys invoke the index-searching functions, which look for the@var{topic} you type in all the indices of the Emacs manual.)@cindex Apropos@itemYou can list all of the commands whose names contain a certain word(actually which match a regular expression) using @kbd{C-h a} (@kbd{M-xcommand-apropos}).@cindex Command description in the manual@itemThe command @kbd{C-h F} (@code{Info-goto-emacs-command-node}) promptsfor the name of a command, and then attempts to find the section in theEmacs manual where that command is described.@cindex Finding commands and variables@itemYou can list all of the functions and variables whose names contain acertain word using @kbd{M-x apropos}.@itemYou can list all of the functions and variables whose documentationmatches a regular expression or a string, using @kbd{M-xapropos-documentation}.@itemYou can order a hardcopy of the manual from the FSF. @xref{Getting aprinted manual}.@cindex Reference cards, in other languages@itemYou can get a printed reference card listing commands and keys toinvoke them. You can order one from the FSF for $1 (or 10 for $5),or you can print your own from the @file{etc/refcard.tex} or@file{etc/refcard.ps} files in the Emacs distribution. Beginning withversion 21.1, the Emacs distribution comes with translations of thereference card into several languages; look for files named@file{etc/@var{lang}-refcard.*}, where @var{lang} is a two-letter codeof the language. For example, the German version of the reference cardis in the files @file{etc/de-refcard.tex} and @file{etc/de-refcard.ps}.@itemThere are many other commands in Emacs for getting help andinformation. To get a list of these commands, type @samp{?} after@kbd{C-h}.@end itemize@node Getting a printed manual, Emacs Lisp documentation, Learning how to do something, Getting help@section How do I get a printed copy of the Emacs manual?@cindex Printed Emacs manual, obtaining@cindex Manual, obtaining a printed or HTML copy of@cindex Emacs manual, obtaining a printed or HTML copy ofYou can order a printed copy of the Emacs manual from the FSF. Fordetails see the @uref{http://www.gnu.org/order/order.html, GNU Web site}.@c The number 620 below is version-dependent!The full Texinfo source for the manual also comes in the @file{man}directory of the Emacs distribution, if you're daring enough to try toprint out this 620-page manual yourself (@pxref{Printing a Texinfofile}).If you absolutely have to print your own copy, and you don't have @TeX{},you can get a PostScript version from@uref{http://www.gnu.org/manual/emacs/ps/emacs.ps.gz}@cindex HTML version of Emacs manual, obtainingAn HTML version of the manual is at@uref{www.gnu.org/manual/emacs/index.html}@xref{Learning how to do something}, for how to view the manual on-line.@node Emacs Lisp documentation, Installing Texinfo documentation, Getting a printed manual, Getting help@section Where can I get documentation on Emacs Lisp?@cindex Documentation on Emacs Lisp@cindex Function documentation@cindex Variable documentation@cindex Emacs Lisp Reference Manual@cindex Reference manual for Emacs LispWithin Emacs, you can type @kbd{C-h f} to get the documentation for afunction, @kbd{C-h v} for a variable.For more information, obtain the Emacs Lisp Reference Manual. Detailson ordering it from FSF are on the@uref{http://www.gnu.org/order/order.html, GNU Web site}.The Emacs Lisp Reference Manual is also available on-line, in Infoformat. Texinfo source for the manual (along with pregenerated Infofiles) is available at@uref{ftp://ftp.gnu.org/pub/gnu/emacs/elisp-manual-21-2.6.tar.gz}and all mirrors of @samp{ftp.gnu.org} (for a list, @pxref{Current GNUdistributions}). @xref{Installing Texinfo documentation}, if you wantto install the Info files, or @ref{Printing a Texinfo file}, if you wantto use the Texinfo source to print the manual yourself.An HTML version of the Emacs Lisp Reference Manual is available at@uref{http://www.gnu.org/manual/elisp-manual-21-2.6/elisp.html}@node Installing Texinfo documentation, Printing a Texinfo file, Emacs Lisp documentation, Getting help@section How do I install a piece of Texinfo documentation?@cindex Texinfo documentation, installing@cindex Installing Texinfo documentation@cindex New Texinfo files, installing@cindex Documentation, installing new Texinfo files@cindex Info files, how to installFirst, you must turn the Texinfo files into Info files. You may do thisusing the stand-alone @file{makeinfo} program, available as part of the latestTexinfo package at@uref{ftp://ftp.gnu.org/pub/gnu/texinfo/texinfo-4.0.tar.gz}and all mirrors of @samp{ftp.gnu.org} (for a list, @pxref{Current GNUdistributions}).For information about the Texinfo format, read the Texinfo manual whichcomes with the Texinfo package. This manual also comes installed inInfo format, so you can read it on-line; type @kbd{C-h i m texinfo@key{RET}}.Alternatively, you could use the Emacs command @kbd{M-xtexinfo-format-buffer}, after visiting the Texinfo source file of themanual you want to convert.Neither @code{texinfo-format-buffer} nor @file{makeinfo} installs theresulting Info files in Emacs's Info tree. To install Info files,perform these steps:@enumerate@itemMove the files to the @file{info} directory in the installed Emacsdistribution. @xref{File-name conventions}, if you don't know where thatis.@itemRun the @code{install-info} command, which is part of the Texinfodistribution, to update the main Info directory menu, like this:@example install-info --info-dir=@var{dir-path} @var{dir-path}/@var{file}@end example@noindentwhere @var{dir-path} is the full path to the directory where you copiedthe produced Info file(s), and @var{file} is the name of the Info fileyou produced and want to install.If you don't have the @code{install-info} command installed, you canedit the file @file{info/dir} in the installed Emacs distribution, andadd a line for the top level node in the Info package that you areinstalling. Follow the examples already in this file. The format is:@example* Topic: (relative-pathname). Short description of topic.@end example@end enumerateIf you want to install Info files and you don't have the necessaryprivileges, you have several options:@itemize @bullet@itemInfo files don't actually need to be installed before being used. Youcan feed a file name to the @code{Info-goto-node} command (invoked bypressing @key{g} in Info mode) by typing the name of the file inparentheses. This goes to the node named ``Top'' in that file. Forexample, to view a Info file named @file{@var{info-file}} in your homedirectory, you can type this:@example@kbd{C-h i g (~/@var{info-file}) @key{RET}}@end example@itemYou can create your own Info directory. You can tell Emacs where thatInfo directory is by adding its pathname to the value of the variable@code{Info-default-directory-list}. For example, to use a private Infodirectory which is a subdirectory of your home directory named @file{Info},you could put this in your @file{.emacs} file:@lisp(setq Info-default-directory-list (cons "~/Info" Info-default-directory-list))@end lispYou will need a top-level Info file named @file{dir} in this directorywhich has everything the system @file{dir} file has in it, except it shouldlist only entries for Info files in that directory. You might not needit if all files in this directory were referenced by other @file{dir}files. The node lists from all @file{dir} files in@code{Info-default-directory-list} are merged by the Info system.@end itemize@node Printing a Texinfo file, Viewing Info files outside of Emacs, Installing Texinfo documentation, Getting help@section How do I print a Texinfo file?@cindex Printing a Texinfo file@cindex Texinfo file, printing@cindex Printing documentationYou can't get nicely printed output from Info files; you must still havethe original Texinfo source file for the manual you want to print.Assuming you have @TeX{} installed on your system, follow these steps:@enumerate@itemMake sure the first line of the Texinfo file looks like this:@example\input texinfo@end exampleYou may need to change @samp{texinfo} to the full pathname of the@file{texinfo.tex} file, which comes with Emacs as@file{man/texinfo.tex} (or copy or link it into the current directory).@itemType @kbd{texi2dvi @var{texinfo-source}}, where @var{texinfo-source} isthe name of the Texinfo source file for which you want to produce aprinted copy.The @samp{texi2dvi} script is part of the GNU Texinfo distribution(@pxref{Installing Texinfo documentation}).@itemPrint the DVI file @file{@var{texinfo-source}.dvi} in the normal way forprinting DVI files at your site. For example, if you have a PostScriptprinter, run the @code{dvips} program to print the DVI file on thatprinter.@end enumerateTo get more general instructions, retrieve the latest Texinfo package(@pxref{Installing Texinfo documentation}).@node Viewing Info files outside of Emacs, Informational files for Emacs, Printing a Texinfo file, Getting help@section Can I view Info files without using Emacs?@cindex Viewing Info files@cindex Info file viewers@cindex Alternative Info file viewersYes. Here are some alternative programs:@itemize @bullet@item@code{info}, a stand-alone version of the Info program, comes as part ofthe Texinfo package. @xref{Installing Texinfo documentation}, fordetails.@itemXinfo, a stand-alone version of the Info program that runs under XWindow system. You can get it at@uref{ftp://ftp.gnu.org/pub/gnu/xinfo/xinfo-1.01.01.tar.gz} and allmirrors of @samp{ftp.gnu.org} (see @ref{Current GNU distributions}, for alist of mirrors).@itemTkinfo, an Info viewer that runs under X Window system and uses Tcl/Tk.You can get Tkinfo at@uref{http://math-www.uni-paderborn.de/~axel/tkinfo/}.@end itemize@node Informational files for Emacs, Help installing Emacs, Viewing Info files outside of Emacs, Getting help@section What informational files are available for Emacs?@cindex Informational files included with Emacs@cindex Files included with Emacs@cindex @file{COPYING}, description of file@cindex @file{DISTRIB}, description of file@cindex @file{FTP}, description of file@cindex @file{GNU}, description of file@cindex @file{INTERVIEW}, description of file@cindex @file{LPF}, description of file@cindex @file{MACHINES}, description of file@cindex @file{MAILINGLISTS}, description of file@cindex @file{NEWS}, description of file@cindex @file{SERVICE}, description of file@cindex @file{SUN-SUPPORT}, description of fileThis isn't a frequently asked question, but it should be! A variety ofinformational files about Emacs and relevant aspects of the GNU projectare available for you to read.The following files are available in the @file{etc} directory of theEmacs distribution (see @ref{File-name conventions}, if you're not surewhere that is).@table @file@item COPYINGEmacs General Public License@item DISTRIBEmacs Availability Information, including the popular Free SoftwareFoundation Order Form@item FTPHow to get GNU Software by Internet FTP or by UUCP@item GNUThe GNU Manifesto@item INTERVIEWRichard Stallman discusses his public-domain UNIX-compatible softwaresystem with BYTE editors@item LPFWhy you should join the League for Programming Freedom@item MACHINESStatus of Emacs on Various Machines and Systems@item MAILINGLISTSGNU Project Electronic Mailing Lists@item NEWSEmacs news, a history of recent user-visible changes@item SERVICEGNU Service Directory@item SUN-SUPPORTincluding ``Using Emacstool with GNU Emacs''@end tableLatest versions of the above files also available at@uref{ftp://ftp.gnu.org/pub/gnu/GNUinfo/}More GNU information, including back issues of the @cite{GNU'sBulletin}, are at@uref{http://www.gnu.org/bulletins/bulletins.html} and@uref{http://www.cs.pdx.edu/~trent/gnu/gnu.html}@node Help installing Emacs, Obtaining the FAQ, Informational files for Emacs, Getting help@section Where can I get help in installing Emacs?@cindex Installation help@cindex Help installing Emacs@xref{Installing Emacs}, for some basic installation hints, and see@ref{Problems building Emacs}, or @ref{Linking with -lX11 fails}, if youhave problems with the installation.The file @file{etc/SERVICE} (see @ref{File-name conventions}, if you'renot sure where that is) lists companies and individuals willing to sellyou help in installing or using Emacs. An up-to-date version this fileis available on @samp{ftp.gnu.org} (@pxref{Informational files forEmacs}).@node Obtaining the FAQ, , Help installing Emacs, Getting help@section Where can I get the latest version of this FAQ?@cindex FAQ, obtaining the@cindex Latest FAQ version, obtaining the@cindex Retrieving the latest FAQ version@cindex E-mail, retrieving the FAQ via@cindex Web, reading the FAQ on theThe Emacs FAQ is available in several ways:@itemize @bullet@itemInside of Emacs itself. You can get it from selecting the @samp{EmacsFAQ} option from the @samp{Help} menu of the Emacs menu bar at the topof any Emacs frame, or by typing @kbd{C-h C-f} (@kbd{M-x view-emacs-FAQ}).@itemVia USENET. If you can read news, the FAQ should be available in yournews spool, in both the @uref{news:gnu.emacs.help} and@uref{news:comp.emacs} newsgroups. Every news reader should allow youto read any news article that is still in the news spool, even if youhave read the article before. You may need to read the instructions foryour news reader to discover how to do this. In @file{rn}, this commandwill do this for you at the article selection level:@example?GNU Emacs Frequently Asked Questions?rc:m@end exampleIn Gnus, you should type @kbd{C-u C-x C-s} from the @file{*Summary*}buffer or @kbd{C-u @key{SPC}} from the @file{*Newsgroup*} buffer to viewall articles in a newsgroup.If the FAQ articles have expired and have been deleted from your newsspool, it might (or might not) do some good to complain to your newsadministrator, because the most recent FAQ should not expire for awhile.@itemVia HTTP or FTP. You can always fetch the latest FAQ from@uref{http://www.lerner.co.il/emacs/} and@uref{ftp://ftp.lerner.co.il/pub/emacs/}@itemIn the Emacs distribution. Since Emacs 18.56, the FAQ at the timeof release has been part of the Emacs distribution as either@file{etc/FAQ} or @file{man/faq.texi} (@pxref{File-name conventions}).@itemVia the World Wide Web. A hypertext version is available at@uref{http://www.lerner.co.il/emacs/}@itemVia anonymous ftp and e-mail from @file{rtfm.mit.edu} (and its mirror inEurope), the main repository for FAQs and other items posted tonews.answers. The Emacs FAQs are available at@uref{ftp://rtfm.mit.edu/pub/usenet/comp.emacs/} and@uref{ftp://ftp.uni-paderborn.de/pub/doc/FAQ/comp/emacs/}If you do not have access to anonymous FTP, you can access the archivesusing the @file{rtfm.mit.edu} mail server. The Emacs FAQ can beretrieved by sending mail to @email{mail-server@@rtfm.mit.edu} with ablank subject and containing@examplesend usenet/news.answers/GNU-Emacs-FAQ/diffssend usenet/news.answers/GNU-Emacs-FAQ/part1send usenet/news.answers/GNU-Emacs-FAQ/part2send usenet/news.answers/GNU-Emacs-FAQ/part3send usenet/news.answers/GNU-Emacs-FAQ/part4send usenet/news.answers/GNU-Emacs-FAQ/part5@end exampleFor more information, send email to @email{mail-server@@rtfm.mit.edu}with @samp{help} and @samp{index} in the body on separate lines.@itemAs the very last resort, you can e-mail a request to@email{emacs-faq@@lerner.co.il}. Don't do this unless you have made agood-faith effort to obtain the FAQ list via one of the methods listedabove.@end itemize@c ------------------------------------------------------------@node Status of Emacs, Common requests, Getting help, Top@chapter Status of Emacs@cindex Status of EmacsThis chapter gives you basic information about Emacs, including itslatest version status.@menu* Origin of the term Emacs::* Latest version of Emacs::* New in Emacs 20::* New in Emacs 21::@end menu@node Origin of the term Emacs, Latest version of Emacs, Status of Emacs, Status of Emacs@section Where does the name ``Emacs'' come from?@cindex Origin of the term ``Emacs''@cindex Emacs name origin@cindex TECO@cindex Original version of EmacsEmacs originally was an acronym for Editor MACroS. RMS says he ``pickedthe name Emacs because @key{E} was not in use as an abbreviation on ITS atthe time.'' The first Emacs was a set of macros written in 1976 at MITby RMS for the editor TECO (Text Editor and COrrector, originally TapeEditor and COrrector) under ITS on a PDP-10. RMS had already extendedTECO with a ``real-time'' full-screen mode with reprogrammable keys.Emacs was started by @email{gls@@east.sun.com, Guy Steele} as a projectto unify the many divergent TECO command sets and key bindings at MIT,and completed by RMS.Many people have said that TECO code looks a lot like line noise; youcan read more at @uref{news:alt.lang.teco}. Someone has written a TECOimplementation in Emacs Lisp (to find it, see @ref{Packages that do notcome with Emacs}); it would be an interesting project to run theoriginal TECO Emacs inside of Emacs.@cindex Why Emacs?For some not-so-serious alternative reasons for Emacs to have thatname, check out the file @file{etc/JOKES} (@pxref{File-nameconventions}).@node Latest version of Emacs, New in Emacs 20, Origin of the term Emacs, Status of Emacs@section What is the latest version of Emacs?@cindex Version, latest@cindex Latest version of EmacsEmacs @value{VER} is the current version as of this writing.@node New in Emacs 20, New in Emacs 21, Latest version of Emacs, Status of Emacs@section What is different about Emacs 20?@cindex Differences between Emacs 19 and Emacs 20@cindex Emacs 20, new features inTo find out what has changed in recent versions, type @kbd{C-h C-n}(@kbd{M-x view-emacs-news}). The oldest changes are at the bottom ofthe file, so you might want to read it starting there, rather than atthe top.The differences between Emacs versions 18 and 19 was rather dramatic;the introduction of frames, faces, and colors on windowing systems wasobvious to even the most casual user.There are differences between Emacs versions 19 and 20 as well, but manyare more subtle or harder to find. Among the changes are the inclusionof MULE code for languages that use non-Latin characters and for mixingseveral languages in the same document; the ``Customize'' facility formodifying variables without having to use Lisp; and automatic conversionof files from Macintosh, Microsoft, and Unix platforms.A number of older Lisp packages, such as Gnus, Supercite and thecalendar/diary, have been updated and enhanced to work with Emacs 20,and are now included with the standard distribution.@node New in Emacs 21, , New in Emacs 20, Status of Emacs@section What is different about Emacs 21?@cindex Differences between Emacs 20 and Emacs 21@cindex Emacs 21, new features in@cindex Recently introduced features@cindex Variable-size fonts@cindex Toolbar supportEmacs 21 features a thorough rewrite of the display engine. The newdisplay engine supports variable-size fonts, images, and can play soundson platforms which support that. As a result, the visual appearance ofEmacs, when it runs on a windowed display, is much more reminiscent ofmodern GUI programs, and includes 3D widgets (used for the mode line andthe scroll bars), a configurable and extensible toolbar, tooltips(a.k.a.@: balloon help), and other niceties.@cindex Colors on text-only terminals@cindex TTY colorsIn addition, Emacs 21 supports faces on text-only terminals. This meansthat you can now have colors when you run Emacs on a GNU/Linux consoleand on @code{xterm} with @kbd{emacs -nw}.@c ------------------------------------------------------------@node Common requests, Bugs and problems, Status of Emacs, Top@chapter Common requests@cindex Common requests@menu* Setting up a customization file::* Debugging a customization file::* Colors on a TTY::* Displaying the current line or column::* Displaying the current file name in the titlebar::* Turning on abbrevs by default::* Turning on auto-fill by default::* Associating modes with files::* Working with unprintable characters::* Highlighting a region::* Controlling case sensitivity::* Wrapping words automatically::* Spell-checkers::* Checking TeX and *roff documents::* Changing load-path::* Using an already running Emacs process::* Compiler error messages::* Indenting switch statements::* Customizing C and C++ indentation::* Horizontal scrolling::* Overwrite mode::* Turning off beeping::* Turning the volume down::* Automatic indentation::* Matching parentheses::* Hiding #ifdef lines::* Repeating commands::* Valid X resources::* Evaluating Emacs Lisp code::* Changing the length of a Tab::* Inserting > at the beginning of each line::* Underlining paragraphs::* Repeating a command as many times as possible::* Forcing the cursor to remain in the same column::* Forcing Emacs to iconify itself::* Using regular expressions::* Replacing text across multiple files::* Documentation for etags::* Disabling backups::* Disabling auto-save-mode::* Going to a line by number::* Modifying pull-down menus::* Deleting menus and menu options::* Turning on syntax highlighting::* Scrolling only one line::* Replacing highlighted text::* Editing MS-DOS files::* Filling paragraphs with a single space::* Escape sequences in shell output::@end menu@node Setting up a customization file, Colors on a TTY, Common requests, Common requests@section How do I set up a @file{.emacs} file properly?@cindex @file{.emacs} file, setting up@cindex @file{.emacs} file, locating@cindex Init file, setting up@cindex Customization file, setting up@inforef{Init File, Init File, emacs}.In general, new Emacs users should not have @file{.emacs} files, becauseit causes confusing non-standard behavior. Then they send questions to@email{help-gnu-emacs@@gnu.org} asking why Emacs isn't behaving asdocumented.Beginning with version 20.1, Emacs includes the new Customizefacility, which can be invoked using @kbd{M-x customize @key{RET}}.This allows users who are unfamiliar with Emacs Lisp to modify their@file{.emacs} files in a relatively straightforward way, using menusrather than Lisp code. Not all packages support Customize as of thiswriting, but the number is growing fairly steadily.While Customize might indeed make it easier to configure Emacs,consider taking a bit of time to learn Emacs Lisp and modifying your@file{.emacs} directly. Simple configuration options are describedrather completely in @inforef{Init File, Init File, emacs}, for usersinterested in performing frequently requested, basic tasks.Sometimes users are unsure as to where their @file{.emacs} file shouldbe found. Visiting the file as @file{~/.emacs} from Emacs will findthe correct file.@node Colors on a TTY, Debugging a customization file, Setting up a customization file, Common requests@section How do I get colors and syntax highlighting on a TTY?@cindex Colors on a TTY@cindex Syntax highlighting on a TTY@cindex Console, colorsIn Emacs 21.1 and later, colors and faces are supported in non-windowed mode,i.e.@: on Unix and GNU/Linux text-only terminals and consoles, and wheninvoked as @samp{emacs -nw} on X and MS-Windows. (Colors and faces weresupported in the MS-DOS port since Emacs 19.29.) Emacs automaticallydetects color support at startup and uses it if available. If you thinkthat your terminal supports colors, but Emacs won't use them, check the@code{termcap} entry for your display type for color-relatedcapabilities.The command @kbd{M-x list-colors-display} pops up a window whichexhibits all the colors Emacs knows about on the current display.Syntax highlighting is usually turned off by default; see @ref{Turningon syntax highlighting}, for instructions how to turn it on.@node Debugging a customization file, Displaying the current line or column, Colors on a TTY, Common requests@section How do I debug a @file{.emacs} file?@cindex Debugging @file{.emacs} file@cindex @file{.emacs} debugging@cindex Init file debugging@cindex @samp{-debug-init} optionStart Emacs with the @samp{-debug-init} command-line option. Thisenables the Emacs Lisp debugger before evaluating your @file{.emacs}file, and places you in the debugger if something goes wrong. The topline in the @file{trace-back} buffer will be the error message, and thesecond or third line of that buffer will display the Lisp code from your@file{.emacs} file that caused the problem.You can also evaluate an individual function or argument to a functionin your @file{.emacs} file by moving the cursor to the end of thefunction or argument and typing @kbd{C-x C-e} (@kbd{M-xeval-last-sexp}).Use @kbd{C-h v} (@kbd{M-x describe-variable}) to check the value ofvariables which you are trying to set or use.@node Displaying the current line or column, Displaying the current file name in the titlebar, Debugging a customization file, Common requests@section How do I make Emacs display the current line (or column) number?@cindex @code{line-number-mode}@cindex Displaying the current line or column@cindex Line number, displaying the current@cindex Column, displaying the current@cindex @code{mode-line-format}To have Emacs automatically display the current line number of the pointin the mode line, do @kbd{M-x line-number-mode}. You can also put theform@lisp(setq line-number-mode t)@end lisp@noindentin your @file{.emacs} file to achieve this whenever you start Emacs.(Line number display is on by default, unless your site-specificinitialization disables it.) Note that Emacs will not display the linenumber if the buffer's size in bytes is larger than the value of thevariable @code{line-number-display-limit}.As of Emacs 20, you can similarly display the current column with@kbd{M-x column-number-mode}, or by putting the form@lisp(setq column-number-mode t)@end lisp@noindentin your @file{.emacs} file.The @code{"%c"} format specifier in the variable @code{mode-line-format}will insert the current column's value into the mode line. See thedocumentation for @code{mode-line-format} (using @kbd{C-h vmode-line-format @key{RET}}) for more information on how to set and usethis variable.Users of all Emacs versions can display the current column using the@samp{column} package written by @email{abraham@@dina.kvl.dk, PerAbrahamsen}. @xref{Packages that do not come with Emacs}, forinstructions on how to get it.@cindex Set number capability in @code{vi} emulatorsNone of the @code{vi} emulation modes provide the ``set number''capability of @code{vi} (as far as we know). The @samp{setnu} packagewritten by @email{kyle@@wonderworks.com, Kyle Jones} provides thisfeature. So too does @samp{wb-line-number}, written by@email{naoki.y.nakamura@@nifty.com, Naoki Nakamura}.@node Displaying the current file name in the titlebar, Turning on abbrevs by default, Displaying the current line or column, Common requests@section How can I modify the titlebar to contain the current file name?@cindex Titlebar, displaying the current file name in@cindex File name, displaying in the titlebar@cindex @code{frame-title-format}The contents of an Emacs frame's titlebar is controlled by the variable@code{frame-title-format}, which has the same structure as the variable@code{mode-line-format}. (Use @kbd{C-h v} or @kbd{M-xdescribe-variable} to get information about one or both of thesevariables.)By default, the titlebar for a frame does contain the name of the buffercurrently being visited, except if there is a single frame. In such acase, the titlebar contains Emacs invocation name and the name of themachine at which Emacs was invoked. This is done by setting@code{frame-title-format} to the default value of@lisp(multiple-frames "%b" ("" invocation-name "@@" system-name))@end lispTo modify the behavior such that frame titlebars contain the buffer'sname regardless of the number of existing frames, include the followingin your @file{.emacs}:@lisp(setq frame-title-format "%b")@end lisp@node Turning on abbrevs by default, Turning on auto-fill by default, Displaying the current file name in the titlebar, Common requests@section How do I turn on abbrevs by default just in mode @var{mymode}?@cindex Abbrevs, turning on by defaultPut this in your @file{.emacs} file:@lisp(condition-case () (quietly-read-abbrev-file) (file-error nil))(add-hook '@var{mymode}-mode-hook (lambda () (setq abbrev-mode t)))@end lisp@node Turning on auto-fill by default, Associating modes with files, Turning on abbrevs by default, Common requests@section How do I turn on @code{auto-fill-mode} by default?@cindex @code{auto-fill-mode}, activating automatically@cindex Filling automatically@cindex Automatic entry to @code{auto-fill-mode}To turn on @code{auto-fill-mode} just once for one buffer, use @kbd{M-xauto-fill-mode}.To turn it on for every buffer in a certain mode, you must use the hookfor that mode. For example, to turn on @code{auto-fill} mode for alltext buffers, including the following in your @file{.emacs} file:@lisp(add-hook 'text-mode-hook 'turn-on-auto-fill)@end lispIf you want @code{auto-fill} mode on in all major modes, do this:@lisp(setq-default auto-fill-function 'do-auto-fill)@end lisp@node Associating modes with files, Working with unprintable characters, Turning on auto-fill by default, Common requests@section How do I make Emacs use a certain major mode for certain files?@cindex Associating modes with files@cindex File extensions and modes@cindex @code{auto-mode-alist}, modifying@cindex Modes, associating with file extensionsIf you want to use a certain mode @var{foo} for all files whose names endwith the extension @file{.@var{bar}}, this will do it for you:@lisp(setq auto-mode-alist (cons '("\\.@var{bar}\\'" . @var{foo}-mode) auto-mode-alist))@end lispOtherwise put this somewhere in the first line of any file you want toedit in the mode @var{foo} (in the second line, if the first line beginswith @samp{#!}):@example-*- @var{foo} -*-@end example@cindex Major mode for shell scriptsBeginning with Emacs 19, the variable @code{interpreter-mode-alist}specifies which mode to use when loading a shell script. (Emacsdetermines which interpreter you're using by examining the first line ofthe script.) This feature only applies when the file name doesn'tindicate which mode to use. Use @kbd{C-h v} (or @kbd{M-xdescribe-variable}) on @code{interpreter-mode-alist} to learn more.@node Working with unprintable characters, Highlighting a region, Associating modes with files, Common requests@section How do I search for, delete, or replace unprintable (eight-bit or control) characters?@cindex Unprintable characters, working with@cindex Working with unprintable characters@cindex Control characters, working with@cindex Eight-bit characters, working with@cindex Searching for unprintable characters@cindex Regexps and unprintable charactersTo search for a single character that appears in the buffer as, forexample, @samp{\237}, you can type @kbd{C-s C-q 2 3 7}. (This assumesthe value of @code{search-quote-char} is 17 (i.e., @kbd{C-q}).)Searching for @strong{all} unprintable characters is best done with aregular expression (@dfn{regexp}) search. The easiest regexp to use forthe unprintable chars is the complement of the regexp for the printablechars.@itemize @bullet@itemRegexp for the printable chars: @samp{[\t\n\r\f -~]}@itemRegexp for the unprintable chars: @samp{[^\t\n\r\f -~]}@end itemizeTo type these special characters in an interactive argument to@code{isearch-forward-regexp} or @code{re-search-forward}, you need touse @kbd{C-q}. (@samp{\t}, @samp{\n}, @samp{\r}, and @samp{\f} standrespectively for @key{TAB}, @key{LFD}, @key{RET}, and @kbd{C-l}.) So,to search for unprintable characters using @code{re-search-forward}:@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}}Using @code{isearch-forward-regexp}:@kbd{C-M-s [^ @key{TAB} @key{LFD} C-q @key{RET} C-q C-l @key{SPC} -~]}To delete all unprintable characters, simply use replace-regexp:@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}}Replacing is similar to the above. To replace all unprintablecharacters with a colon, use: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}@itemize @bullet@itemYou don't need to quote @key{TAB} with either isearch or typingsomething in the minibuffer.@end itemize@node Highlighting a region, Controlling case sensitivity, Working with unprintable characters, Common requests@section How can I highlight a region of text in Emacs?@cindex Highlighting text@cindex Text, highlighting@cindex @code{transient-mark-mode}@cindex Region, highlighting aYou can cause the region to be highlighted when the mark is active byincluding@lisp(transient-mark-mode t)@end lisp@noindentin your @file{.emacs} file. (Also see @ref{Turning on syntaxhighlighting}.)@node Controlling case sensitivity, Wrapping words automatically, Highlighting a region, Common requests@section How do I control Emacs's case-sensitivity when searching/replacing?@cindex @code{case-fold-search}@cindex Case sensitivity of searches@cindex Searching without case sensitivity@cindex Ignoring case in searchesFor searching, the value of the variable @code{case-fold-search}determines whether they are case sensitive:@lisp(setq case-fold-search nil) ; make searches case sensitive(setq case-fold-search t) ; make searches case insensitive@end lisp@cindex Case sensitivity in replacements@cindex Replacing, and case sensitivity@cindex @code{case-replace}Similarly, for replacing, the variable @code{case-replace} determineswhether replacements preserve case.To change the case sensitivity just for one major mode, use the majormode's hook. For example:@lisp(add-hook '@var{foo}-mode-hook (lambda () (setq case-fold-search nil)))@end lisp@node Wrapping words automatically, Spell-checkers, Controlling case sensitivity, Common requests@section How do I make Emacs wrap words for me?@cindex Wrapping word automatically@cindex Wrapping lines@cindex Line wrap@cindex @code{auto-fill-mode}, introduction to@cindex Maximum line width, default value@cindex @code{fill-column}, default valueUse @code{auto-fill-mode}, activated by typing @kbd{M-x auto-fill-mode}.The default maximum line width is 70, determined by the variable@code{fill-column}. To learn how to turn this on automatically, see@ref{Turning on auto-fill by default}.@node Spell-checkers, Checking TeX and *roff documents, Wrapping words automatically, Common requests@section Where can I get a better spelling checker for Emacs?@cindex Checking spelling@cindex Spelling, checking text documentsUse Ispell. @xref{Ispell}.@node Checking TeX and *roff documents, Changing load-path, Spell-checkers, Common requests@section How can I spell-check @TeX{} or *roff documents?@cindex Spelling, checking @TeX{} documents@cindex @TeX{} documents, checking spelling inUse Ispell. Ispell can handle @TeX{} and *roff documents.@xref{Ispell}.@node Changing load-path, Using an already running Emacs process, Checking TeX and *roff documents, Common requests@section How do I change @code{load-path}?@cindex @code{load-path}, modifying@cindex Modifying @code{load-path}@cindex Adding to @code{load-path}In general, you should only add to the @code{load-path}. You can adddirectory @var{/dir/subdir} to the load path like this:@lisp(setq load-path (cons "/dir/subdir/" load-path))@end lispTo do this relative to your home directory:@lisp(setq load-path (cons "~/mysubdir/" load-path))@end lisp@node Using an already running Emacs process, Compiler error messages, Changing load-path, Common requests@section How do I use an already running Emacs from another window?@cindex @code{emacsclient}@cindex Emacs server functions@cindex Using an existing Emacs process@code{emacsclient}, which comes with Emacs, is for editing a file usingan already running Emacs rather than starting up a new Emacs. It doesthis by sending a request to the already running Emacs, which must beexpecting the request.@itemize @bullet@itemSetup:Emacs must have executed the @code{server-start} function for@samp{emacsclient} to work. This can be done either by a command lineoption:@exampleemacs -f server-start@end exampleor by invoking @code{server-start} from @file{.emacs}:@lisp(if (@var{some conditions are met}) (server-start))@end lispWhen this is done, Emacs creates a Unix domain socket.The socket is either named @file{.emacs_server}, in the user's home directory,or @file{esrv-@var{userid}-@var{systemname}}, in the @file{/tmp}directory, depending on your system. See @code{server-socket-name}.To get your news reader, mail reader, etc., to invoke@samp{emacsclient}, try setting the environment variable @code{EDITOR}(or sometimes @code{VISUAL}) to the value @samp{emacsclient}. You mayhave to specify the full pathname of the @samp{emacsclient} programinstead. Examples:@example# csh commands:setenv EDITOR emacsclient# using full pathnamesetenv EDITOR /usr/local/emacs/etc/emacsclient# sh command:EDITOR=emacsclient ; export EDITOR@end example@itemNormal use:When @samp{emacsclient} is run, it connects to the @file{.emacs_server}socket and passes its command line options to @samp{server}. When@samp{server} receives these requests, it sends this information to thethe Emacs process, which at the next opportunity will visit the filesspecified. (Line numbers can be specified just like with Emacs.) Theuser will have to switch to the Emacs window by hand. When the user isdone editing a file, the user can type @kbd{C-x #} (or @kbd{M-xserver-edit}) to indicate this. If there is another buffer requested by@code{emacsclient}, Emacs will switch to it; otherwise@code{emacsclient} will exit, signaling the calling program to continue.@samp{emacsclient} and @samp{server} must be running on machines whichshare the same filesystem for this to work. The pathnames that@samp{emacsclient} specifies should be correct for the filesystem thatthe Emacs process sees. The Emacs process should not be suspended atthe time @samp{emacsclient} is invoked. On Unix and GNU/Linux systems,@samp{emacsclient} should either be invoked from another X window, orfrom a shell window inside Emacs itself, or from another interactivesession, e.g., by means of a @code{screen} program.@cindex @code{gnuserv}There is an enhanced version of @samp{emacsclient}/server called@samp{gnuserv}, written by @email{ange@@hplb.hpl.hp.com, Andy Norman}(@pxref{Packages that do not come with Emacs}). @samp{gnuserv} usesInternet domain sockets, so it can work across most network connections.It also supports the execution of arbitrary Emacs Lisp forms and doesnot require the client program to wait for completion.The alpha version of an enhanced @samp{gnuserv} is available at@uref{ftp://ftp.wellfleet.com/netman/psmith/emacs/gnuserv-2.1alpha.tar.gz}The version available from @uref{http://meltin.net/hacks/emacs/} ismore recent, and has been tested with Emacs 21.2.@end itemize@node Compiler error messages, Indenting switch statements, Using an already running Emacs process, Common requests@section How do I make Emacs recognize my compiler's funny error messages?@cindex Compiler error messages, recognizing@cindex Recognizing non-standard compiler errors@cindex Regexps for recognizing compiler errors@cindex Errors, recognizing compilerThe variable @code{compilation-error-regexp-alist} helps control howEmacs parses your compiler output. It is a list of triplets of the form:@code{(@var{regexp} @var{file-idx} @var{line-idx})}, where @var{regexp},@var{file-idx} and @var{line-idx} are strings. To help determine whatthe constituent elements should be, load @file{compile.el} and then type@kbd{C-h v compilation-error-regexp-alist @key{RET}} to see the currentvalue. A good idea is to look at @file{compile.el} itself as thecomments included for this variable are quite useful---the regularexpressions required for your compiler's output may be very close to onealready provided. Once you have determined the proper regexps, use thefollowing to inform Emacs of your changes:@lisp(setq compilation-error-regexp-alist (cons '(@var{regexp} @var{file-idx} @var{line-idx}) compilation-error-regexp-alist))@end lisp@node Indenting switch statements, Customizing C and C++ indentation, Compiler error messages, Common requests@section How do I change the indentation for @code{switch}?@cindex @code{switch}, indenting@cindex Indenting of @code{switch}Many people want to indent their @code{switch} statements like this:@examplef()@{ switch(x) @{ case A: x1; break; case B: x2; break; default: x3; @}@}@end exampleThe solution at first appears to be: set @code{c-indent-level} to 4 and@code{c-label-offset} to -2. However, this will give you an indentationspacing of four instead of two.The @emph{real} solution is to use @code{cc-mode} (the default mode forC programming in Emacs 20 and later) and add the following line to yoyr@file{.emacs}:@lisp(c-set-offset 'case-label '+)@end lispThere appears to be no way to do this with the old @code{c-mode}.@node Customizing C and C++ indentation, Horizontal scrolling, Indenting switch statements, Common requests@section How to customize indentation in C, C@t{++}, and Java buffers?@cindex Indentation, how to customize@cindex Customize indentationThe Emacs @code{cc-mode} features an interactive procedure forcustomizing the indentation style, which is fully explained in the@cite{CC Mode} manual that is part of the Emacs distribution, see@ref{Customizing Indentation, , Customization Indentation, ccmode,The CC Mode Manual}. Here's a short summary of the procedure:@enumerate@itemGo to the beginning of the first line where you don't like theindentation and type @kbd{C-c C-o}. Emacs will prompt you for thesyntactic symbol; type @key{RET} to accept the default it suggests.@itemEmacs now prompts for the offset of this syntactic symbol, showing thedefault (the current definition) inside parentheses. You can chooseone of these:@table @code@item 0No extra indentation.@item +Indent one basic offset.@item -Outdent one basic offset.@item ++Indent two basic offsets@item --Outdent two basic offsets.@item *Indent half basic offset.@item /Outdent half basic offset.@end table@itemAfter choosing one of these symbols, type @kbd{C-c C-q} to reindentthe line or the block according to what you just specified.@itemIf you don't like the result, go back to step 1. Otherwise, add thefollowing line to your @file{.emacs}:@lisp(c-set-offset '@var{syntactic-symbol} @var{offset})@end lisp@noindentwhere @var{syntactic-symbol} is the name Emacs shows in the minibufferwhen you type @kbd{C-c C-o} at the beginning of the line, and@var{offset} is one of the indentation symbols listed above (@code{+},@code{/}, @code{0}, etc.) that you've chosen during the interactiveprocedure.@itemGo to the next line whose indentation is not to your liking and repeatthe process there.@end enumerateIt is recommended to put all the resulting @code{(c-set-offset ...)}customizations inside a C mode hook, like this:@lisp(defun my-c-mode-hook () (c-set-offset ...) (c-set-offset ...))(add-hook 'c-mode-hook 'my-c-mode-hook)@end lisp@noindentUsing @code{c-mode-hook} avoids the need to put a @w{@code{(require'cc-mode)}} into your @file{.emacs} file, because @code{c-set-offset}might be unavailable when @code{cc-mode} is not loaded.Note that @code{c-mode-hook} runs for C source files only; use@code{c++-mode-hook} for C@t{++} sources, @code{java-mode-hook} forJava sources, etc. If you want the same customizations to be ineffect in @emph{all} languages supported by @code{cc-mode}, use@code{c-mode-common-hook}.@node Horizontal scrolling, Overwrite mode, Customizing C and C++ indentation, Common requests@section How can I make Emacs automatically scroll horizontally?@cindex @code{hscroll-mode}@cindex Horizontal scrolling@cindex Scrolling horizontallyIn Emacs 21 and later, this is on by default: if the variable@code{truncate-lines} is non-@code{nil} in the current buffer, Emacsautomatically scrolls the display horizontally when point moves off theleft or right edge of the window.In Emacs 20, use the @code{hscroll-mode}. Here is some information fromthe documentation, available by typing @kbd{C-h f hscroll-mode @key{RET}}:Automatically scroll horizontally when the point moves off theleft or right edge of the window.@itemize @minus@itemType @kbd{M-x hscroll-mode} to enable it in the current buffer.@itemType @kbd{M-x hscroll-global-mode} to enable it in every buffer.@item@code{turn-on-hscroll} is useful in mode hooks as in:@lisp(add-hook 'text-mode-hook 'turn-on-hscroll)@end lisp@item@code{hscroll-margin} controls how close the cursor can get to theedge of the window.@item@code{hscroll-step-percent} controls how far to jump once we decide to do so.@end itemize@node Overwrite mode, Turning off beeping, Horizontal scrolling, Common requests@section How do I make Emacs ``typeover'' or ``overwrite'' instead of inserting?@cindex @key{Insert}@cindex @code{overwrite-mode}@cindex Overwriting existing text@cindex Toggling @code{overwrite-mode}@kbd{M-x overwrite-mode} (a minor mode). This toggles@code{overwrite-mode} on and off, so exiting from @code{overwrite-mode}is as easy as another @kbd{M-x overwrite-mode}.On some systems, @key{Insert} toggles @code{overwrite-mode} on and off.@node Turning off beeping, Turning the volume down, Overwrite mode, Common requests@section How do I stop Emacs from beeping on a terminal?@cindex Beeping, turning off@cindex Visible bell@cindex Bell, visible@email{martin@@cc.gatech.edu, Martin R. Frank} writes:Tell Emacs to use the @dfn{visible bell} instead of the audible bell,and set the visible bell to nothing.That is, put the following in your @code{TERMCAP} environment variable(assuming you have one):@example... :vb=: ...@end exampleAnd evaluate the following Lisp form:@example(setq visible-bell t)@end example@node Turning the volume down, Automatic indentation, Turning off beeping, Common requests@section How do I turn down the bell volume in Emacs running under X?@cindex Bell, volume of@cindex Volume of bellOn X Window system, you can adjust the bell volume and duration for allprograms with the shell command @code{xset}.Invoking @code{xset} without any arguments produces some basicinformation, including the following:@exampleusage: xset [-display host:dpy] option ... To turn bell off: -b b off b 0 To set bell volume, pitch and duration: b [vol [pitch [dur]]] b on@end example@node Automatic indentation, Matching parentheses, Turning the volume down, Common requests@section How do I tell Emacs to automatically indent a new line to the indentation of the previous line?@cindex Indenting new lines@cindex New lines, indenting of@cindex Previous line, indenting according to@cindex Text indentationSuch behavior is automatic in Emacs 20 and later. From the@file{etc/NEWS} file for Emacs 20.2:@example** In Text mode, now only blank lines separate paragraphs. This makesit possible to get the full benefit of Adaptive Fill mode in Text mode,and other modes derived from it (such as Mail mode). @key{TAB} in Textmode now runs the command @code{indent-relative}; this makes a practicaldifference only when you use indented paragraphs.As a result, the old Indented Text mode is now identical to Text mode,and is an alias for it.If you want spaces at the beginning of a line to start a paragraph, usethe new mode, Paragraph Indent Text mode.@end example@cindex Prefixing lines@cindex Fill prefixIf you have @code{auto-fill-mode} turned on (@pxref{Turning on auto-fillby default}), you can tell Emacs to prefix every line with a certaincharacter sequence, the @dfn{fill prefix}. Type the prefix at thebeginning of a line, position point after it, and then type @kbd{C-x .}(@code{set-fill-prefix}) to set the fill prefix. Thereafter,auto-filling will automatically put the fill prefix at the beginning ofnew lines, and @kbd{M-q} (@code{fill-paragraph}) will maintain any fillprefix when refilling the paragraph.If you have paragraphs with different levels of indentation, you willhave to set the fill prefix to the correct value each time you move to anew paragraph. There are many packages available to deal with this(@pxref{Packages that do not come with Emacs}). Look for ``fill'' and``indent'' keywords for guidance.@node Matching parentheses, Hiding #ifdef lines, Automatic indentation, Common requests@section How do I show which parenthesis matches the one I'm looking at?@cindex Parentheses, matching@cindex @file{paren.el}@cindex Highlighting matching parentheses@cindex Pairs of parentheses, highlighting@cindex Matching parenthesesAs of version 19, Emacs comes with @file{paren.el}, which (when loaded)will automatically highlight matching parentheses whenever point (i.e.,the cursor) is located over one. To load @file{paren.el} automatically,include the line@lisp(require 'paren)@end lispin your @file{.emacs} file. @email{shutkoa@@ugsolutions.com, Alan Shutko}reports that as of version 20.1, you must also call @code{show-paren-mode} inyour @file{.emacs} file:@lisp(show-paren-mode 1)@end lispCustomize will let you turn on @code{show-paren-mode}. Use @kbd{M-xcustomize-group @key{RET} paren-showing @key{RET}}. From withinCustomize, you can also go directly to the ``paren-showing'' group.Alternatives to paren include:@itemize @bullet@itemIf you're looking at a right parenthesis (or brace or bracket) you candelete it and reinsert it. Emacs will momentarily move the cursor tothe matching parenthesis.@item@kbd{C-M-f} (@code{forward-sexp}) and @kbd{C-M-b} (@code{backward-sexp})will skip over one set of balanced parentheses, so you can see whichparentheses match. (You can train it to skip over balanced bracketsand braces at the same time by modifying the syntax table.)@cindex Show matching paren as in @code{vi}@itemHere is some Emacs Lisp that will make the @key{%} key show the matchingparenthesis, like in @code{vi}. In addition, if the cursor isn't over aparenthesis, it simply inserts a % like normal.@lisp;; By an unknown contributor(global-set-key "%" 'match-paren)(defun match-paren (arg) "Go to the matching paren if on a paren; otherwise insert %." (interactive "p") (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1)) ((looking-at "\\s\)") (forward-char 1) (backward-list 1)) (t (self-insert-command (or arg 1)))))@end lisp@end itemize@node Hiding #ifdef lines, Repeating commands, Matching parentheses, Common requests@section In C mode, can I show just the lines that will be left after @code{#ifdef} commands are handled by the compiler?@cindex @code{#ifdef}, selective display of@cindex @code{hide-ifdef-mode}@cindex Hiding @code{#ifdef} text@cindex Selectively displaying @code{#ifdef} code@kbd{M-x hide-ifdef-mode}. (This is a minor mode.) You might also wantto investigate @file{cpp.el}, which is distributed with Emacs.@node Repeating commands, Valid X resources, Hiding #ifdef lines, Common requests@section Is there an equivalent to the @code{.} (dot) command of vi?@cindex Repeating commands as with @code{vi}@cindex Command, repeat last@cindex @code{.}, equivalent to @code{vi} command(@code{.} is the redo command in @code{vi}. It redoes the lastinsertion/deletion.)As of Emacs 20.3, there is indeed a @code{repeat} command (@kbd{C-x z})that repeats the last command. If you preface it with a prefixargument, the prefix arg is applied to the command.You can also type @kbd{C-x @key{ESC} @key{ESC}}(@code{repeat-complex-command}) to reinvoke commands that used theminibuffer to get arguments. In @code{repeat-complex-command} you cantype @kbd{M-p} and @kbd{M-n} (and also up-arrow and down-arrow, if yourkeyboard has these keys) to scan through all the different complexcommands you've typed.To repeat a set of commands, use keyboard macros. (@inforef{KeyboardMacros, Keyboard Macros, emacs}.)If you're really desperate for the @code{.} command, use VIPER, a@code{vi} emulation mode which comes with Emacs, and which appears tosupport it. (@xref{VIPER}.)@node Valid X resources, Evaluating Emacs Lisp code, Repeating commands, Common requests@section What are the valid X resource settings (i.e., stuff in .Xdefaults)?@cindex Resources, X@cindex X resources@cindex Setting X resources@inforef{X Resources, X Resources, emacs}.You can also use a resource editor, such as editres (for X11R5 andonwards), to look at the resource names for the menu bar, assuming Emacswas compiled with the X toolkit.@node Evaluating Emacs Lisp code, Changing the length of a Tab, Valid X resources, Common requests@section How do I execute (``evaluate'') a piece of Emacs Lisp code?@cindex Evaluating Lisp code@cindex Lisp forms, evaluatingThere are a number of ways to execute (@dfn{evaluate}, in Lisp lingo) anEmacs Lisp @dfn{form}:@itemize @bullet@itemIf you want it evaluated every time you run Emacs, put it in a filenamed @file{.emacs} in your home directory. This is known as ``your@file{.emacs} file,'' and contains all of your personal customizations.@itemYou can type the form in the @file{*scratch*} buffer, and then type@key{LFD} (or @kbd{C-j}) after it. The result of evaluating the formwill be inserted in the buffer.@itemIn @code{emacs-lisp-mode}, typing @kbd{C-M-x} evaluates a top-level formbefore or around point.@itemTyping @kbd{C-x C-e} in any buffer evaluates the Lisp form immediatelybefore point and prints its value in the echo area.@itemTyping @kbd{M-:} or @kbd{M-x eval-expression} allows you to type a Lispform in the minibuffer which will be evaluated once you press @key{RET}.@itemYou can use @kbd{M-x load-file} to have Emacs evaluate all the Lispforms in a file. (To do this from Lisp use the function @code{load}instead.)The functions @code{load-library}, @code{eval-region},@code{eval-current-buffer}, @code{require}, and @code{autoload} are alsouseful; see @ref{Emacs Lisp documentation}, if you want to learn moreabout them.@end itemize@node Changing the length of a Tab, Inserting > at the beginning of each line, Evaluating Emacs Lisp code, Common requests@section How do I change Emacs's idea of the @key{TAB} character's length?@cindex Tab length@cindex Length of tab character@cindex @code{default-tab-width}Set the variable @code{default-tab-width}. For example, to set@key{TAB} stops every 10 characters, insert the following in your@file{.emacs} file:@lisp(setq default-tab-width 10)@end lispDo not confuse variable @code{tab-width} with variable@code{tab-stop-list}. The former is used for the display of literal@key{TAB} characters. The latter controls what characters are insertedwhen you press the @key{TAB} character in certain modes.@node Inserting > at the beginning of each line, Underlining paragraphs, Changing the length of a Tab, Common requests@section How do I insert @samp{>} at the beginning of every line?@cindex Prefix character, inserting in mail/news replies@cindex Replies to mail/news, inserting a prefix character@cindex @code{mail-yank-prefix}@cindex Mail replies, inserting a prefix character@cindex News replies, inserting a prefix characterTo do this to an entire buffer, type @kbd{M-< M-x replace-regexp@key{RET} ^ @key{RET} > @key{RET}}.To do this to a region, use @code{string-insert-rectangle}.Set the mark (@kbd{C-@key{SPC}}) at the beginning of the first line youwant to prefix, move the cursor to last line to be prefixed, and type@kbd{M-x string-insert-rectangle @key{RET}}. To do this for the wholebuffer, type @kbd{C-x h M-x string-insert-rectangle @key{RET}}.If you are trying to prefix a yanked mail message with @samp{>}, youmight want to set the variable @code{mail-yank-prefix}. Better yet, usethe Supercite package (@pxref{Supercite}), which provides flexiblecitation for yanked mail and news messages; it is included in Emacssince version 19.20. @xref{Changing the included text prefix}, foradditional information.@node Underlining paragraphs, Repeating a command as many times as possible, Inserting > at the beginning of each line, Common requests@section How do I insert @samp{_^H} before each character in a region to get an underlined paragraph?@cindex Underlining a region of text@cindex @code{underline-region}Mark the region and then type @kbd{M-x underline-region @key{RET}}.@node Repeating a command as many times as possible, Forcing the cursor to remain in the same column, Underlining paragraphs, Common requests@section How do I repeat a command as many times as possible?@cindex Repeating commands many times@cindex Commands, repeating many timesUse @kbd{C-x (} and @kbd{C-x )} to make a keyboard macro that invokesthe command and then type @kbd{M-0 C-x e}.Any messages your command prints in the echo area will be suppressed.If you need to repeat a command a small number of times, you can use@kbd{C-x z}, see @ref{Repeating commands}.@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@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?@cindex @code{picture-mode}@cindex Remaining in the same column, regardless of contents@cindex Vertical movement in empty documents@kbd{M-x picture-mode}.@node Forcing Emacs to iconify itself, Using regular expressions, Forcing the cursor to remain in the same column, Common requests@section How do I tell Emacs to iconify itself?@cindex Iconification under the X Window System@cindex X Window System and iconification@cindex Suspending Emacs@kbd{C-z} iconifies Emacs when running under X and suspends Emacsotherwise. @inforef{Frame Commands, Frame Commands, emacs}.@node Using regular expressions, Replacing text across multiple files, Forcing Emacs to iconify itself, Common requests@section How do I use regexps (regular expressions) in Emacs?@cindex Regexps@cindex Regular expressions@cindex Differences between Unix and Emacs regexps@cindex Unix regeps, differences from Emacs@cindex Text strings, putting regexps in@inforef{Regexps, Regexps, emacs}.The @code{or} operator is @samp{\|}, not @samp{|}, and the grouping operatorsare @samp{\(} and @samp{\)}. Also, the string syntax for a backslash is@samp{\\}. To specify a regular expression like @samp{xxx\(foo\|bar\)}in a Lisp string, use @samp{xxx\\(foo\\|bar\\)}.Note the doubled backslashes!@itemize @bullet@itemUnlike in Unix @file{grep}, @file{sed}, etc., a complement character set(@samp{[^...]}) can match a newline character (@key{LFD} a.k.a.@:@kbd{C-j} a.k.a.@: @samp{\n}), unless newline is mentioned as one of thecharacters not to match.@itemThe character syntax regexps (e.g., @samp{\sw}) are notmeaningful inside character set regexps (e.g., @samp{[aeiou]}). (Thisis actually typical for regexp syntax.)@end itemize@node Replacing text across multiple files, Documentation for etags, Using regular expressions, Common requests@section How do I perform a replace operation across more than one file?@cindex Replacing strings across files@cindex Multiple files, replacing across@cindex Files, replacing strings across multipleThe ``tags'' feature of Emacs includes the command@code{tags-query-replace} which performs a query-replace across all thefiles mentioned in the @file{TAGS} file. @inforef{Tags Search, Tags Search,emacs}.As of Emacs 19.29, Dired mode (@kbd{M-x dired @key{RET}}, or @kbd{C-xd}) supports the command @code{dired-do-query-replace}, which allowsusers to replace regular expressions in multiple files.@node Documentation for etags, Disabling backups, Replacing text across multiple files, Common requests@section Where is the documentation for @code{etags}?@cindex Documentation for @code{etags}@cindex @code{etags}, documentation forThe @code{etags} man page should be in the same place as the@code{emacs} man page.Quick command-line switch descriptions are also available. For example,@samp{etags -H}.@node Disabling backups, Disabling auto-save-mode, Documentation for etags, Common requests@section How do I disable backup files?@cindex Backups, disabling@cindex Disabling backupsYou probably don't want to do this, since backups are useful, especiallywhen something goes wrong.To avoid seeing backup files (and other ``uninteresting'' files) in Dired,load @code{dired-x} by adding the following to your @file{.emacs} file:@lisp(add-hook 'dired-load-hook (lambda () (load "dired-x")))@end lispWith @code{dired-x} loaded, @kbd{M-o} toggles omitting in each dired buffer.You can make omitting the default for new dired buffers by putting thefollowing in your @file{.emacs}:@lisp(add-hook 'dired-mode-hook 'dired-omit-toggle)@end lispIf you're tired of seeing backup files whenever you do an @samp{ls} atthe Unix shell, try GNU @code{ls} with the @samp{-B} option. GNU@code{ls} is part of the GNU Fileutils package, available from@samp{ftp.gnu.org} and its mirrors (@pxref{Current GNU distributions}).To disable or change the way backups are made, @inforef{Backup Names, ,emacs}.@cindex Backup files in a single directoryBeginning with Emacs 21.1, you can control where Emacs puts backup filesby customizing the variable @code{backup-directory-alist}. Thisvariable's value specifies that files whose names match specific pattersshould have their backups put in certain directories. A typical use isto add the element @code{("." . @var{dir})} to force Emacs to put@strong{all} backup files in the directory @file{dir}.@node Disabling auto-save-mode, Going to a line by number, Disabling backups, Common requests@section How do I disable @code{auto-save-mode}?@cindex Disabling @code{auto-save-mode}@cindex Auto-saving@cindex Saving at frequent intervalsYou probably don't want to do this, since auto-saving is useful,especially when Emacs or your computer crashes while you are editing adocument.Instead, you might want to change the variable@code{auto-save-interval}, which specifies how many keystrokes Emacswaits before auto-saving. Increasing this value forces Emacs to waitlonger between auto-saves, which might annoy you less.You might also want to look into Sebastian Kremer's @code{auto-save}package (@pxref{Packages that do not come with Emacs}). Thispackage also allows you to place all auto-save files in one directory,such as @file{/tmp}.To disable or change how @code{auto-save-mode} works, @inforef{AutoSave, , emacs}.@node Going to a line by number, Modifying pull-down menus, Disabling auto-save-mode, Common requests@section How can I go to a certain line given its number?@cindex Going to a line by number@cindex Compilation error messages@cindex RecompilationAre you sure you indeed need to go to a line by its number? Perhaps allyou want is to display a line in your source file for which a compilerprinted an error message? If so, compiling from within Emacs using the@kbd{M-x compile} and @kbd{M-x recompile} commands is a much moreeffective way of doing that. Emacs automatically intercepts the compileerror messages, inserts them into a special buffer called@code{*compilation*}, and lets you visit the locus of each message inthe source. Type @kbd{C-x `} to step through the offending lines one byone. Click @kbd{Mouse-2} or press @key{RET} on a message text in the@code{*compilation*} buffer to go to the line whose number is mentionedin that message.But if you indeed need to go to a certain text line, type @kbd{M-xgoto-line @key{RET}}. Emacs will prompt you for the number of the lineand go to that line.You can do this faster by invoking @code{goto-line} with a numericargument that is the line's number. For example, @kbd{C-u 286 M-xgoto-line @key{RET}} will jump to line number 286 in the currentbuffer.If you need to use this command frequently, you might consider bindingit to a key. The following snippet, if added to your @file{~/.emacs}file, will bind the sequence @kbd{C-x g} to @code{goto-line}:@lisp (global-set-key "\C-xg" 'goto-line)@end lisp@node Modifying pull-down menus, Deleting menus and menu options, Going to a line by number, Common requests@section How can I create or modify new pull-down menu options?@cindex Pull-down menus, creating or modifying@cindex Menus, creating or modifying@cindex Creating new menu options@cindex Modifying pull-down menus@cindex Menus and keymaps@cindex Keymaps and menusEach menu title (e.g., @samp{File}, @samp{Edit}, @samp{Buffers})represents a local or global keymap. Selecting a menu title with themouse displays that keymap's non-@code{nil} contents in the form of a menu.So to add a menu option to an existing menu, all you have to do is add anew definition to the appropriate keymap. Adding a @samp{Forward Word}item to the @samp{Edit} menu thus requires the following Lisp code:@lisp(define-key global-map [menu-bar edit forward] '("Forward word" . forward-word))@end lisp@noindentThe first line adds the entry to the global keymap, which includesglobal menu bar entries. Replacing the reference to @code{global-map}with a local keymap would add this menu option only within a particularmode.The second line describes the path from the menu-bar to the new entry.Placing this menu entry underneath the @samp{File} menu would meanchanging the word @code{edit} in the second line to @code{file}.The third line is a cons cell whose first element is the title that willbe displayed, and whose second element is the function that will becalled when that menu option is invoked.To add a new menu, rather than a new option to an existing menu, we mustdefine an entirely new keymap:@lisp(define-key global-map [menu-bar words] (cons "Words" (make-sparse-keymap "Words")))@end lispThe above code creates a new sparse keymap, gives it the name@samp{Words}, and attaches it to the global menu bar. Adding the@samp{Forward Word} item to this new menu would thus require thefollowing code:@lisp(define-key global-map [menu-bar words forward] '("Forward word" . forward-word))@end lisp@noindentNote that because of the way keymaps work, menu options are displayedwith the more recently defined items at the top. Thus if you were todefine menu options @samp{foo}, @samp{bar}, and @samp{baz} (in thatorder), the menu option @samp{baz} would appear at the top, and@samp{foo} would be at the bottom.One way to avoid this problem is to use the function @code{define-key-after},which works the same as @code{define-key}, but lets you modify where itemsappear. The following Lisp code would insert the @samp{Forward Word}item in the @samp{Edit} menu immediately following the @samp{Undo} item:@lisp(define-key-after (lookup-key global-map [menu-bar edit]) [forward] '("Forward word" . forward-word) 'undo)@end lispNote how the second and third arguments to @code{define-key-after} aredifferent from those of @code{define-key}, and that we have added a new(final) argument, the function after which our new key should bedefined.To move a menu option from one position to another, simply evaluate@code{define-key-after} with the appropriate final argument.More detailed information---and more examples of how to create andmodify menu options---are in the @cite{Emacs Lisp Reference Manual}, under``Menu Keymaps''. (@xref{Emacs Lisp documentation}, for information onthis manual.)@node Deleting menus and menu options, Turning on syntax highlighting, Modifying pull-down menus, Common requests@section How do I delete menus and menu options?@cindex Deleting menus and menu options@cindex Menus, deletingThe simplest way to remove a menu is to set its keymap to @samp{nil}.For example, to delete the @samp{Words} menu (@pxref{Modifying pull-downmenus}), use:@lisp(define-key global-map [menu-bar words] nil)@end lispSimilarly, removing a menu option requires redefining a keymap entry to@code{nil}. For example, to delete the @samp{Forward word} menu optionfrom the @samp{Edit} menu (we added it in @ref{Modifying pull-downmenus}), use:@lisp(define-key global-map [menu-bar edit forward] nil)@end lisp@node Turning on syntax highlighting, Scrolling only one line, Deleting menus and menu options, Common requests@section How do I turn on syntax highlighting?@cindex Syntax highlighting@cindex @code{font-lock-mode}@cindex Highlighting based on syntax@cindex Colorizing text@cindex FAQ, @code{font-lock-mode}@code{font-lock-mode} is the standard way to have Emacs perform syntaxhighlighting in the current buffer. With @code{font-lock-mode} turnedon, different types of text will appear in different colors. Forinstance, if you turn on @code{font-lock-mode} in a programming mode,variables will appear in one face, keywords in a second, and comments ina third.@cindex hilit19 is deprecatedEarlier versions of Emacs supported hilit19, a similar package. Use ofhilit19 is now considered non-standard, although @file{hilit19.el} comeswith the stock Emacs distribution. It is no longer maintained.To turn @code{font-lock-mode} on within an existing buffer, use @kbd{M-xfont-lock-mode @key{RET}}.To automatically invoke @code{font-lock-mode} when a particular majormode is invoked, set the major mode's hook. For example, to fontify all@code{c-mode} buffers, add the following to your @file{.emacs} file:@lisp(add-hook 'c-mode-hook 'turn-on-font-lock)@end lispTo automatically invoke @code{font-lock-mode} for all major modes, youcan turn on @code{global-font-lock-mode} by including the following linein your @file{.emacs} file:@lisp(global-font-lock-mode 1)@end lisp@noindentThis instructs Emacs to turn on font-lock mode in those buffers forwhich a font-lock mode definition has been provided (in the variable@code{font-lock-global-modes}). If you edit a file in@code{pie-ala-mode}, and no font-lock definitions have been provided for@code{pie-ala} files, then the above setting will have no effect on thatparticular buffer.Highlighting a buffer with @code{font-lock-mode} can take quite a while,and cause an annoying delay in display, so several features exist towork around this.@cindex Just-In-Time syntax highlightingIn Emacs 21 and later, turning on @code{font-lock-mode} automaticallyactivates the new @dfn{Just-In-Time fontification} provided by@code{jit-lock-mode}. @code{jit-lock-mode} defers the fontification ofportions of buffer until you actually need to see them, and can alsofontify while Emacs is idle. This makes display of the visible portionof a buffer almost instantaneous. For details about customizing@code{jit-lock-mode}, type @kbd{C-h f jit-lock-mode @key{RET}}.@cindex Levels of syntax highlighting@cindex Decoration level, in @code{font-lock-mode}In versions of Emacs before 21, different levels of decoration areavailable, from slight to gaudy. More decoration means you need to waitmore time for a buffer to be fontified (or a faster machine). Tocontrol how decorated your buffers should become, set the value of@code{font-lock-maximum-decoration} in your @file{.emacs} file, with a@code{nil} value indicating default (usually minimum) decoration, and a@code{t} value indicating the maximum decoration. For the gaudiestpossible look, then, include the line@lisp(setq font-lock-maximum-decoration t)@end lisp@noindentin your @file{.emacs} file. You can also set this variable such thatdifferent modes are highlighted in a different ways; for moreinformation, see the documentation for@code{font-lock-maximum-decoration} with @kbd{C-h v} (or @kbd{M-xdescribe-variable @key{RET}}).@cindex Lazy font-lockYou might also want to investigate @code{fast-lock-mode} and@code{lazy-lock-mode}, versions of @code{font-lock-mode} that speed uphighlighting. These are the alternatives for @code{jit-lock-mode} inversions of Emacs before 21.1. The advantage of @code{lazy-lock-mode}is that it only fontifies buffers when certain conditions are met, suchas after a certain amount of idle time, or after you have finishedscrolling through text. See the documentation for @code{lazy-lock-mode}by typing @kbd{C-h f @code{lazy-lock-mode}} (@kbd{M-x describe-function@key{RET} lazy-lock-mode @key{RET}}).Also see the documentation for the function @code{font-lock-mode},available by typing @kbd{C-h f font-lock-mode} (@kbd{M-xdescribe-function @key{RET} font-lock-mode @key{RET}}).For more information on font-lock mode, take a look at the@code{font-lock-mode} FAQ, maintained by@email{jari.aalto@@ntc.nokia.com, Jari Aalto} at@uref{ftp://cs.uta.fi/pub/ssjaaa/ema-font.gui}To print buffers with the faces (i.e., colors and fonts) intact, use@kbd{M-x ps-print-buffer-with-faces} or @kbd{M-xps-print-region-with-faces}. You will need a way to send text to aPostScript printer, or a PostScript interpreter such as Ghostscript;consult the documentation of the variables @code{ps-printer-name},@code{ps-lpr-command}, and @code{ps-lpr-switches} for more details.@node Scrolling only one line, Replacing highlighted text, Turning on syntax highlighting, Common requests@section How can I force Emacs to scroll only one line when I move past the bottom of the screen?@cindex Scrolling only one line@cindex Reducing the increment when scrollingPlace the following Lisp form in your @file{.emacs} file:@lisp(setq scroll-step 1)@end lisp@inforef{Scrolling, Scrolling, emacs}.@node Replacing highlighted text, Editing MS-DOS files, Scrolling only one line, Common requests@section How can I replace highlighted text with what I type?@cindex @code{delete-selection-mode}@cindex Replacing highlighted text@cindex Highlighting and replacing textUse @code{delete-selection-mode}, which you can start automatically byplacing the following Lisp form in your @file{.emacs} file:@lisp(delete-selection-mode t)@end lispAccording to the documentation string for @code{delete-selection-mode}(which you can read using @kbd{M-x describe-function @key{RET}delete-selection-mode @key{RET}}):@quotationWhen ON, typed text replaces the selection if the selection is active.When OFF, typed text is just inserted at point.@end quotationThis mode also allows you to delete (not kill) the highlighted region bypressing @key{DEL}.@node Editing MS-DOS files, Filling paragraphs with a single space, Replacing highlighted text, Common requests@section How can I edit MS-DOS files using Emacs?@cindex Editing MS-DOS files@cindex MS-DOS files, editing@cindex Microsoft files, editing@cindex Windows files, editingAs of Emacs 20, detection and handling of MS-DOS (and Windows) files isperformed transparently. You can open MS-DOS files on a Unix system,edit it, and save it without having to worry about the file format.When editing an MS-DOS style file, the mode line will indicate that itis a DOS file. On Unix and GNU/Linux systems, and also on a Macintosh,the string @samp{(DOS)} will appear near the left edge of the mode line;on DOS and Windows, where the DOS end-of-line (EOL) format is thedefault, a backslash (@samp{\}) will appear in the mode line.If you are running a version of Emacs before 20.1, get @code{crypt++}(@pxref{Packages that do not come with Emacs}). Among other things,@code{crypt++} transparently modifies MS-DOS files as they are loadedand saved, allowing you to ignore the different conventions that Unixand MS-DOS have for delineating the end of a line.@node Filling paragraphs with a single space, Escape sequences in shell output, Editing MS-DOS files, Common requests@section How can I tell Emacs to fill paragraphs with a single space after each period?@cindex One space following periods@cindex Single space following periods@cindex Periods, one space following@email{ulm@@vsnhd1.cern.ch, Ulrich Mueller} suggests adding thefollowing two lines to your @file{.emacs} file:@lisp(setq sentence-end "[.?!][]\"')@}]*\\($\\|[ \t]\\)[ \t\n]*")(setq sentence-end-double-space nil)@end lisp@node Escape sequences in shell output, , Filling paragraphs with a single space, Common requests@section Why these strange escape sequences from @code{ls} from the Shell mode?@cindex Escape sequences in @code{ls} output@cindex @code{ls} in Shell modeThis happens because @code{ls} is aliased to @samp{ls --color} in yourshell init file. You have two alternatives to solve this:@itemize @bullet@itemMake the alias conditioned on the @code{EMACS} variable in theenvironment. When Emacs runs a subsidiary shell, it exports the@code{EMACS} variable with the value @code{t} to that shell. You canunalias @code{ls} when that happens, thus limiting the alias to yourinteractive sessions.@itemInstall the @code{ansi-color} package (bundled with Emacs 21.1 andlater), which converts these ANSI escape sequences into colors.@end itemize@c ------------------------------------------------------------@node Bugs and problems, Compiling and installing Emacs, Common requests, Top@chapter Bugs and problems@cindex Bugs and problemsThe Emacs manual lists some common kinds of trouble users could getinto, see @ref{Lossage, , Dealing with Emacs Trouble, emacs, The GNUEmacs Manual}, so you might look there if the problem you encounterisn't described in this chapter. If you decide you've discovered a bug,see @ref{Bugs, , Reporting Bugs, emacs, The GNU Emacs Manual}, forinstructions how to do that.The file @file{etc/PROBLEMS} in the Emacs distribution lists variousknown problems with building and using Emacs on specific platforms;type @kbd{C-h C-e} to read it.@menu* Problems with very large files::* ^M in the shell buffer::* Shell process exits abnormally::* Problems with Shell Mode on MS-Windows::* Termcap/Terminfo entries for Emacs::* Spontaneous entry into isearch-mode::* Problems talking to certain hosts::* Errors with init files::* Emacs ignores X resources::* Emacs ignores frame parameters::* Emacs takes a long time to visit files::* Editing files with $ in the name::* Shell mode loses the current directory::* Security risks with Emacs::* Dired claims that no file is on this line::@end menu@node Problems with very large files, ^M in the shell buffer, Bugs and problems, Bugs and problems@section Does Emacs have problems with files larger than 8 megabytes?@cindex Very large files, opening@cindex Large files, opening@cindex Opening very large files@cindex Maximum file size@cindex Files, maximum sizeOld versions (i.e., anything before 19.29) of Emacs had problems editingfiles larger than 8 megabytes. As of version 19.29, the maximum buffersize is at least 2^27-1, or 134,217,727 bytes, or 132 MBytes. Emacs 20can be compiled on some 64-bit systems in a way that enlarges the buffersize up to 576,460,752,303,423,487 bytes, or 549,755,813 GBytes.If you are using a version of Emacs older than 19.29 and cannot upgrade,you will have to recompile. @email{lnz@@lucid.com, Leonard N. Zubkoff}suggests putting the following two lines in @file{src/config.h} beforecompiling Emacs to allow for 26-bit integers and pointers (and thus filesizes of up to 33,554,431 bytes):@example#define VALBITS 26#define GCTYPEBITS 5@end example@noindentThis method may result in ``ILLEGAL DATATYPE'' and other random errors onsome machines.@email{daveg@@csvax.cs.caltech.edu, David Gillespie} explains how thisproblems crops up; while his numbers are true only for pre-19.29versions of Emacs, the theory remains the same with current versions.@quotationEmacs is largely written in a dialect of Lisp; Lisp is a freely-typedlanguage in the sense that you can put any value of any type into anyvariable, or return it from a function, and so on. So each valuemust carry a @dfn{tag} along with it identifying what kind of thing itis, e.g., integer, pointer to a list, pointer to an editing buffer, andso on. Emacs uses standard 32-bit integers for data objects, taking thetop 8 bits for the tag and the bottom 24 bits for the value. Sointegers (and pointers) are somewhat restricted compared to true Cintegers and pointers.@end quotation@node ^M in the shell buffer, Shell process exits abnormally, Problems with very large files, Bugs and problems@section How do I get rid of @samp{^M} or echoed commands in my shell buffer?@cindex Shell buffer, echoed commands and @samp{^M} in@cindex Echoed commands in @code{shell-mode}Try typing @kbd{M-x shell-strip-ctrl-m @key{RET}} while in @code{shell-mode} tomake them go away. If that doesn't work, you have several options:For @code{tcsh}, put this in your @file{.cshrc} (or @file{.tcshrc})file:@exampleif ($?EMACS) then if ("$EMACS" == t) then if ($?tcsh) unset edit stty nl endifendif@end exampleOr put this in your @file{.emacs_tcsh} file:@exampleunset editstty nl@end exampleAlternatively, use @code{csh} in your shell buffers instead of@code{tcsh}. One way is:@lisp(setq explicit-shell-file-name "/bin/csh")@end lisp@noindentand another is to do this in your @file{.cshrc} (or @file{.tcshrc})file:@examplesetenv ESHELL /bin/csh@end example@noindent(You must start Emacs over again with the environment variable properlyset for this to take effect.)You can also set the @code{ESHELL} environment variable in Emacs Lispwith the following Lisp form,@lisp(setenv "ESHELL" "/bin/csh")@end lispThe above solutions try to prevent the shell from producing the@samp{^M} characters in the first place. If this is not possible(e.g., if you use a Windows shell), you can get Emacs to remove thesecharacters from the buffer by adding this to your @file{.emacs} initfile:@smalllisp(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m)@end smalllispOn a related note: If your shell is echoing your input line in the shellbuffer, you might want to try the following command in your shellstart-up file:@examplestty -icrnl -onlcr -echo susp ^Z@end example@node Shell process exits abnormally, Problems with Shell Mode on MS-Windows, ^M in the shell buffer, Bugs and problems@section Why do I get ``Process shell exited abnormally with code 1''?@cindex Abnormal exits from @code{shell-mode}@cindex @code{shell-mode} exits@cindex Process shell exitedThe most likely reason for this message is that the @samp{env} programis not properly installed. Compile this program for your architecture,and install it with @samp{a+x} permission in the architecture-dependentEmacs program directory. (You can find what this directory is at yoursite by inspecting the value of the variable @code{exec-directory} bytyping @kbd{C-h v exec-directory @key{RET}}.)You should also check for other programs named @samp{env} in your path(e.g., SunOS has a program named @file{/usr/bin/env}). We don'tunderstand why this can cause a failure and don't know a generalsolution for working around the problem in this case.The @samp{make clean} command will remove @samp{env} and other vitalprograms, so be careful when using it.It has been reported that this sometimes happened when Emacs was startedas an X client from an xterm window (i.e., had a controlling tty) but thexterm was later terminated.See also @samp{PROBLEMS} (in the @file{etc} subdirectory of thetop-level directory when you unpack the Emacs source) for otherpossible causes of this message.@node Problems with Shell Mode on MS-Windows, Termcap/Terminfo entries for Emacs, Shell process exits abnormally, Bugs and problems@section Why do I get an error message when I try to run @kbd{M-x shell}?@cindex Shell Mode, and MS-Windows@cindex @code{explicit-shell-file-name}On MS-Windows, this might happen because Emacs tries to look for theshell in a wrong place. The default file name @file{/bin/sh} isusually incorrect for non-Unix systems. If you know where your shellexecutable is, set the variable @code{explicit-shell-file-name} inyour @file{.emacs} file to point to its full file name, like this:@lisp(setq explicit-shell-file-name "d:/shells/bash.exe")@end lispIf you don't know what shell does Emacs use, try the @kbd{M-!}command; if that works, put the following line into your@file{.emacs}:@lisp(setq explicit-shell-file-name shell-file-name)@end lisp@cindex Antivirus programs, and Shell ModeSome people have trouble with Shell Mode because of intrusiveantivirus software; disabling the resident antivirus program solvesthe problems in those cases.@node Termcap/Terminfo entries for Emacs, Spontaneous entry into isearch-mode, Problems with Shell Mode on MS-Windows, Bugs and problems@section Where is the termcap/terminfo entry for terminal type @samp{emacs}?@cindex Termcap@cindex Terminfo@cindex Emacs entries for termcap/terminfoThe termcap entry for terminal type @samp{emacs} is ordinarily put inthe @samp{TERMCAP} environment variable of subshells. It may help incertain situations (e.g., using rlogin from shell buffer) to add anentry for @samp{emacs} to the system-wide termcap file. Here is acorrect termcap entry for @samp{emacs}:@exampleemacs:tc=unknown:@end exampleTo make a terminfo entry for @samp{emacs}, use @code{tic} or@code{captoinfo}. You need to generate@file{/usr/lib/terminfo/e/emacs}. It may work to simply copy@file{/usr/lib/terminfo/d/dumb} to @file{/usr/lib/terminfo/e/emacs}.Having a termcap/terminfo entry will not enable the use of full screenprograms in shell buffers. Use @kbd{M-x terminal-emulator} for thatinstead.A workaround to the problem of missing termcap/terminfo entries is tochange terminal type @samp{emacs} to type @samp{dumb} or @samp{unknown}in your shell start up file. @code{csh} users could put this in their@file{.cshrc} files:@exampleif ("$term" == emacs) set term=dumb@end example@node Spontaneous entry into isearch-mode, Problems talking to certain hosts, Termcap/Terminfo entries for Emacs, Bugs and problems@section Why does Emacs spontaneously start displaying @samp{I-search:} and beeping?@cindex Spontaneous entry into isearch-mode@cindex isearch-mode, spontaneous entry into@cindex Beeping without obvious reasonYour terminal (or something between your terminal and the computer) issending @kbd{C-s} and @kbd{C-q} for flow control, and Emacs is receivingthese characters and interpreting them as commands. (The @kbd{C-s}character normally invokes the @code{isearch-forward} command.) Forpossible solutions, see @ref{Handling C-s and C-q with flow control}.@node Problems talking to certain hosts, Errors with init files, Spontaneous entry into isearch-mode, Bugs and problems@section Why can't Emacs talk to certain hosts (or certain hostnames)?@cindex Hosts, Emacs cannot talk to@cindex @code{gethostbyname}, problematic versionThe problem may be that Emacs is linked with a wimpier version of@code{gethostbyname} than the rest of the programs on the machine. Thisis often manifested as a message on startup of ``X server not responding.Check your @samp{DISPLAY} environment variable.'' or a message of``Unknown host'' from @code{open-network-stream}.On a Sun, this may be because Emacs had to be linked with the static Clibrary. The version of @code{gethostbyname} in the static C librarymay only look in @file{/etc/hosts} and the NIS (YP) maps, while theversion in the dynamic C library may be smart enough to check DNS inaddition to or instead of NIS. On a Motorola Delta running System VR3.6, the version of @code{gethostbyname} in the standard library works,but the one that works with NIS doesn't (the one you get with -linet).Other operating systems have similar problems.Try these options:@itemize @bullet@itemExplicitly add the host you want to communicate with to @file{/etc/hosts}.@itemRelink Emacs with this line in @file{src/config.h}:@example#define LIBS_SYSTEM -lresolv@end example@itemReplace @code{gethostbyname} and friends in @file{libc.a} with moreuseful versions such as the ones in @file{libresolv.a}. Then relinkEmacs.@itemIf you are actually running NIS, make sure that @code{ypbind} isproperly told to do DNS lookups with the correct command line switch.@end itemize@node Errors with init files, Emacs ignores X resources, Problems talking to certain hosts, Bugs and problems@section Why does Emacs say @samp{Error in init file}?@cindex Error in @file{.emacs}@cindex Error in init file@cindex Init file, errors in@cindex @file{.emacs} file, errors in@cindex Debugging @file{.emacs} fileAn error occurred while loading either your @file{.emacs} file or thesystem-wide file @file{lisp/default.el}. Emacs 21.1 and later pops the@file{*Messages*} buffer, and puts there some additional informationabout the error, to provide some hints for debugging.For information on how to debug your @file{.emacs} file, see@ref{Debugging a customization file}.It may be the case that you need to load some package first, or use ahook that will be evaluated after the package is loaded. A common caseof this is explained in @ref{Terminal setup code works after Emacs hasbegun}.@node Emacs ignores X resources, Emacs ignores frame parameters, Errors with init files, Bugs and problems@section Why does Emacs ignore my X resources (my .Xdefaults file)?@cindex X resources being ignored@cindex Ignored X resources@cindex @file{.Xdefaults}As of version 19, Emacs searches for X resources in the files specifiedby the following environment variables:@itemize @bullet@item @code{XFILESEARCHPATH}@item @code{XUSERFILESEARCHPATH}@item @code{XAPPLRESDIR}@end itemizeThis emulates the functionality provided by programs written using theXt toolkit.@code{XFILESEARCHPATH} and @code{XUSERFILESEARCHPATH} should be a listof file names separated by colons. @code{XAPPLRESDIR} should be a listof directory names separated by colons.Emacs searches for X resources:@enumerate@itemspecified on the command line, with the @samp{-xrm RESOURCESTRING} option,@itemthen in the value of the @samp{XENVIRONMENT} environment variable,@itemize @minus@itemor if that is unset, in the file named@file{~/.Xdefaults-@var{hostname}} if it exists (where @var{hostname} isthe name of the machine Emacs is running on),@end itemize@itemthen in the screen-specific and server-wide resource properties providedby the server,@itemize @minus@itemor if those properties are unset, in the file named @file{~/.Xdefaults}if it exists,@end itemize@itemthen in the files listed in @samp{XUSERFILESEARCHPATH},@itemize @minus@itemor in files named @file{@var{lang}/Emacs} in directories listed in@samp{XAPPLRESDIR} (where @var{lang} is the value of the @code{LANG}environment variable), if the @samp{LANG} environment variable is set,@itemor in files named Emacs in the directories listed in @samp{XAPPLRESDIR}@itemor in @file{~/@var{lang}/Emacs} (if the @code{LANG} environment variableis set),@itemor in @file{~/Emacs},@end itemize@itemthen in the files listed in @code{XFILESEARCHPATH}.@end enumerate@node Emacs ignores frame parameters, Emacs takes a long time to visit files, Emacs ignores X resources, Bugs and problems@section Why don't my customizations of the frame parameters work?@cindex Frame parametersThis probably happens because you have set the frame parameters in thevariable @code{initial-frame-alist}. That variable holds parametersused only for the first frame created when Emacs starts. To customizethe parameters of all frames, change the variable@code{default-frame-alist} instead.These two variables exist because many users customize the initial framein a special way. For example, you could determine the position andsize of the initial frame, but would like to control the geometry of theother frames by individually positioning each one of them.@node Emacs takes a long time to visit files, Editing files with $ in the name, Emacs ignores frame parameters, Bugs and problems@section Why does Emacs take 20 seconds to visit a file?@cindex Visiting files takes a long time@cindex Delay when visiting files@cindex Files, take a long time to visitOld versions of Emacs (i.e., versions before Emacs 20.x) oftenencountered this when the master lock file, @file{!!!SuperLock!!!}, hasbeen left in the lock directory somehow. Delete it.@email{meuer@@geom.umn.edu, Mark Meuer} says that NeXT NFS has a bugwhere an exclusive create succeeds but returns an error status. Thiscan cause the same problem. Since Emacs's file locking doesn't workover NFS anyway, the best solution is to recompile Emacs with@code{CLASH_DETECTION} undefined.@node Editing files with $ in the name, Shell mode loses the current directory, Emacs takes a long time to visit files, Bugs and problems@section How do I edit a file with a @samp{$} in its name?@cindex Editing files with @samp{$} in the name@cindex @samp{$} in file names@cindex File names containing @samp{$}, editingWhen entering a file name in the minibuffer, Emacs will attempt to expanda @samp{$} followed by a word as an environment variable. To suppressthis behavior, type @kbd{$$} instead.@node Shell mode loses the current directory, Security risks with Emacs, Editing files with $ in the name, Bugs and problems@section Why does shell mode lose track of the shell's current directory?@cindex Current directory and @code{shell-mode}@cindex @code{shell-mode} and current directory@cindex Directory, current in @code{shell-mode}Emacs has no way of knowing when the shell actually changes itsdirectory. This is an intrinsic limitation of Unix. So it tries toguess by recognizing @samp{cd} commands. If you type @kbd{cd} followedby a directory name with a variable reference (@kbd{cd $HOME/bin}) orwith a shell metacharacter (@kbd{cd ../lib*}), Emacs will fail tocorrectly guess the shell's new current directory. A huge variety offixes and enhancements to shell mode for this problem have been writtento handle this problem (@pxref{Finding a package with particularfunctionality}).You can tell Emacs the shell's current directory with the command@kbd{M-x dirs}.@node Security risks with Emacs, Dired claims that no file is on this line, Shell mode loses the current directory, Bugs and problems@section Are there any security risks in Emacs?@cindex Security with Emacs@cindex @samp{movemail} and security@cindex @code{file-local-variable} and security@cindex Synthetic X events and security@cindex X events and security@itemize @bullet@itemThe @file{movemail} incident. (No, this is not a risk.)In his book @cite{The Cuckoo's Egg}, Cliff Stoll describes this inchapter 4. The site at LBL had installed the @file{/etc/movemail}program setuid root. (As of version 19, @file{movemail} is in yourarchitecture-specific directory; type @kbd{C-h v exec-directory@key{RET}} to see what it is.) Since @code{movemail} had not beendesigned for this situation, a security hole was created and users couldget root privileges.@code{movemail} has since been changed so that this security hole willnot exist, even if it is installed setuid root. However,@code{movemail} no longer needs to be installed setuid root, whichshould eliminate this particular risk.We have heard unverified reports that the 1988 Internet worm tookadvantage of this configuration problem.@itemThe @code{file-local-variable} feature. (Yes, a risk, but easy tochange.)There is an Emacs feature that allows the setting of local values forvariables when editing a file by including specially formatted text nearthe end of the file. This feature also includes the ability to havearbitrary Emacs Lisp code evaluated when the file is visited.Obviously, there is a potential for Trojan horses to exploit thisfeature.Emacs 18 allowed this feature by default; users could disable it bysetting the variable @code{inhibit-local-variables} to a non-@code{nil} value.As of Emacs 19, Emacs has a list of local variables that create asecurity risk. If a file tries to set one of them, it asks the user toconfirm whether the variables should be set. You can also tell Emacswhether to allow the evaluation of Emacs Lisp code found at the bottomof files by setting the variable @code{enable-local-eval}.For more information, @inforef{File Variables, File Variables, emacs}.@itemSynthetic X events. (Yes, a risk; use @samp{MIT-MAGIC-COOKIE-1} orbetter.)Emacs accepts synthetic X events generated by the @code{SendEvent}request as though they were regular events. As a result, if you areusing the trivial host-based authentication, other users who can open Xconnections to your X workstation can make your Emacs process doanything, including run other processes with your privileges.The only fix for this is to prevent other users from being able to openX connections. The standard way to prevent this is to use a realauthentication mechanism, such as @samp{MIT-MAGIC-COOKIE-1}. If usingthe @code{xauth} program has any effect, then you are probably using@samp{MIT-MAGIC-COOKIE-1}. Your site may be using a superiorauthentication method; ask your system administrator.If real authentication is not a possibility, you may be satisfied byjust allowing hosts access for brief intervals while you start your Xprograms, then removing the access. This reduces the risk somewhat bynarrowing the time window when hostile users would have access, but@emph{does not eliminate the risk}.On most computers running Unix and X, you enable and disableaccess using the @code{xhost} command. To allow all hosts access toyour X server, use@examplexhost +@end example@noindentat the shell prompt, which (on an HP machine, at least) produces thefollowing message:@exampleaccess control disabled, clients can connect from any host@end exampleTo deny all hosts access to your X server (except those explicitlyallowed by name), use@examplexhost -@end exampleOn the test HP computer, this command generated the following message:@exampleaccess control enabled, only authorized clients can connect@end example@end itemize@node Dired claims that no file is on this line, , Security risks with Emacs, Bugs and problems@section Dired says, @samp{no file on this line} when I try to do something.@cindex Dired does not see a file@c FIXME: I think this is fixed in Emacs 21, but I didn't have time to@c check.Chances are you're using a localized version of Unix that doesn't use USdate format in dired listings. You can check this by looking at diredlistings or by typing @kbd{ls -l} to a shell and looking at the dates thatcome out.Dired uses a regular expression to find the beginning of a file name.In a long Unix-style directory listing (@samp{ls -l}), the file namestarts after the date. The regexp has thus been written to look for thedate, the format of which can vary on non-US systems.There are two approaches to solving this. The first one involvessetting things up so that @samp{ls -l} outputs US date format. This canbe done by setting the locale. See your OS manual for more information.The second approach involves changing the regular expression used bydired, @code{dired-move-to-filename-regexp}.@c ------------------------------------------------------------@node Compiling and installing Emacs, Finding Emacs and related packages, Bugs and problems, Top@chapter Compiling and installing Emacs@cindex Compiling and installing Emacs@menu* Installing Emacs::* Updating Emacs::* Problems building Emacs::* Linking with -lX11 fails::@end menu@node Installing Emacs, Updating Emacs, Compiling and installing Emacs, Compiling and installing Emacs@section How do I install Emacs?@cindex Installing Emacs@cindex Unix systems, installing Emacs on@cindex Downloading and installing Emacs@cindex Retrieving and installing Emacs@cindex Building Emacs from source@cindex Source code, building Emacs from@cindex Unpacking and installing EmacsThis answer is meant for users of Unix and Unix-like systems. Users ofother operating systems should see the series of questions beginningwith @ref{Emacs for MS-DOS}, which describe where to get non-Unix sourceand binaries, and how to install Emacs on those systems.For Unix and Unix-like systems, the easiest way is often to compile itfrom scratch. You will need:@itemize @bullet@itemEmacs sources. @xref{Current GNU distributions}, for a list of ftp sitesthat make them available. On @file{ftp.gnu.org}, the main GNUdistribution site, sources are available as@uref{ftp://ftp.gnu.org/pub/gnu/emacs/emacs-@value{VER}.tar.gz}The above will obviously change as new versions of Emacs come out. Forinstance, when Emacs 22.42 is released, it will most probably beavailable as@uref{ftp://ftp.gnu.org/pub/gnu/emacs/emacs-22.42.tar.gz}Again, you should use one of the GNU mirror sites (see @ref{Current GNUdistributions}, and adjust the URL accordingly) so as to reduce load on@file{ftp.gnu.org}.@item@code{gzip}, the GNU compression utility. You can get @code{gzip} viaanonymous ftp at mirrors of @file{ftp.gnu.org} sites; it should compileand install without much trouble on most systems. Once you haveretrieved the Emacs sources, you will probably be able to uncompressthem with the command@examplegunzip --verbose emacs-@value{VER}.tar.gz@end example@noindentchanging the Emacs version (@value{VER}), as necessary. Once@code{gunzip} has finished doing its job, a file by the name of@file{emacs-@value{VER}.tar} should be in your build directory.@item@code{tar}, the @dfn{tape archiving} program, which moves multiple filesinto and out of archive files, or @dfn{tarfiles}. All of the filescomprising the Emacs source come in a single tarfile, and must beextracted using @code{tar} before you can build Emacs. Typically, theextraction command would look like@exampletar -xvvf emacs-@value{VER}.tar@end example@noindentThe @samp{x} indicates that we want to extract files from this tarfile,the two @samp{v}s force verbose output, and the @samp{f} tells@code{tar} to use a disk file, rather than one on the tape drive.If you're using GNU @code{tar} (available at mirrors of@file{ftp.gnu.org}), you can combine this step and the previous one byusing the command@exampletar -zxvvf emacs-@value{VER}.tar.gz@end example@noindentThe additional @samp{z} at the beginning of the options list tells GNU@code{tar} to uncompress the file with @code{gunzip} before extractingthe tarfile's components.@end itemizeAt this point, the Emacs sources (all 70+ megabytes of them) should besitting in a directory called @file{emacs-@value{VER}}. On most commonUnix and Unix-like systems, you should be able to compile Emacs (with XWindow system support) with the following commands:@examplecd emacs-@value{VER} # change directory to emacs-@value{VER}./configure # configure Emacs for your particular systemmake # use Makefile to build components, then Emacs@end exampleIf the @code{make} completes successfully, the odds are fairly good thatthe build has gone well. (@xref{Problems building Emacs}, if you weren'tsuccessful.)By default, Emacs is installed in the following directories:@table @file@item /usr/local/binbinaries.@item /usr/local/share/emacs/@value{VER}Lisp code and support files.@item /usr/local/infoInfo documentation.@end tableTo install files in those default directories, become the superuser andtype@examplemake install@end exampleNote that @samp{make install} will overwrite @file{/usr/local/bin/emacs}and any Emacs Info files that might be in @file{/usr/local/info}.Much more verbose instructions (with many more hints and suggestions)come with the Emacs sources, in the file @file{INSTALL}.@node Updating Emacs, Problems building Emacs, Installing Emacs, Compiling and installing Emacs@section How do I update Emacs to the latest version?@cindex Updating Emacs@xref{Installing Emacs}, and follow the instructions there forinstallation.Most files are placed in version-specific directories. Emacs@value{VER}, for instance, places files in@file{/usr/local/share/emacs/@value{VER}}.Upgrading should overwrite only, @file{/usr/local/bin/emacs} (the Emacsbinary) and documentation in @file{/usr/local/info}. Back up thesefiles before you upgrade, and you shouldn't have too much trouble.@node Problems building Emacs, Linking with -lX11 fails, Updating Emacs, Compiling and installing Emacs@section What should I do if I have trouble building Emacs?@cindex Problems building Emacs@cindex Errors when building EmacsFirst look in the file @file{etc/PROBLEMS} (where you unpack the Emacssource) to see if there is already a solution for your problem. Next,look for other questions in this FAQ that have to do with Emacsinstallation and compilation problems.If you'd like to have someone look at your problem and help solve it,see @ref{Help installing Emacs}.If you cannot find a solution in the documentation, send a message to@email{bug-gnu-emacs@@gnu.org}.Please don't post it to @uref{news:gnu.emacs.help} or send e-mail to@email{help-gnu-emacs@@gnu.org}. For further guidelines, see@ref{Guidelines for newsgroup postings} and @ref{Reporting bugs}.@node Linking with -lX11 fails, , Problems building Emacs, Compiling and installing Emacs@section Why does linking Emacs with -lX11 fail?@cindex Linking with -lX11 fails@cindex lX11, linking fails withEmacs needs to be linked with the static version of the X11 library,@file{libX11.a}. This may be missing.On OpenWindows, you may need to use @code{add_services} to add the``OpenWindows Programmers'' optional software category from the CD-ROM.On HP-UX 8.0, you may need to run @code{update} again to load theX11-PRG ``fileset''. This may be missing even if you specified ``allfilesets'' the first time. If @file{libcurses.a} is missing, you mayneed to load the ``Berkeley Development Option.''@email{zoo@@armadillo.com, David Zuhn} says that MIT X builds sharedlibraries by default, and only shared libraries, on those platforms thatsupport them. These shared libraries can't be used when undumping@code{temacs} (the last stage of the Emacs build process). To getregular libraries in addition to shared libraries, add this to@file{site.cf}:@example#define ForceNormalLib YES@end exampleOther systems may have similar problems. You can always define@code{CANNOT_DUMP} and link with the shared libraries instead.@cindex X Menus don't workTo get the Xmenu stuff to work, you need to find a copy of MIT's@file{liboldX.a}.@c ------------------------------------------------------------@node Finding Emacs and related packages, Major packages and programs, Compiling and installing Emacs, Top@chapter Finding Emacs and related packages@cindex Finding Emacs and related packages@menu* Finding Emacs on the Internet::* Finding a package with particular functionality::* Packages that do not come with Emacs::* Current GNU distributions::* Difference between Emacs and XEmacs::* Emacs for MS-DOS::* Emacs for Windows::* Emacs for OS/2::* Emacs for Atari ST::* Emacs for the Amiga ::* Emacs for NeXTSTEP::* Emacs for Apple computers::* Emacs for VMS and DECwindows::* Modes for various languages::* Translating names to IP addresses::@end menu@node Finding Emacs on the Internet, Finding a package with particular functionality, Finding Emacs and related packages, Finding Emacs and related packages@section Where can I get Emacs on the net (or by snail mail)?@cindex Finding Emacs on the Internet@cindex Snail mail, ordering Emacs via@cindex Postal service, ordering Emacs via@cindex Distribution, retrieving Emacs@cindex Internet, retrieving fromLook in the files @file{etc/DISTRIB} and @file{etc/FTP} forinformation on nearby archive sites. If you don't already have Emacs,see @ref{Informational files for Emacs}, for how to get these files.@xref{Installing Emacs}, for information on how to obtain and build the latestversion of Emacs, and see @ref{Current GNU distributions}, for a list ofarchive sites that make GNU software available.@node Finding a package with particular functionality, Packages that do not come with Emacs, Finding Emacs on the Internet, Finding Emacs and related packages@section How do I find a Emacs Lisp package that does XXX?@cindex Package, finding@cindex Finding an Emacs Lisp package@cindex Functionality, finding a particular packageFirst of all, you should check to make sure that the package isn'talready available. For example, typing @kbd{M-x apropos @key{RET}wordstar @key{RET}} lists all functions and variables containing thestring @samp{wordstar}.It is also possible that the package is on your system, but has not beenloaded. To see which packages are available for loading, look throughyour computer's lisp directory (@pxref{File-name conventions}). The Lispsource to most packages contains a short description of how theyshould be loaded, invoked, and configured---so before you use ormodify a Lisp package, see if the author has provided any hints in thesource code.The command @kbd{C-h p} (@code{finder-by-keyword}) allows you to browsethe constituent Emacs packages.For advice on how to find extra packages that are not part of Emacs,see @ref{Packages that do not come with Emacs}.@node Packages that do not come with Emacs, Current GNU distributions, Finding a package with particular functionality, Finding Emacs and related packages@section Where can I get Emacs Lisp packages that don't come with Emacs?@cindex Unbundled packages@cindex Finding other packages@cindex Lisp packages that do not come with Emacs@cindex Packages, those that do not come with Emacs@cindex Emacs Lisp List@cindex Emacs Lisp Archive@uref{http://www.anc.ed.ac.uk/~stephen/emacs/ell.html, The Emacs LispList (ELL)}, maintained by @email{stephen@@anc.ed.ac.uk, Stephen Eglen},aims to provide one compact list with links to all of the current EmacsLisp files on the internet. The ELL can be browsed over the web, orfrom Emacs with @uref{http://www.anc.ed.ac.uk/~stephen/emacs/ell.el,the @file{ell} package}.Many authors post their packages to the @uref{news:gnu.emacs.sources,Emacs sources newsgroup}. You can search the archives of thisgroup with @uref{http://groups.google.com, Google}, for example.Several packages are stored in@uref{http://emacswiki.org/elisp/, the Lisp area of the Emacs Wiki}.For a long time, the Emacs Lisp Archive provided a central repositoryfor Emacs packages. Sadly, it has not been active for some time,although you can still access the old files at@uref{ftp://ftp.cis.ohio-state.edu/pub/emacs-lisp/WWW/index.html}@node Current GNU distributions, Difference between Emacs and XEmacs, Packages that do not come with Emacs, Finding Emacs and related packages@section Where can I get other up-to-date GNU stuff?@cindex Current GNU distributions@cindex Sources for current GNU distributions@cindex Stuff, current GNU@cindex Up-to-date GNU stuff@cindex Finding current GNU software@cindex Official GNU software sitesThe most up-to-date official GNU software is normally kept at@uref{ftp://ftp.gnu.org/pub/gnu}Read the files @file{etc/DISTRIB} and @file{etc/FTP} for moreinformation.A list of sites mirroring @samp{ftp.gnu.org} can be found at@uref{http://www.gnu.org/order/ftp.html}@node Difference between Emacs and XEmacs, Emacs for MS-DOS, Current GNU distributions, Finding Emacs and related packages@section What is the difference between Emacs and XEmacs (formerly Lucid Emacs)?@cindex XEmacs@cindex Difference Emacs and XEmacs@cindex Lucid Emacs@cindex EpochXEmacs is a branch version of Emacs. It was first called Lucid Emacs,and was initially derived from a prerelease version of Emacs 19. Inthis FAQ, we use the name ``Emacs'' only for the official version.Emacs and XEmacs each come with Lisp packages that are lacking in theother. The two versions have some significant differences at the Lispprogramming level. Their current features are roughly comparable,though the support for some operating systems, character sets andspecific packages might be quite different.Some XEmacs code has been contributed to Emacs, and we would like touse other parts, but the earlier XEmacs maintainers did not alwayskeep track of the authors of contributed code, which makes itimpossible for the FSF to get copyright papers signed for that code.(The FSF requires these papers for all the code included in the Emacsrelease, aside from generic C support packages that retain theirseparate identity and are not integrated into the code of Emacsproper.)If you want to talk about these two versions and distinguish them,please call them ``Emacs'' and ``XEmacs.'' To contrast ``XEmacs''with ``GNU Emacs'' would be misleading, since XEmacs too has itsorigin in the work of the GNU Project. Terms such as ``Emacsen'' and``(X)Emacs'' are not wrong, but they are not very clear, so itis better to write ``Emacs and XEmacs.''@node Emacs for MS-DOS, Emacs for Windows, Difference between Emacs and XEmacs, Finding Emacs and related packages@section Where can I get Emacs for my PC running MS-DOS?@cindex MS-DOS, Emacs for@cindex DOS, Emacs for@cindex Compiling Emacs for DOS@cindex Emacs for MS-DOS@cindex Tools needed to compile Emacs under DOSA pre-built binary distribution of Emacs is available from theSimTel.NET archives. This version apparently works under MS-DOS andWindows (3.X, 9X, ME, NT, and 2000) and supports long file names underWindows 9X, Windows ME, and Windows 2000. More information is availablefrom@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/emacs.README}The binary itself is available in the files @file{em*.zip} in thedirectory@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}If you prefer to compile Emacs for yourself, you can do so with thecurrent distribution directly. You will need a 386 (orbetter) processor, and to be running MS-DOS 3.0 or later. According to@email{eliz@@gnu.org, Eli Zaretskii} and@email{hankedr@@dms.auburn.edu, Darrel Hankerson}, you will need thefollowing:@table @emph@item CompilerDJGPP version 1.12 maint 1 or later. Djgpp 2.0 or later isrecommended, since 1.x is very old an unmaintained. Djgpp 2 supportslong file names on Windows 9X/ME/2K.You can get the latest release of DJGPP by retrieving all ofthe files in@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2*}@item Unpacking programThe easiest way is to use @code{djtar} which comes with DJGPP v2.x,because it can open gzip'ed tarfiles (i.e., those ending with@file{.tar.gz}) in one step. @code{Djtar} comes in@file{djdev@var{nnn}.zip} archive (where @var{nnn} is the DJGPP versionnumber), from the URL mentioned above.@strong{Warning!} Do @strong{not} use the popular WinZip program tounpack the Emacs distribution! WinZip is known to corrupt some of thefiles by converting them to the DOS CR-LF format, it doesn't alwayspreserve the directory structure recorded in the compressed Emacsarchive, and commits other atrocities. Some of these problems couldactually prevent Emacs from building successfully!@item make, mv, sed, and rmAll of these utilities are available at@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu}16-bit utilities can be found in GNUish, at@uref{http://www.simtel.net/pub/gnuish/}@noindent(@code{mv} and @code{rm} are in the Fileutils package, @code{sed} and@code{make} are each one in a separate package named after them.)@end tableThe files @file{INSTALL} (near its end) and @file{etc/PROBLEMS} in thedirectory of the Emacs sources contains some additional informationregarding Emacs under MS-DOS.For a list of other MS-DOS implementations of Emacs (and Emacslook-alikes), consult the list of ``Emacs implementations and literature,''available at@uref{ftp://rtfm.mit.edu/pub/usenet/comp.emacs/}Note that while many of these programs look similar to Emacs, they oftenlack certain features, such as the Emacs Lisp extension language.@node Emacs for Windows, Emacs for OS/2, Emacs for MS-DOS, Finding Emacs and related packages@section Where can I get Emacs for Microsoft Windows@cindex FAQ for NT Emacs@cindex Emacs for MS-Windows@cindex Microsoft Windows, Emacs for@cindex Windows 9X, ME, NT, 2K, and CE, Emacs forFor information on Emacs for Windows 95 and NT, read the FAQ produced by@email{voelker@@cs.washington.edu, Geoff Voelker}, available at@uref{http://www.gnu.org/software/emacs/windows/ntemacs.html}@xref{Emacs for MS-DOS}, for Windows 3.1.A port of Emacs 20.7 for Windows CE, based on NTEmacs, is available at@uref{http://www.rainer-keuchel.de/software.html}@noindentThis port was done by @email{coyxc@@rainer-keuchel.de, Rainer Keuchel},and supports all Emacs features except async subprocesses and menus.You will need MSVC 6.0 and a Windows CE SDK to build this port.@node Emacs for OS/2, Emacs for Atari ST, Emacs for Windows, Finding Emacs and related packages@section Where can I get Emacs for my PC running OS/2?@cindex OS/2, Emacs forEmacs 20.6 is ported for emx on OS/2 2.0 or 2.1, and is available at@uref{ftp://hobbes.nmsu.edu/pub/os2/apps/editors/emacs/e206*.zip}@noindentand also at@uref{http://archiv.leo.org/pub/comp/os/os2/leo/gnu/emacs%2d20/}Instructions for installation, basic setup, and other useful informationfor OS/2 users of Emacs can be found at@uref{http://userpage.fu-berlin.de/~oheiabbd/emacs/emacs206-os2.html}@node Emacs for Atari ST, Emacs for the Amiga , Emacs for OS/2, Finding Emacs and related packages@section Where can I get Emacs for my Atari ST?@cindex Atari ST, Emacs for@cindex TOS, Emacs forRoland Sch�uble reports that Emacs 18.58 running on plain TOS and MiNTis available at@uref{ftp://atari.archive.umich.edu/Editors/Emacs-18-58/1858b-d3.zoo}.@node Emacs for the Amiga , Emacs for NeXTSTEP, Emacs for Atari ST, Finding Emacs and related packages@section Where can I get Emacs for my Amiga?@cindex Amiga, Emacs forThe files you need are available at@uref{ftp://ftp.wustl.edu/pub/aminet/util/gnu/}@email{dgilbert@@gamiga.guelphnet.dweomer.org, David Gilbert} has released abeta version of Emacs 19.25 for the Amiga. You can get the binary at@uref{ftp://ftp.wustl.edu/pub/aminet/util/gnu/a2.0bEmacs-bin.lha}@node Emacs for NeXTSTEP, Emacs for Apple computers, Emacs for the Amiga , Finding Emacs and related packages@section Where can I get Emacs for NeXTSTEP?@cindex NeXTSTEP, Emacs forEmacs.app is a NeXTSTEP version of Emacs 19.34 which supports colors,menus, and multiple frames. You can get it from@uref{ftp://next-ftp.peak.org/pub/next/apps/emacs/Emacs_for_NeXTstep.4.20a1.NIHS.b.tar.gz}@node Emacs for Apple computers, Emacs for VMS and DECwindows, Emacs for NeXTSTEP, Finding Emacs and related packages@section Where can I get Emacs for my Apple computer?@cindex Apple computers, Emacs for@cindex Macintosh, Emacs forBeginning with version 21.1, the Macintosh is supported in the officialEmacs distribution; see the files @file{mac/README} and@file{mac/INSTALL} in the Emacs distribution for build instructions.Apple's ``OS X'' is based largely on NeXTSTEP and OpenStep.@xref{Emacs for NeXTSTEP}, for more details about that version.@node Emacs for VMS and DECwindows, Modes for various languages, Emacs for Apple computers, Finding Emacs and related packages@section Where do I get Emacs that runs on VMS under DECwindows?@cindex DECwindows, Emacs for@cindex VMS, Emacs forUp-to-date information about GNU software (including Emacs) for VMS isavailable at @uref{http://vms.gnu.org/}.@node Modes for various languages, Translating names to IP addresses, Emacs for VMS and DECwindows, Finding Emacs and related packages@section Where can I get modes for Lex, Yacc/Bison, Bourne shell, csh, C@t{++}, Objective-C, Pascal, Java, and Awk?@cindex Awk, mode for@cindex @code{awk-mode}@cindex Bison, mode for@cindex Bourne Shell, mode for@cindex C@t{++}, mode for@cindex Java, mode for@cindex Lex mode@cindex Objective-C, mode for@cindex @code{pascal-mode}@cindex Shell mode@cindex Yacc mode@cindex @file{csh} mode@cindex @code{sh-mode}@cindex @code{cc-mode}Most of these modes are now available in standard Emacs distribution.To get additional modes, see @ref{Finding a package with particularfunctionality}.Barry Warsaw's @code{cc-mode} now works for C, C@t{++}, Objective-C, andJava code. It is distributed with Emacs, but has@uref{http://cc-mode.sourceforge.net/, its own homepage}.@node Translating names to IP addresses, , Modes for various languages, Finding Emacs and related packages@section What is the IP address of XXX.YYY.ZZZ?@cindex Translating names to IP addresses@cindex IP addresses from names@cindex Using BIND to translate addresses@cindex DNS and IP addressesIf you are on a Unix machine, try using the @samp{nslookup} command,included in the Berkeley BIND package. For example, to find the IPaddress of @samp{ftp.gnu.org}, you would type @code{nslookupftp.gnu.org}.Your computer should then provide the IP address of that machine.If your site's nameserver is deficient, you can use IP addresses to FTPfiles. You can get this information by e-mail:@exampleTo: dns@@[134.214.84.25] (to grasp.insa-lyon.fr)Body: ip XXX.YYY.ZZZ (or "help" for more information and options - no quotes)@end example@noindentor:@exampleTo: resolve@@[147.31.254.130] (to laverne.cs.widener.edu)Body: site XXX.YYY.ZZZ@end example@c ------------------------------------------------------------@node Major packages and programs, Key bindings, Finding Emacs and related packages, Top@chapter Major packages and programs@cindex Major packages and programs@menu* VM::* Supercite::* Calc::* VIPER::* AUCTeX::* BBDB::* Ispell::* w3-mode::* EDB::* Mailcrypt::* JDE::* Patch::@end menu@node VM, Supercite, Major packages and programs, Major packages and programs@section VM (View Mail) --- another mail reader within Emacs, with MIME support@cindex VM@cindex Alternative mail software@cindex View Mail@cindex E-mail reader, VM@table @b@item Author@email{kyle_jones@@wonderworks.com, Kyle Jones}@item Latest version7.15@item Distribution@uref{ftp://ftp.wonderworks.com/pub/vm/vm.tar.gz}@item Informational newsgroup@uref{news:gnu.emacs.vm.info}@*@item Bug reports newsgroup@uref{news:gnu.emacs.vm.bug}@*Or send reports to @email{bug-vm@@wonderworks.com}@end tableVM 7 works well with Emacs 21. Older versions of VM suitable for usewith older versions of Emacs are available from@uref{ftp://ftp.wonderworks.com/pub/vm/, the same FTP site}.@node Supercite, Calc, VM, Major packages and programs@section Supercite --- mail and news citation package within Emacs@cindex Supercite@cindex Superyank@cindex Mail and news citations@cindex News and mail citations@cindex Citations in mail and news@table @b@item Author@email{barry@@python.org, Barry Warsaw}@item Latest version3.54 (comes bundled with Emacs since version 20)@item Distribution@uref{http://www.python.org/emacs/supercite.tar.gz}@item Mailing listSubscription requests to @email{supercite-request@@python.org}@*Submissions @email{supercite@@python.org}@end tableSuperyank is an old version of Supercite.@node Calc, VIPER, Supercite, Major packages and programs@section Calc --- poor man's Mathematica within Emacs@cindex Programmable calculator@cindex Calc@cindex Mathematical package@table @b@item Author@email{daveg@@csvax.cs.caltech.edu, Dave Gillespie}@item Latest version2.02g (part of Emacs since version 22.1)@item DistributionNo separate distribution outside of Emacs. Older versionsare available at @uref{ftp://ftp.gnu.org/pub/gnu/calc/}.@end tableNote that Calc 2.02f needs patching to work with Emacs 21 and later.@cindex @code{calculator}, a packageEmacs 21.1 and later comes with a package called @file{calculator.el}.It doesn't support all the mathematical wizardry offered by Calc, suchas matrices, special functions, and statistics, but is more thanadequate as a replacement for @code{xcalc} and similar programs.@node VIPER, AUCTeX, Calc, Major packages and programs@section VIPER --- @code{vi} emulation for Emacs@cindex @code{vi} emulation@cindex VIPER@cindex Emulation of @code{vi}Since Emacs 19.29, the preferred @code{vi} emulation in Emacs is VIPER(@kbd{M-x viper-mode @key{RET}}), which comes with Emacs. It extendsand supersedes VIP (including VIP 4.3) and provides @code{vi} emulationat several levels, from one that closely follows @code{vi} to one thatdeparts from @code{vi} in several significant ways.For Emacs 19.28 and earlier, the following version of VIP is generallybetter than the one distributed with Emacs:@table @b@item Author@email{sane@@cs.uiuc.edu, Aamod Sane}@item Latest version4.3@item Distribution@uref{ftp://archive.cis.ohio-state.edu/pub/emacs-lisp/old-archive/modes/vip-mode.tar.Z}@end table@node AUCTeX, BBDB, VIPER, Major packages and programs@section AUC@TeX{} --- enhanced @TeX{} modes with debugging facilities@cindex Mode for @TeX{}@cindex @TeX{} mode@cindex AUC@TeX{} mode for editing @TeX{}@cindex Writing and debugging @TeX{}AUC@TeX{} is a set of sophisticated major modes for @TeX{}, LaTeX,ConTeXt, and Texinfo offering context-sensitive syntax highlighting,indentation, formatting and folding, macro completion, @TeX{} shellfunctionality, and debugging. Some important supplemental packages aredescribed in @ref{Introduction, RefTeX, Introduction, reftex, Ref@TeX{}User Manual}, and@uref{http://preview-latex.sourceforge.net,preview-latex}.@table @b@item Authors@email{krab@@iesd.auc.dk, Kresten Krab Thorup}, @*@email{abraham@@dina.kvl.dk, Per Abrahamsen}, @* and others.@item Maintainer@email{dak@@gnu.org, David Kastrup}@item Latest version11.54@item Distribution@uref{ftp://ftp.gnu.org/pub/gnu/auctex/}@item Web site@uref{http://www.gnu.org/software/auctex/}@item Mailing list:Subscription requests to @email{auc-tex-subscribe@@sunsite.dk}@*Submissions to @email{auc-tex@@sunsite.dk}@end table@node BBDB, Ispell, AUCTeX, Major packages and programs@section BBDB --- personal Info Rolodex integrated with mail/news readers@cindex BBDB@cindex Rolodex-like functionality@cindex Integrated contact database@cindex Contact database@cindex Big Brother Database@cindex Address book@table @b@item Maintainer@email{waider@@waider.ie, Ronan Waide}@item Latest version2.34@item Distribution@uref{http://bbdb.sourceforge.net/}@item Mailing listsSubscription requests to @email{bbdb-info-request@@lists.sourceforge.net}@*Submissions to @email{bbdb-info@@lists.sourceforge.net}@*Release announcements: @email{bbdb-announce-request@@lists.sourceforge.net}@end table@node Ispell, w3-mode, BBDB, Major packages and programs@section Ispell --- spell checker in C with interface for Emacs@cindex Spell-checker@cindex Checking spelling@cindex Ispell@table @b@item Author@email{geoff@@itcorp.com, Geoff Kuenning}@item Latest version3.1.20@item Distribution@uref{ftp://ftp.cs.ucla.edu/pub/ispell/ispell-3.1.20.tar.gz}@*@item Web site@uref{http://fmg-www.cs.ucla.edu/geoff/ispell.html}@end table@itemize @bullet@itemDo not ask Geoff to send you the latest version of Ispell. He does nothave free e-mail.@itemThis Ispell program is distinct from GNU Ispell 4.0. GNU Ispell 4.0 isno longer a supported product.@end itemize@node w3-mode, EDB, Ispell, Major packages and programs@section w3-mode --- A World Wide Web browser inside of Emacs@cindex WWW browser@cindex Web browser@cindex HTML browser in Emacs@cindex @code{w3-mode}@table @b@item Author@email{wmperry@@spry.com, Bill Perry}@item Latest version4.0pre.39@item Distribution@uref{ftp://ftp.cs.indiana.edu/pub/elisp/w3/w3.tar.gz}@item Mailing listsReceive announcements from @email{w3-announce-request@@indiana.edu}@*Become a beta tester at @email{w3-beta-request@@indiana.edu}@*Help to develop @code{w3-mode} at @email{w3-dev@@indiana.edu}@end table@node EDB, Mailcrypt, w3-mode, Major packages and programs@section EDB --- Database program for Emacs; replaces forms editing modes@cindex EDB@cindex Database@cindex Forms mode@table @b@item Author@email{mernst@@theory.lcs.mit.edu, Michael Ernst}@item Latest version1.21@item Distribution@uref{ftp://theory.lcs.mit.edu/pub/emacs/edb}@end table@node Mailcrypt, JDE, EDB, Major packages and programs@section Mailcrypt --- PGP interface within Emacs mail and news@cindex PGP@cindex GPG@cindex Interface to PGP from Emacs mail and news@cindex News, interface to PGP from@cindex Mail, interface to PGP from@cindex Encryption software, interface to@table @b@item Authors@email{patl@@lcs.mit.edu, Patrick J. LoPresti} and@email{jin@@atype.com, Jin S. Choi}@item Maintainer@email{warner-mailcrypt@@lothar.com, Brian Warner}@item Latest version3.5.8@item Distribution@uref{http://dl.sourceforge.net/sourceforge/mailcrypt/mailcrypt-3.5.8.tar.gz}@item Web site@uref{http://mailcrypt.sourceforge.net/}@end table@node JDE, Patch, Mailcrypt, Major packages and programs@section JDE --- Integrated development environment for Java@cindex Java development environment@cindex Integrated Java development environment@cindex JDE@table @b@item Author@email{paulk@@mathworks.com, Paul Kinnucan}@item Mailing listjde-subscribe@@sunsite.auc.dk@item Latest version2.1.1@item Web site@uref{http://sunsite.auc.dk/jde/}@end table@node Patch, , JDE, Major packages and programs@section Patch --- program to apply ``diffs'' for updating files@cindex Updating files with diffs@cindex Patching source files with diffs@cindex Diffs and patching@cindex @file{patch}@table @b@item Author@email{lwall@@wall.org, Larry Wall} (with GNU modifications)@item Latest version2.5.4@item Distribution@xref{Current GNU distributions}.@end table@c ------------------------------------------------------------@node Key bindings, Alternate character sets, Major packages and programs, Top@chapter Key bindings@cindex Key bindings@menu* Binding keys to commands::* Invalid prefix characters::* Terminal setup code works after Emacs has begun::* Using function keys under X::* Working with function and arrow keys::* X key translations for Emacs::* Handling C-s and C-q with flow control::* Binding C-s and C-q::* Backspace invokes help::* stty and Backspace key::* Swapping keys::* Producing C-XXX with the keyboard::* No Meta key::* No Escape key::* Compose Character::* Binding combinations of modifiers and function keys::* Meta key does not work in xterm::* ExtendChar key does not work as Meta::@end menu@node Binding keys to commands, Invalid prefix characters, Key bindings, Key bindings@section How do I bind keys (including function keys) to commands?@cindex Binding keys to commands@cindex Keys, binding to commands@cindex Commands, binding keys toKeys can be bound to commands either interactively or in your@file{.emacs} file. To interactively bind keys for all modes, type@kbd{M-x global-set-key @key{RET} @var{key} @var{cmd} @key{RET}}.To bind a key just in the current major mode, type @kbd{M-xlocal-set-key @key{RET} @var{key} @var{cmd} @key{RET}}.@inforef{Key Bindings, Key Bindings, emacs}, for further details.To make the process of binding keys interactively eaiser, use thefollowing ``trick'': First bind the key interactively, then immediatelytype @kbd{C-x @key{ESC} @key{ESC} C-a C-k C-g}. Now, the command neededto bind the key is in the kill ring, and can be yanked into your@file{.emacs} file. If the key binding is global, no changes to thecommand are required. For example,@lisp(global-set-key (quote [f1]) (quote help-for-help))@end lisp@noindentcan be placed directly into the @file{.emacs} file. If the key binding islocal, the command is used in conjunction with the @samp{add-hook} function.For example, in TeX mode, a local binding might be@lisp(add-hook 'tex-mode-hook (lambda () (local-set-key (quote [f1]) (quote help-for-help))))@end lisp@itemize @bullet@itemControl characters in key sequences, in the form yanked from the killring are given in their graphic form---i.e., @key{CTRL} is shown as@samp{^}, @key{TAB} as a set of spaces (usually 8), etc. You may wantto convert these into their vector or string forms.@itemIf a prefix key of the character sequence to be bound is alreadybound as a complete key, then you must unbind it before the newbinding. For example, if @kbd{ESC @{} is previously bound:@lisp(global-unset-key [?\e ?@{]) ;; or(local-unset-key [?\e ?@{])@end lisp@itemAside from commands and ``lambda lists,'' a vector or string alsocan be bound to a key and thus treated as a macro. For example:@lisp(global-set-key [f10] [?\C-x?\e?\e?\C-a?\C-k?\C-g]) ;; or(global-set-key [f10] "\C-x\e\e\C-a\C-k\C-g")@end lisp@end itemize@node Invalid prefix characters, Terminal setup code works after Emacs has begun, Binding keys to commands, Key bindings@section Why does Emacs say @samp{Key sequence XXX uses invalid prefix characters}?@cindex Prefix characters, invalid@cindex Invalid prefix characters@cindex Misspecified key sequencesUsually, one of two things has happened. In one case, the controlcharacter in the key sequence has been misspecified (e.g. @samp{C-f}used instead of @samp{\C-f} within a Lisp expression). In the othercase, a @dfn{prefix key} in the keystroke sequence you were trying to bindwas already bound as a @dfn{complete key}. Historically, the @samp{ESC [}prefix was usually the problem, in which case you should evaluate eitherof these forms before attempting to bind the key sequence:@lisp(global-unset-key [?\e ?[]) ;; or(global-unset-key "\e[")@end lisp@node Terminal setup code works after Emacs has begun, Using function keys under X, Invalid prefix characters, Key bindings@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?@cindex Terminal setup code in @file{.emacs}During startup, Emacs initializes itself according to a given code/fileorder. If some of the code executed in your @file{.emacs} file needs tobe postponed until the initial terminal or window-system setup code hasbeen executed but is not, then you will experience this problem (thiscode/file execution order is not enforced after startup).To postpone the execution of Emacs Lisp code until after terminal orwindow-system setup, treat the code as a @dfn{lambda list} and set thevalue of either the @code{term-setup-hook} or @code{window-setup-hook}variable to this lambda function. For example,@lisp(add-hook 'term-setup-hook (lambda () (when (string-match "\\`vt220" (or (getenv "TERM") "")) ;; Make vt220's "Do" key behave like M-x: (global-set-key [do] 'execute-extended-command))))@end lispFor information on what Emacs does every time it is started, see the@file{lisp/startup.el} file.@node Using function keys under X, Working with function and arrow keys, Terminal setup code works after Emacs has begun, Key bindings@section How do I use function keys under X?@cindex Function keys@cindex X Window System and function keys@cindex Binding function keysWith Emacs 19, functions keys under X are bound like any other key. @xref{Binding keys to commands}, for details.@node Working with function and arrow keys, X key translations for Emacs, Using function keys under X, Key bindings@section How do I tell what characters or symbols my function or arrow keys emit?@cindex Working with arrow keys@cindex Arrow keys, symbols generated by@cindex Working with function keys@cindex Function keys, symbols generated by@cindex Symbols generated by function keysType @kbd{C-h c} then the function or arrow keys. The command willreturn either a function key symbol or character sequence (see theEmacs on-line documentation for an explanation). This works for otherkeys as well.@node X key translations for Emacs, Handling C-s and C-q with flow control, Working with function and arrow keys, Key bindings@section How do I set the X key ``translations'' for Emacs?@cindex X key translations@cindex Key translations under X@cindex Translations for keys under XEmacs is not written using the Xt library by default, so there are no``translations'' to be set. (We aren't sure how to set such translationsif you do build Emacs with Xt; please let us know if you've done this!)The only way to affect the behavior of keys within Emacs is through@code{xmodmap} (outside Emacs) or @code{define-key} (inside Emacs). The@code{define-key} command should be used in conjunction with the@code{function-key-map} map. For instance,@lisp(define-key function-key-map [M-@key{TAB}] [?\M-\t])@end lisp@noindentdefines the @kbd{M-@key{TAB}} key sequence.@node Handling C-s and C-q with flow control, Binding C-s and C-q, X key translations for Emacs, Key bindings@section How do I handle @kbd{C-s} and @kbd{C-q} being used for flow control?@cindex Flow control, @kbd{C-s} and @kbd{C-q} with@cindex @kbd{C-s} and @kbd{C-q} with flow control@kbd{C-s} and @kbd{C-q} are used in the XON/XOFF flow control protocol.This messes things up when you're using Emacs over a serial line,because Emacs binds these keys to commands by default. Because Emacswon't honor them as flow control characters, too many of thesecharacters are not passed on and overwhelm output buffers. Sometimes,intermediate software using XON/XOFF flow control will prevent Emacsfrom ever seeing @kbd{C-s} and @kbd{C-q}.Possible solutions:@itemize @bullet@itemDisable the use of @kbd{C-s} and @kbd{C-q} for flow control.You need to determine the cause of the flow control.@itemize @minus@itemyour terminalYour terminal may use XON/XOFF flow control to have time to displayall the characters it receives. For example, VT series terminals dothis. It may be possible to turn this off from a setup menu. Forexample, on a VT220 you may select ``No XOFF'' in the setup menu. Thisis also true for some terminal emulation programs on PCs.When you turn off flow control at the terminal, you will also need toturn it off at the other end, which might be at the computer you arelogged in to or at some terminal server in between.If you turn off flow control, characters may be lost; using a printerconnected to the terminal may fail. You may be able to get aroundthis problem by modifying the @samp{termcap} entry for your terminal toinclude extra NUL padding characters.@itema modemIf you are using a dialup connection, the modems may be usingXON/XOFF flow control. It's not clear how to get around this.@itema router or terminal serverSome network box between the terminal and your computer may be usingXON/XOFF flow control. It may be possible to make it use some otherkind of flow control. You will probably have to ask your localnetwork experts for help with this.@item@code{tty} and/or @code{pty} devicesIf your connection to Emacs goes through multiple @code{tty} and/or@code{pty} devices, they may be using XON/XOFF flow control even when itis not necessary.@email{eirik@@theory.tn.cornell.edu, Eirik Fuller} writes:@quotationSome versions of @code{rlogin} (and possibly @code{telnet}) do not passflow control characters to the remote system to which they connect. Onsuch systems, Emacs on the remote system cannot disable flow control onthe local system. Sometimes @samp{rlogin -8} will avoid this problem.One way to cure this is to disable flow control on the local host (theone running @code{rlogin}, not the one running @code{rlogind}) using the@code{stty} command, before starting the @code{rlogin} process. On manysystems, @samp{stty start u stop u} will do this.Some versions of @samp{tcsh} will prevent even this from working. Oneway around this is to start another shell before starting rlogin,and issue the @samp{stty} command to disable flow control from that shell.@end quotationUse @samp{stty -ixon} instead of @samp{stty start u stop u} on some systems.@end itemize@itemMake Emacs speak the XON/XOFF flow control protocol.You can make Emacs treat @kbd{C-s} and @kbd{C-q} as flow control characters byevaluating the form@lisp(enable-flow-control)@end lisp@noindentto unconditionally enable flow control or@lisp(enable-flow-control-on "vt100" "h19")@end lisp@noindent(using your terminal names instead of @samp{vt100} or @samp{h19}) toenable selectively. These commands will automatically swap @kbd{C-s}and @kbd{C-q} to @kbd{C-\} and @kbd{C-^}. Variables can be used tochange the default swap keys (@code{flow-control-c-s-replacement} and@code{flow-control-c-q-replacement}).If you are fixing this for yourself, simply put the form in your@file{.emacs} file. If you are fixing this for your entire site, thebest place to put it is in the @file{site-lisp/site-start.el} file.(Here @file{site-lisp} is actually a subdirectory of your Emacsinstallation directory, typically @file{/usr/local/share/emacs}.)Putting this form in @file{site-lisp/default.el} has the problem thatif the user's @file{.emacs} file has an error, this will prevent@file{default.el} from being loaded and Emacs may be unusable for theuser, even for correcting their @file{.emacs} file (unless they'resmart enough to move it to another name).@code{enable-flow-control} can be invoked interactively as well:@kbd{M-x enable-flow-control @key{RET}}.@end itemizeFor further discussion of this issue, read the file @file{etc/PROBLEMS}(in the Emacs source directory when you unpack the Emacs distribution).@node Binding C-s and C-q, Backspace invokes help, Handling C-s and C-q with flow control, Key bindings@section How do I bind @kbd{C-s} and @kbd{C-q} (or any key) if these keys are filtered out?@cindex Binding @kbd{C-s} and @kbd{C-q}@cindex @kbd{C-s} and @kbd{C-q}, bindingTo bind @kbd{C-s} and @kbd{C-q}, use either @code{enable-flow-control}or @code{enable-flow-control-on}. @xref{Handling C-s and C-q with flowcontrol}, for usage and implementation details.To bind other keys, use @code{keyboard-translate}. @xref{Swappingkeys}, for usage details. To do this for an entire site, you shouldswap the keys in @file{site-lisp/site-start.el}. @xref{Handling C-sand C-q with flow control}, for an explanation of why@file{site-lisp/default.el} should not be used.@itemize @bullet@itemIf you do this for an entire site, the users will be confused bythe disparity between what the documentation says and how Emacsactually behaves.@end itemize@node Backspace invokes help, stty and Backspace key, Binding C-s and C-q, Key bindings@section Why does the @key{Backspace} key invoke help?@cindex Backspace key invokes help@cindex Help invoked by Backspace@cindex DEL key does not deleteThe @key{Backspace} key (on most keyboards) generates @acronym{ASCII} code 8.@kbd{C-h} sends the same code. In Emacs by default @kbd{C-h} invokeshelp-command. This is intended to be easy to remember since the firstletter of @samp{help} is @samp{h}. The easiest solution to this problemis to use @kbd{C-h} (and @key{Backspace}) for help and @key{DEL} (the@key{Delete} key) for deleting the previous character.For many people this solution may be problematic:@itemize @bullet@itemThey normally use @key{Backspace} outside of Emacs for deleting theprevious character. This can be solved by making @key{DEL} the commandfor deleting the previous character outside of Emacs. On many Unixsystems, this command will remap @key{DEL}:@examplestty erase `^?'@end example@itemThe user may prefer the @key{Backspace} key for deleting theprevious character because it is more conveniently located on theirkeyboard or because they don't even have a separate @key{Delete} key.In this case, the @key{Backspace} key should be made to behave like@key{Delete}. There are several methods.@itemize @minus@itemSome terminals (e.g., VT3## terminals) and terminal emulators (e.g.,TeraTerm) allow the character generated by the @key{Backspace} key to bechanged from a setup menu.@itemYou may be able to get a keyboard that is completely programmable, or aterminal emulator that supports remapping of any key to any other key.@itemWith Emacs 21.1 and later, you can control the effect of the@key{Backspace} and @key{Delete} keys, on both dumb terminals and awindowed displays, by customizing the option@code{normal-erase-is-backspace-mode}, or by invoking @kbd{M-xnormal-erase-is-backspace}. See the documentation of these symbols(@pxref{Emacs Lisp documentation}) for more info.@itemIt is possible to swap the @key{Backspace} and @key{DEL} keys insideEmacs:@lisp(keyboard-translate ?\C-h ?\C-?)@end lisp@noindentThis is the recommended method of forcing @key{Backspace} to act as@key{DEL}, because it works even in modes which bind @key{DEL} tosomething other than @code{delete-backward-char}.Similarly, you could remap @key{DEL} to act as @kbd{C-d}, which bydefault deletes forward:@lisp(keyboard-translate ?\C-? ?\C-d)@end lisp@xref{Swapping keys}, for further details about @code{keyboard-translate}.@itemAnother approach is to switch key bindings and put help on @kbd{C-x h}instead:@lisp(global-set-key "\C-h" 'delete-backward-char);;; overrides mark-whole-buffer(global-set-key "\C-xh" 'help-command)@end lisp@noindentThis method is not recommended, though: it only solves the problem forthose modes which bind @key{DEL} to @code{delete-backward-char}. Modeswhich bind @key{DEL} to something else, such as @code{view-mode}, willnot work as you expect when you press the @key{Backspace} key. For thisreason, we recommend the @code{keyboard-translate} method, shownabove.Other popular key bindings for help are @kbd{M-?} and @kbd{C-x ?}.@end itemizeDon't try to bind @key{DEL} to @code{help-command}, because there aremany modes that have local bindings of @key{DEL} that will interfere.@end itemizeWhen Emacs 21 or later runs on a windowed display, it binds the@key{Delete} key to a command which deletes the character at point, tomake Emacs more consistent with keyboard operation on these systems.For more information about troubleshooting this problem, see @ref{DELDoes Not Delete, , If @key{DEL} Fails to Delete, emacs, The GNU EmacsManual}.@node stty and Backspace key, Swapping keys, Backspace invokes help, Key bindings@section Why doesn't Emacs look at the @file{stty} settings for @key{Backspace} vs. @key{Delete}?@cindex @file{stty} and Emacs@cindex Backspace and @file{stty}@cindex Delete and @file{stty}Good question!@c FIXME: RMS explained the reasons for this on emacs-hackers. It's@c probably worth putting that explanation here.@node Swapping keys, Producing C-XXX with the keyboard, stty and Backspace key, Key bindings@section How do I swap two keys?@cindex Swapping keys@cindex Keys, swapping@cindex @code{keyboard-translate}In Emacs 19, you can swap two keys (or key sequences) by using the@code{keyboard-translate} function. For example, to turn @kbd{C-h} into@key{DEL} and @key{DEL} to @kbd{C-h}, use@lisp(keyboard-translate ?\C-h ?\C-?) ; translate `C-h' to DEL(keyboard-translate ?\C-? ?\C-h) ; translate DEL to `C-h'.@end lisp@noindentThe first key sequence of the pair after the function identifies what isproduced by the keyboard; the second, what is matched for in thekeymaps.Keyboard translations are not the same as key bindings in keymaps.Emacs contains numerous keymaps that apply in different situations, butthere is only one set of keyboard translations, and it applies to everycharacter that Emacs reads from the terminal. Keyboard translationstake place at the lowest level of input processing; the keys that arelooked up in keymaps contain the characters that result from keyboardtranslation.@inforef{Keyboard Translations, Keyboard Translations, emacs}.@node Producing C-XXX with the keyboard, No Meta key, Swapping keys, Key bindings@section How do I produce C-XXX with my keyboard?@cindex Producing control characters@cindex Generating control characters@cindex Control characters, generatingOn terminals (but not under X), some common ``aliases'' are:@table @asis@item @kbd{C-2} or @kbd{C-@key{SPC}}@kbd{C-@@}@item @kbd{C-6}@kbd{C-^}@item @kbd{C-7} or @kbd{C-S--}@kbd{C-_}@item @kbd{C-4}@kbd{C-\}@item @kbd{C-5}@kbd{C-]}@item @kbd{C-/}@kbd{C-?}@end tableOften other aliases exist; use the @kbd{C-h c} command and try@key{CTRL} with all of the digits on your keyboard to see what getsgenerated. You can also try the @kbd{C-h w} command if you know thename of the command.@node No Meta key, No Escape key, Producing C-XXX with the keyboard, Key bindings@section What if I don't have a @key{Meta} key?@cindex No @key{Meta} key@cindex @key{Meta} key, what to do if you lack itOn many keyboards, the @key{Alt} key acts as @key{Meta}, so try it.Instead of typing @kbd{M-a}, you can type @kbd{@key{ESC} a}. In fact,Emacs converts @kbd{M-a} internally into @kbd{@key{ESC} a} anyway(depending on the value of @code{meta-prefix-char}). Note that youpress @key{Meta} and @key{a} together, but with @key{ESC}, you press@key{ESC}, release it, and then press @key{a}.@node No Escape key, Compose Character, No Meta key, Key bindings@section What if I don't have an @key{Escape} key?@cindex No Escape key@cindex Lacking an Escape key@cindex Escape key, lackingType @kbd{C-[} instead. This should send @acronym{ASCII} code 27 just like anEscape key would. @kbd{C-3} may also work on some terminal (but notunder X). For many terminals (notably DEC terminals) @key{F11}generates @key{ESC}. If not, the following form can be used to bind it:@lisp;;; F11 is the documented ESC replacement on DEC terminals.(define-key function-key-map [f11] [?\e])@end lisp@node Compose Character, Binding combinations of modifiers and function keys, No Escape key, Key bindings@section Can I make my @key{Compose Character} key behave like a @key{Meta} key?@cindex @key{Compose Character} key, using as @key{Meta}@cindex @key{Meta}, using @key{Compose Character} forOn a dumb terminal such as a VT220, no. It is rumored that certainVT220 clones could have their @key{Compose} key configured this way. Ifyou're using X, you might be able to do this with the @code{xmodmap}command.@node Binding combinations of modifiers and function keys, Meta key does not work in xterm, Compose Character, Key bindings@section How do I bind a combination of modifier key and function key?@cindex Modifiers and function keys@cindex Function keys and modifiers@cindex Binding modifiers and function keysWith Emacs 19 and later, you can represent modified function keys invector format by adding prefixes to the function key symbol. Forexample (from the on-line documentation):@lisp(global-set-key [?\C-x right] 'forward-page)@end lisp@noindentwhere @samp{?\C-x} is the Lisp character constant for the character @kbd{C-x}.You can use the modifier keys @key{Control}, @key{Meta}, @key{Hyper},@key{Super}, @key{Alt}, and @key{Shift} with function keys. Torepresent these modifiers, prepend the strings @samp{C-}, @samp{M-},@samp{H-}, @samp{s-}, @samp{A-}, and @samp{S-} to the symbol name. Hereis how to make @kbd{H-M-RIGHT} move forward a word:@lisp(global-set-key [H-M-right] 'forward-word)@end lisp@itemize @bullet@itemNot all modifiers are permitted in all situations. @key{Hyper},@key{Super}, and @key{Alt} are not available on Unix characterterminals. Non-@acronym{ASCII} keys and mouse events (e.g. @kbd{C-=} and@kbd{Mouse-1}) also fall under this category.@end itemize@xref{Binding keys to commands}, for general key binding instructions.@node Meta key does not work in xterm, ExtendChar key does not work as Meta, Binding combinations of modifiers and function keys, Key bindings@section Why doesn't my @key{Meta} key work in an @code{xterm} window?@cindex @key{Meta} key and @code{xterm}@cindex Xterm and @key{Meta} key@inforef{Single-Byte Character Support, Single-Byte Character SetSupport, emacs}.If the advice in the Emacs manual fails, try all of these methods beforeasking for further help:@itemize @bullet@itemYou may have big problems using @code{mwm} as your window manager.(Does anyone know a good generic solution to allow the use of the@key{Meta} key in Emacs with @file{mwm}?)@itemFor X11: Make sure it really is a @key{Meta} key. Use @code{xev} tofind out what keysym your @key{Meta} key generates. It should be either@code{Meta_L} or @code{Meta_R}. If it isn't, use @file{xmodmap} to fixthe situation. If @key{Meta} does generate @code{Meta_L} or@code{Meta_R}, but @kbd{M-x} produces a non-@acronym{ASCII} character, put this inyour @file{~/.Xdefaults} file:@example XTerm*eightBitInput: false XTerm*eightBitOutput: true@end example@itemMake sure the @code{pty} the @code{xterm} is using is passing 8 bitcharacters. @samp{stty -a} (or @samp{stty everything}) should show@samp{cs8} somewhere. If it shows @samp{cs7} instead, use @samp{sttycs8 -istrip} (or @samp{stty pass8}) to fix it.@itemIf there is an @code{rlogin} connection between @code{xterm} and Emacs, the@samp{-8} argument may need to be given to rlogin to make it pass all 8 bitsof every character.@itemIf Emacs is running on Ultrix, it is reported that evaluating@code{(set-input-mode t nil)} helps.@itemIf all else fails, you can make @code{xterm} generate @kbd{@key{ESC} W} whenyou type @kbd{M-W}, which is the same conversion Emacs would make if itgot the @kbd{M-W} anyway. In X11R4, the following resourcespecification will do this:@exampleXTerm.VT100.EightBitInput: false@end example@noindent(This changes the behavior of the @code{insert-eight-bit} action.)With older @code{xterm}s, you can specify this behavior with a translation:@exampleXTerm.VT100.Translations: #override \ Meta<KeyPress>: string(0x1b) insert()@end example@noindentYou might have to replace @samp{Meta} with @samp{Alt}.@end itemize@node ExtendChar key does not work as Meta, , Meta key does not work in xterm, Key bindings@section Why doesn't my @key{ExtendChar} key work as a @key{Meta} key under HP-UX 8.0 and 9.x?@cindex @key{ExtendChar} key as @key{Meta}@cindex @key{Meta}, using @key{ExtendChar} for@cindex HP-UX, the @key{ExtendChar} keyThis is a result of an internationalization extension in X11R4 and thefact that HP is now using this extension. Emacs assumes that the@code{XLookupString} function returns the same result regardless of the@key{Meta} key state which is no longer necessarily true. Until Emacsis fixed, the temporary kludge is to run this command after each timethe X server is started but preferably before any xterm clients are:@examplexmodmap -e 'remove mod1 = Mode_switch'@end example@c FIXME: Emacs 21 supports I18N in X11; does that mean that this bug is@c solved?This will disable the use of the extra keysyms systemwide, which may beundesirable if you actually intend to use them.@c ------------------------------------------------------------@node Alternate character sets, Mail and news, Key bindings, Top@chapter Alternate character sets@cindex Alternate character sets@menu* Emacs does not display 8-bit characters::* Inputting eight-bit characters::* Kanji and Chinese characters::* Right-to-left alphabets::@end menu@node Emacs does not display 8-bit characters, Inputting eight-bit characters, Alternate character sets, Alternate character sets@section How do I make Emacs display 8-bit characters?@cindex Displaying eight-bit characters@cindex Eight-bit characters, displaying@inforef{Single-Byte Character Support, Single-byte Character SetSupport, emacs}. On a Unix, when Emacs runs on a text-only terminaldisplay or is invoked with @samp{emacs -nw}, you typically need to use@code{set-terminal-coding-system} to tell Emacs what the terminal candisplay, even after setting the language environment; otherwisenon-@acronym{ASCII} characters will display as @samp{?}. On other operatingsystems, such as MS-DOS and MS-Windows, Emacs queries the OS about thecharacter set supported by the display, and sets up the requiredterminal coding system automatically.@node Inputting eight-bit characters, Kanji and Chinese characters, Emacs does not display 8-bit characters, Alternate character sets@section How do I input eight-bit characters?@cindex Entering eight-bit characters@cindex Eight-bit characters, entering@cindex Input, 8-bit charactersVarious methods are available for input of eight-bit characters. See@inforef{Single-Byte Character Support, Single-byte Character SetSupport, emacs}. For more sophisticated methods, @inforef{InputMethods, Input Methods, emacs}.@node Kanji and Chinese characters, Right-to-left alphabets, Inputting eight-bit characters, Alternate character sets@section Where can I get an Emacs that handles kanji, Chinese, or other Far-Eastern character sets?@cindex Kanji, handling with Emacs@cindex Chinese, handling with Emacs@cindex Japanese, handling with Emacs@cindex Korean, handling with EmacsEmacs 20 and later includes many of the features of MULE, the MULtilingualEnhancement to Emacs. @xref{Installing Emacs}, for information on whereto find and download the latest version of Emacs.@node Right-to-left alphabets, , Kanji and Chinese characters, Alternate character sets@section Where is an Emacs that can handle Semitic (right-to-left) alphabets?@cindex Right-to-left alphabets@cindex Hebrew, handling with Emacs@cindex Semitic alphabets@cindex Arabic alphabetsEmacs 20 and later supports Hebrew characters (ISO 8859-8), but does notyet support right-to-left character entry and display.@email{joel@@exc.com, Joel M. Hoffman} has written a Lisp package called@file{hebrew.el} that allows right-to-left editing of Hebrew. Itreportedly works out of the box with Emacs 19, but requires patches forEmacs 18. Write to Joel if you want the patches or package.@c FIXME: Should we mention Ehud Karni's package?@file{hebrew.el} requires a Hebrew screen font, but no other hardware support.Joel has a screen font for PCs running MS-DOS or GNU/Linux.You might also try to query archie for files named with @file{hebrew};several ftp sites in Israel may also have the necessary files.@c ------------------------------------------------------------@node Mail and news, Concept index, Alternate character sets, Top@chapter Mail and news@cindex Mail and news@menu* Changing the included text prefix::* Saving a copy of outgoing mail::* Expanding aliases when sending mail::* Rmail thinks all messages are one big one::* Sorting the messages in an Rmail folder::* Rmail writes to /usr/spool/mail::* Recovering mail files when Rmail munges them::* Replying to the sender of a message::* MIME with Emacs mail packages::* Automatically starting a mail or news reader::* Reading news with Emacs::* Gnus does not work with NNTP::* Viewing articles with embedded underlining::* Saving a multi-part Gnus posting::* Starting Gnus faster::* Catching up in all newsgroups::* Killing based on nonstandard headers::* Removing flashing messages::* Catch-up is slow in Gnus::* Gnus hangs for a long time::* Learning more about Gnus::@end menu@node Changing the included text prefix, Saving a copy of outgoing mail, Mail and news, Mail and news@section How do I change the included text prefix in mail/news followups?@cindex Prefix in mail/news followups, changing@cindex Included text prefix, changing@cindex Setting the included text character@cindex Quoting in mail messagesIf you read mail with Rmail or news with Gnus, set the variable@code{mail-yank-prefix}. For VM, set @code{vm-included-text-prefix}.For mh-e, set @code{mh-ins-buf-prefix}.For fancier control of citations, use Supercite. @xref{Supercite}.To prevent Emacs from including various headers of the replied-tomessage, set the value of @code{mail-yank-ignored-headers} to anappropriate regexp.@node Saving a copy of outgoing mail, Expanding aliases when sending mail, Changing the included text prefix, Mail and news@section How do I save a copy of outgoing mail?@cindex Saving a copy of outgoing mail@cindex Copying outgoing mail to a file@cindex Filing outgoing mail@cindex Automatic filing of outgoing mail@cindex Mail, saving outgoing automaticallyYou can either mail yourself a copy by including a @samp{BCC} header in themail message, or store a copy of the message directly to a file byincluding an @samp{FCC} header.If you use standard mail, you can automatically create a @samp{BCC} toyourself by putting@lisp(setq mail-self-blind t)@end lisp@noindentin your @file{.emacs} file. You can automatically include an @samp{FCC}field by putting something like the following in your @file{.emacs}file:@lisp(setq mail-archive-file-name (expand-file-name "~/outgoing"))@end lispThe output file will be in Unix mail format, which can be read directlyby VM, but not always by Rmail. @xref{Learning how to do something}.If you use @code{mh-e}, add an @samp{FCC} or @samp{BCC} field to yourcomponents file.It does not work to put @samp{set record filename} in the @file{.mailrc}file.@node Expanding aliases when sending mail, Rmail thinks all messages are one big one, Saving a copy of outgoing mail, Mail and news@section Why doesn't Emacs expand my aliases when sending mail?@cindex Expanding aliases when sending mail@cindex Mail alias expansion@cindex Sending mail with aliases@itemize @bullet@itemYou must separate multiple addresses in the headers of the mail bufferwith commas. This is because Emacs supports RFC822 standard addresseslike this one:@exampleTo: Willy Smith <wks@@xpnsv.lwyrs.com>@end exampleHowever, you do not need to---and probably should not, unless yoursystem's version of @file{/usr/ucb/mail} (a.k.a.@: @code{mailx})supports RFC822---separate addresses with commas in your@file{~/.mailrc} file.@itemEmacs normally only reads the @file{.mailrc} file once per session,when you start to compose your first mail message. If you edit@file{.mailrc}, you can type @kbd{M-x rebuild-mail-abbrevs @key{RET}} tomake Emacs reread @file{~/.mailrc}.@itemIf you like, you can expand mail aliases as abbrevs, as soon as youtype them in. To enable this feature, execute the following:@lisp(add-hook 'mail-mode-hook 'mail-abbrevs-setup)@end lispNote that the aliases are expanded automatically only after you type@key{RET} or a punctuation character (e.g. @kbd{,}). You can force theirexpansion by moving point to the end of the alias and typing @kbd{C-x a e}(@kbd{M-x expand-abbrev}).@end itemize@node Rmail thinks all messages are one big one, Sorting the messages in an Rmail folder, Expanding aliases when sending mail, Mail and news@section Why does Rmail think all my saved messages are one big message?@cindex Rmail thinks all messages are one large messageA file created through the @samp{FCC} field in a message is in Unix mailformat, not the format that Rmail uses (BABYL format). Rmail will tryto convert a Unix mail file into BABYL format on input, but sometimes itmakes errors. For guaranteed safety, you can make the@file{saved-messages} file be an inbox for your Rmail file by using thefunction @code{set-rmail-inbox-list}.@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@section How can I sort the messages in my Rmail folder?@cindex Rmail, sorting messages in@cindex Folder, sorting messages in an Rmail@cindex Sorting messages in an Rmail folderIn Rmail, type @kbd{C-c C-s C-h} to get a list of sorting functionsand their key bindings.@node Rmail writes to /usr/spool/mail, Recovering mail files when Rmail munges them, Sorting the messages in an Rmail folder, Mail and news@section Why does Rmail need to write to @file{/usr/spool/mail}?@cindex Rmail and @file{/usr/spool/mail}@cindex @file{/usr/spool/mail} and RmailThis is the behavior of the @code{movemail} program which Rmail uses.This indicates that @code{movemail} is configured to use lock files.RMS writes:@quotationCertain systems require lock files to interlock access to mail files.On these systems, @code{movemail} must write lock files, or you risk losingmail. You simply must arrange to let @code{movemail} write them.Other systems use the @code{flock} system call to interlock access. Onthese systems, you should configure @code{movemail} to use @code{flock}.@end quotation@node Recovering mail files when Rmail munges them, Replying to the sender of a message, Rmail writes to /usr/spool/mail, Mail and news@section How do I recover my mail files after Rmail munges their format?@cindex Recovering munged mail files@cindex Rmail munged my files@cindex Mail files, recovering those munged by RmailIf you have just done @kbd{M-x rmail-input} on a file and you don't wantto save it in Rmail's format (called BABYL), just kill the buffer (with@kbd{C-x k}).@cindex Exporting messages as Unix mail filesIf you typed @kbd{M-x rmail} and it read some messages out of your inboxand you want to put them in a Unix mail file, use @kbd{C-o} on eachmessage.@cindex Converting from BABYL to Unix mail format@cindex @code{unrmail} commandIf you want to convert an existing file from BABYL format to Unix mailformat, use the command @kbd{M-x unrmail}: it will prompt you for theinput and output file names.@pindex b2mAlternatively, you could use the @code{b2m} program supplied withEmacs. @code{b2m} is a filter, and is used like this:@example b2m < @var{babyl-file} > @var{mbox-file}@end example@noindentwhere @var{babyl-file} is the name of the BABYL file, and@var{mbox-file} is the name of the file where the converted mail willbe written.@node Replying to the sender of a message, MIME with Emacs mail packages, Recovering mail files when Rmail munges them, Mail and news@section How can I force Rmail to reply to the sender of a message, but not the other recipients?@cindex Replying only to the sender of a message@cindex Sender, replying only to@cindex Rmail, replying to the sender of a message in@email{isaacson@@seas.upenn.edu, Ron Isaacson} says: When you hit@key{r} to reply in Rmail, by default it CCs all of the originalrecipients (everyone on the original @samp{To} and @samp{CC}lists). With a prefix argument (i.e., typing @kbd{C-u} before @key{r}),it replies only to the sender. However, going through the whole@kbd{C-u} business every time you want to reply is a pain. This is thebest fix I've been able to come up with:@lisp(defun rmail-reply-t () "Reply only to the sender of the current message. (See rmail-reply.)" (interactive) (rmail-reply t))(add-hook 'rmail-mode-hook (lambda () (define-key rmail-mode-map "r" 'rmail-reply-t) (define-key rmail-mode-map "R" 'rmail-reply)))@end lisp@node MIME with Emacs mail packages, Automatically starting a mail or news reader, Replying to the sender of a message, Mail and news@section How can I get my favorite Emacs mail package to support MIME?@cindex MIME and Emacs mail packages@cindex Mail packages and MIME@cindex FAQ for MIME and EmacsRead the Emacs MIME FAQ, maintained by @email{trey@@cs.berkeley.edu,MacDonald Hall Jackson} at@uref{http://bmrc.berkeley.edu/~trey/emacs/mime.html}Version 6.x of VM supports MIME. @xref{VM}. Gnus supports MIME in mailand news messages as of version 5.8.1 (Pterodactyl). Rmail has limitedsupport for single-part MIME messages beginning with Emacs 20.3.@node Automatically starting a mail or news reader, Reading news with Emacs, MIME with Emacs mail packages, Mail and news@section How do I make Emacs automatically start my mail/news reader?@cindex Mail reader, starting automatically@cindex News reader, starting automatically@cindex Starting mail/news reader automaticallyTo start Emacs in Gnus:@exampleemacs -f gnus@end example@noindentin Rmail:@exampleemacs -f rmail@end exampleA more convenient way to start with Gnus:@examplealias gnus 'emacs -f gnus'gnus@end exampleIt is probably unwise to automatically start your mail or news readerfrom your @file{.emacs} file. This would cause problems if you needed to runtwo copies of Emacs at the same time. Also, this would make it difficult foryou to start Emacs quickly when you needed to.@node Reading news with Emacs, Gnus does not work with NNTP, Automatically starting a mail or news reader, Mail and news@section How do I read news under Emacs?@cindex Reading news under Emacs@cindex Usenet reader in Emacs@cindex Gnus newsreaderUse @kbd{M-x gnus}. It is documented in Info (@pxref{Learning how to dosomething}).@node Gnus does not work with NNTP, Viewing articles with embedded underlining, Reading news with Emacs, Mail and news@section Why doesn't Gnus work via NNTP?@cindex Gnus and NNTP@cindex NNTP, Gnus fails to work withThere is a bug in NNTP version 1.5.10, such that when multiple requestsare sent to the NNTP server, the server only handles the first onebefore blocking waiting for more input which never comes. NNTP version1.5.11 claims to fix this.You can work around the bug inside Emacs like this:@lisp(setq nntp-maximum-request 1)@end lispYou can find out what version of NNTP your news server is running bytelnetting to the NNTP port (usually 119) on the news server machine(i.e., @kbd{telnet server-machine 119}). The server should give itsversion number in the welcome message. Type @kbd{quit} to get out.@xref{Spontaneous entry into isearch-mode}, for some additional ideas.@node Viewing articles with embedded underlining, Saving a multi-part Gnus posting, Gnus does not work with NNTP, Mail and news@section How do I view news articles with embedded underlining (e.g., ClariNews)?@cindex Underlining, embedded in news articles@cindex News articles with embedded underlining@cindex Embedded underlining in news articlesUnderlining appears like this:@example_^Hu_^Hn_^Hd_^He_^Hr_^Hl_^Hi_^Hn_^Hi_^Hn_^Hg@end example@email{abraham@@dina.kvl.dk, Per Abrahamsen} suggests using the followingcode, which uses the underline face to turn such text into trueunderlining, inconjunction with Gnus:@lisp(defun gnus-article-prepare-overstrike () ;; Prepare article for overstrike commands. (save-excursion (set-buffer gnus-article-buffer) (let ((buffer-read-only nil)) (goto-char (point-min)) (while (search-forward "\b" nil t) (let ((next (following-char)) (previous (char-after (- (point) 2)))) (cond ((eq next previous) (delete-region (- (point) 2) (point)) (put-text-property (point) (1+ (point)) 'face 'bold)) ((eq next ?_) (delete-region (1- (point)) (1+ (point))) (put-text-property (1- (point)) (point) 'face 'underline)) ((eq previous ?_) (delete-region (- (point) 2) (point)) (put-text-property (point) (1+ (point)) 'face 'underline))))))))(add-hook 'gnus-article-prepare-hook 'gnus-article-prepare-overstrike)@end lispLatest versions of Gnus do such a conversion automatically.If you prefer to do away with underlining altogether, you candestructively remove it with @kbd{M-x ununderline-region}; do thisautomatically via@lisp(add-hook 'gnus-article-prepare-hook (lambda () (ununderline-region (point-min) (point-max))))@end lisp@node Saving a multi-part Gnus posting, Starting Gnus faster, Viewing articles with embedded underlining, Mail and news@section How do I save all the items of a multi-part posting in Gnus?@cindex Multi-part postings in Gnus, saving@cindex Saving multi-part postings in Gnus@cindex Gnus, saving multi-part postings inUse @code{gnus-uu}. Type @kbd{C-c C-v C-h} in the Gnus summary bufferto see a list of available commands.@node Starting Gnus faster, Catching up in all newsgroups, Saving a multi-part Gnus posting, Mail and news@section How do I make Gnus start up faster?@cindex Faster, starting Gnus@cindex Starting Gnus faster@cindex Gnus, starting fasterFrom the Gnus FAQ (@pxref{Learning more about Gnus}):@quotation@email{pktiwari@@eos.ncsu.edu, Pranav Kumar Tiwari} writes: I postedthe same query recently and I got an answer to it. I am going torepeat the answer. What you need is a newer version of gnus, version5.0.4+. I am using 5.0.12 and it works fine with me with thefollowing settings:@lisp(setq gnus-check-new-newsgroups nil gnus-read-active-file 'some gnus-nov-is-evil nil gnus-select-method '(nntp gnus-nntp-server))@end lisp@end quotation@node Catching up in all newsgroups, Killing based on nonstandard headers, Starting Gnus faster, Mail and news@section How do I catch up all newsgroups in Gnus?@cindex Catching up all newsgroups in Gnus@cindex Gnus, Catching up all newsgroups inIn the @file{*Newsgroup*} buffer, type @kbd{M-< C-x ( c y C-x ) M-0 C-x e}Leave off the initial @kbd{M-<} if you only want to catch up from pointto the end of the @file{*Newsgroup*} buffer.@node Killing based on nonstandard headers, Removing flashing messages, Catching up in all newsgroups, Mail and news@section Why can't I kill in Gnus based on the Newsgroups/Keywords/Control headers?@cindex Killing articles based on nonstandard headers@cindex Newsgroups header, killing articles based on@cindex Keywords header, killing articles based on@cindex Control header, killing articles based onGnus will complain that the @samp{Newsgroups}, @samp{Keywords}, and@samp{Control} headers are ``Unknown header'' fields.For the @samp{Newsgroups} header, there is an easy workaround: kill on the@samp{Xref} header instead, which will be present on any cross-posted article(as long as your site carries the cross-post group).If you really want to kill on one of these headers, you can do it likethis:@lisp(gnus-kill nil "^Newsgroups: .*\\(bad\\.group\\|worse\\.group\\)")@end lisp@node Removing flashing messages, Catch-up is slow in Gnus, Killing based on nonstandard headers, Mail and news@section How do I get rid of flashing messages in Gnus for slow connections?@cindex Flashing Gnus messages, removing@cindex Removing flashing Gnus messages@cindex Slow connections causing flashing messages in Gnus@cindex Gnus, flashing messages inSet @code{nntp-debug-read} to @code{nil}.@node Catch-up is slow in Gnus, Gnus hangs for a long time, Removing flashing messages, Mail and news@section Why is catch up slow in Gnus?@cindex Slow catch up in Gnus@cindex Gnus is slow when catching up@cindex Crosspostings make Gnus catching up slowBecause Gnus is marking crosspostings read. You can control this withthe variable @code{gnus-use-cross-reference}.@node Gnus hangs for a long time, Learning more about Gnus, Catch-up is slow in Gnus, Mail and news@section Why does Gnus hang for a long time when posting?@cindex Hangs in Gnus@cindex Gnus hangs while posting@cindex Posting, Gnus hangs wile@email{tale@@uunet.uu.net, David Lawrence} explains:@quotationThe problem is almost always interaction between NNTP and C News. NNTPPOST asks C News's @code{inews} to not background itself but rather hangaround and give its exit status so it knows whether the post was successful.(That wait will on some systems not return the exit status of thewaited for job is a different sort of problem.) It ends up taking along time because @code{inews} is calling @code{relaynews}, which oftenwaits for another @code{relaynews} to free the lock on the news systemso it can file the article.My preferred solution is to change @code{inews} to not call@code{relaynews}, but rather use @code{newsspool}. This loses someerror-catching functionality, but is for the most part safe as@code{inews} will detect a lot of the errors on its own. The C Newsfolks have sped up @code{inews}, too, so speed should look better tomost folks as that update propagates around.@end quotation@node Learning more about Gnus, , Gnus hangs for a long time, Mail and news@section Where can I find out more about Gnus?@cindex FAQ for Gnus@cindex Gnus FAQ@cindex Learning more about GnusFor more information on Gnus, consult the Gnus manual and FAQ, which arepart of the Gnus distribution.@node Concept index, , Mail and news, Top@unnumbered Concept Index@printindex cp@contents@bye@ignore arch-tag: fee0d62d-06cf-43d8-ac21-123408eaf10f@end ignore