]> GNU Emacs FAQ Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007Free Software Foundation, Inc.Copyright 1994,1995,1996,1997,1998,1999,2000 Reuven M. LernerCopyright 1992,1993 Steven ByrnesCopyright 1990,1991,1992 Joseph Brian Wells This list of frequently asked questions about GNU Emacs with answers (“FAQ”) may be translated into other languages, transformed into other formats (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 FAQ itself. Every copy of the FAQ must include this notice or an approved translation, information on who is currently maintaining the FAQ and how to contact them (including their e-mail address), and information on where the latest version of the FAQ is archived (including FTP information). The FAQ may be copied and redistributed under these conditions, except that the FAQ may not be embedded in a larger literary work unless that work itself allows free copying and redistribution. [This version has been heavily edited since it was included in the Emacs distribution.] This is the GNU Emacs FAQ, last updated on 27 August 2007.This FAQ is maintained as a part of GNU Emacs. If you find any errors,or have any suggestions, please use M-x report-emacs-bugto reportthem. FAQ notation FAQ notation This chapter describes notation used in the GNU Emacs FAQ, as well as in the Emacs documentation. Consult this section if this is the first time you are reading the FAQ, or if you are confused by notation or terms used in the FAQ. What do these mean: C-h, C-M-a, RET, ESC a, etc.? Basic keys Control key, notation for Meta key, notation for Control-Meta characters, notation for C-h, definition of C-M-h, definition of DEL, definition of ESC, definition of LFD, definition of RET, definition of SPC, definition of TAB, definition of Notation for keys C-x: press the x key while holding down the Control key M-x: press the x key while holding down the Meta key(if your computer doesn't have a Meta key, see ) M-C-x: press the x key while holding down both Controland Meta C-M-x: a synonym for the above LFD: Linefeed or Newline; same as C-j RET: Return, sometimes marked Enter; same as C-m DEL: Delete, usually not the same asBackspace; same as C-? (see , ifdeleting invokes Emacs help) ESC: Escape; same as C-[ TAB: Tab; same as C-i SPC: Space bar Key sequences longer than one key (and some single-key sequences) are written inside quotes or on lines by themselves, like this: M-x frobnicate-while-foo RET Any real spaces in such a key sequence should be ignored; only SPC really means press the space key. The ASCII code sent by C-x (except for C-?) is the value that would be sent by pressing just x minus 96 (or 64 for upper-case X) and will be from 0 to 31. On Unix and GNU/Linux terminals, the ASCII code sent by M-x is the sum of 128 and the ASCII code that would be sent by pressing just x. Essentially, Control turns off bits 5 and 6 and Meta turns on bit 7 DOS and Windows terminals don't set bit 7 when the Meta key is pressed.. C-? (aka DEL) is ASCII code 127. It is a misnomer to call C-? a “control” key, since 127 has both bits 5 and 6 turned ON. Also, on very few keyboards does C-? generate ASCII code 127. *note Text Characters: (emacs)Text Characters, and *note Keys: (emacs)Keys, for more information. (See , for more information about Info.) What does M-x command mean? Extended commands Commands, extended M-x, meaning of M-x command means type M-x, then type the name of the command, then type RET. (See , if you're not sure what M-x and RET mean.) M-x (by default) invokes the command execute-extended-command. This command allows you to run any Emacs command if you can remember the command's name. If you can't remember the command's name, you can type TAB and SPC for completion, ? for a list of possibilities, and M-p and M-n (or up-arrow and down-arrow on terminals that have these editing keys) to see previous commands entered. An Emacs command is an interactive Emacs function. Do key Your system administrator may have bound other key sequences to invoke execute-extended-command. A function key labeled Do is a good candidate for this, on keyboards that have such a key. If you need to run non-interactive Emacs functions, see . How do I read topic XXX in the on-line manual? On-line manual, reading topics in Reading topics in the on-line manual Finding topics in the on-line manual Info, finding topics in When we refer you to some topic in the on-line manual, you can read this manual node inside Emacs (assuming nothing is broken) by typing C-h i m emacs RET m topic RET. This invokes Info, the GNU hypertext documentation browser. If you don't already know how to use Info, type ? from within Info. If we refer to topic:subtopic, type C-h i m emacs RET m topic RET m subtopic RET. If these commands don't work as expected, your system administrator may not have installed the Info files, or may have installed them improperly. In this case you should complain. See , if you would like a paper copy of the Emacs manual. What are etc/SERVICE, src/config.h, and lisp/default.el? File-name conventions Conventions for file names Directories and files that come with Emacs These are files that come with Emacs. The Emacs distribution is divided into subdirectories; the important ones are etc, lisp, and src. If you use Emacs, but don't know where it is kept on your system, start Emacs, then type C-h v data-directory RET. The directory name displayed by this will be the full pathname of the installed etc directory. (This full path is recorded in the Emacs variable data-directory, and C-h v displays the value and the documentation of a variable.) The location of your Info directory (i.e., where on-line documentation is stored) is kept in the variable Info-default-directory-list. Use C-h v Info-default-directory-list RET to see the value of this variable, which will be a list of directory names. The last directory in that list is probably where most Info files are stored. By default, Info documentation is placed in /usr/local/info. Some of these files are available individually via FTP or e-mail; see . They all are available in the source distribution. Many of the files in the etc directory are also available via the Emacs ‘Help’ menu, or by typing C-h ? (M-x help-for-help). Your system administrator may have removed the src directory and many files from the etc directory. What are FSF, LPF, OSF, GNU, RMS, FTP, and GPL? FSF, definition of LPF, definition of OSF, definition of GNU, definition of RMS, definition of Stallman, Richard, acronym for Richard Stallman, acronym for FTP, definition of GPL, definition of Acronyms, definitions for Common acronyms, definitions for FSF Free Software Foundation LPF League for Programming Freedom OSF Open Software Foundation GNU GNU's Not Unix RMS Richard Matthew Stallman FTP File Transfer Protocol GPL GNU General Public License Avoid confusing the FSF, the LPF, and the OSF. The LPF opposes look-and-feel copyrights and software patents. The FSF aims to make high quality free software available for everyone. The OSF is a consortium of computer vendors which develops commercial software for Unix systems. The word “free” in the title of the Free Software Foundation refers to “freedom,” not “zero cost.” Anyone can charge any price for GPL-covered software that they want to. However, in practice, the freedom enforced by the GPL leads to low prices, because you can always get the software for less money from someone else, since everyone has the right to resell or give away GPL-covered software. General questions General questions This chapter contains general questions having to do with Emacs, the Free Software Foundation, and related organizations. What is the LPF? LPF, description of League for Programming Freedom Software patents, opposition to Patents for software, opposition to The LPF opposes the expanding danger of software patents and look-and-feel copyrights. To get more information, feel free to contact the LPF via e-mail or otherwise. You may also contact Joe Wells; he will be happy to talk to you about the LPF. You can find more information about the LPF in the file etc/LPF. More papers describing the LPF's views are available on the Internet and also from the LPF home page. What is the real legal meaning of the GNU copyleft? Copyleft, real meaning of GPL, real meaning of General Public License, real meaning of Discussion of the GPL The real legal meaning of the GNU General Public License (copyleft) will only be known if and when a judge rules on its validity and scope. There has never been a copyright infringement case involving the GPL to set any precedents. Please take any discussion regarding this issue to the newsgroup news:gnu.misc.discuss, which was created to hold the extensive flame wars on the subject. RMS writes: The legal meaning of the GNU copyleft is less important than the spirit, which is that Emacs is a free software project and that work pertaining to Emacs should also be free software. “Free” means that all users have the freedom to study, share, change and improve Emacs. To make sure everyone has this freedom, pass along source code when you distribute any version of Emacs or a related program, and give the recipients the same freedom that you enjoyed. What are appropriate messages for news:gnu.emacs.help, news:gnu.emacs.bug, news:comp.emacs, etc.? Newsgroups, appropriate messages for GNU newsgroups, appropriate messages for Usenet groups, appropriate messages for Mailing lists, appropriate messages for Posting messages to newsgroups GNU mailing lists The file etc/MAILINGLISTS describes the purpose of each GNU mailing list. (See , if you want a copy of the file.) For those lists which are gatewayed with newsgroups, it lists both the newsgroup name and the mailing list address. The newsgroup news:comp.emacs is for discussion of Emacs programs in general. This includes Emacs along with various other implementations, such as XEmacs, JOVE, MicroEmacs, Freemacs, MG, Unipress, CCA, and Epsilon. Many people post Emacs questions to news:comp.emacs because they don't receive any of the gnu.* newsgroups. Arguments have been made both for and against posting GNU-Emacs-specific material to news:comp.emacs. You have to decide for yourself. Messages advocating “non-free” software are considered unacceptable on any of the gnu.* newsgroups except for 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't freely modify the source code and exchange enhancements. Be careful to remove the gnu.* groups from the ‘Newsgroups:’ line when posting a followup that recommends such software. news:gnu.emacs.bug is a place where bug reports appear, but avoid posting bug reports to this newsgroup directly (see ). Where can I get old postings to news:gnu.emacs.help and other GNU groups? Archived postings from gnu.emacs.help Usenet archives for GNU groups Old Usenet postings for GNU groups The FSF has maintained archives of all of the GNU mailing lists for many years, although there may be some unintentional gaps in coverage. The archive is not particularly well organized or easy to retrieve individual postings from, but pretty much everything is there. The archive is at ftp://lists.gnu.org/. The archive can be browsed over the web at the GNU mail archive. Web-based Usenet search services, such as Google, also archive the gnu.* groups. You can read the archives of the gnu.* groups and post new messages at Gmane. Where should I report bugs and other problems with Emacs? Bug reporting Good bug reports How to submit a bug report Reporting bugs The correct way to report Emacs bugs is to use the command M-x report-emacs-bug. It sets up a mail buffer with the essential information and the correct e-mail address which is for the released versions of Emacs. Anything sent to also appears in the newsgroup news:gnu.emacs.bug, but please use e-mail instead of news to submit the bug report. This ensures a reliable return address so you can be contacted for further details. Be sure to read the “Bugs” section of the Emacs manual before reporting a bug! The manual describes in detail how to submit a useful bug report (see See section ``Reporting Bugs'' in The GNU Emacs Manual). (See , if you don't know how to read the manual.) RMS says: Sending bug reports to (which has the effect of posting on news:gnu.emacs.help) is undesirable because it takes the time of an unnecessarily large group of people, most of whom are just users and have no idea how to fix these problem. reaches a much smaller group of people who are more likely to know what to do and have expressed a wish to receive more messages about Emacs than the others. RMS says it is sometimes fine to post to news:gnu.emacs.help: If 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 gnu.emacs.help asking if anyone can help you. If you are unsure whether you have found a bug, consider the following non-exhaustive list, courtesy of RMS: If Emacs crashes, that is a bug. If Emacs gets compilation errors while building, that is a bug. If Emacs crashes while building, that is a bug. If Lisp code does not do what the documentation says it does, that is a bug. How do I unsubscribe from this mailing list? Unsubscribing from GNU mailing lists Removing yourself from GNU mailing lists If you are receiving a GNU mailing list named list, you might be able to unsubscribe from it by sending a request to the address . However, this will not work if you are not listed on the main mailing list, but instead receive the mail from a distribution point. In that case, you will have to track down at which distribution point you are listed. Inspecting the ‘Received’ headers on the mail messages may help, along with liberal use of the ‘EXPN’ or ‘VRFY’ sendmail commands through ‘telnet site-address smtp’. Ask your postmaster for help, if you cannot figure out these details. What is the current address of the FSF? Snail mail address of the FSF Postal address of the FSF Contracting the FSF Free Software Foundation, contacting E-mail gnu@gnu.org Telephone +1-617-542-5942 Fax +1-617-542-2652 World Wide Web http://www.gnu.org/ Postal address Free Software Foundation51 Franklin Street, Fifth FloorBoston, MA 02110-1301USA Ordering GNU software For details on how to order items directly from the FSF, see the GNU Web site. Getting help Getting help This chapter tells you how to get help with Emacs I'm just starting Emacs; how do I do basic editing? Basic editing with Emacs Beginning editing Tutorial, invoking the Self-paced tutorial, invoking the Help system, entering the Type C-h t to invoke the self-paced tutorial. Just typing C-h enters the help system. Starting with Emacs 22, the tutorial is available in many foreign languages such as French, German, Japanese, Russian, etc. Use M-x help-with-tutorial-spec-language RET to choose your language and start the tutorial. Your system administrator may have changed C-h to act like DEL to deal with local keyboards. You can use M-x help-for-help instead to invoke help. To discover what key (if any) invokes help on your system, type M-x where-is RET help-for-help RET. This will print a comma-separated list of key sequences in the echo area. Ignore the last character in each key sequence listed. Each of the resulting key sequences invokes help. Emacs help works best if it is invoked by a single key whose value should be stored in the variable help-char. How do I find out how to do something in Emacs? Help for Emacs Learning to do something in Emacs Reference card for Emacs Overview of help systems There are several methods for finding out how to do things in Emacs. Reading the Emacs manual The complete text of the Emacs manual is available on-line via the Infohypertext reader. Type C-h r to display the manual in Info mode.Typing h immediately after entering Info will provide a shorttutorial on how to use it. Lookup a subject in a manual Index search in a manual To quickly locate the section of the manual which discusses a certainissue, or describes a command or a variable, type C-h i m emacsRET i topic RET, where 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 ,(comma) repeatedly until you find what you need. (The i and, keys invoke the index-searching functions, which look for thetopic you type in all the indices of the Emacs manual.) Apropos You can list all of the commands whose names contain a certain word(actually which match a regular expression) using C-h a (M-xcommand-apropos). Command description in the manual The command C-h F (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. Finding commands and variables You can list all of the functions and variables whose names contain acertain word using M-x apropos. You can list all of the functions and variables whose documentationmatches a regular expression or a string, using M-xapropos-documentation. You can order a hardcopy of the manual from the FSF. See . Reference cards, in other languages You 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 etc/refcard.tex oretc/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 namedetc/lang-refcard.*, where lang is a two-letter codeof the language. For example, the German version of the reference cardis in the files etc/de-refcard.tex and etc/de-refcard.ps. There are many other commands in Emacs for getting help andinformation. To get a list of these commands, type ‘?’ afterC-h. How do I get a printed copy of the Emacs manual? Printed Emacs manual, obtaining Manual, obtaining a printed or HTML copy of Emacs manual, obtaining a printed or HTML copy of You can order a printed copy of the Emacs manual from the FSF. For details see the GNU Web site. The full Texinfo source for the manual also comes in the man directory of the Emacs distribution, if you're daring enough to try to print out this 620-page manual yourself (see ). If you absolutely have to print your own copy, and you don't have &tex;, you can get a PostScript version from http://www.gnu.org/software/emacs/manual/emacs.ps.gz HTML version of Emacs manual, obtaining An HTML version of the manual is at http://www.gnu.org/software/emacs/manual/emacs.html The manual is available in other formats at http://www.gnu.org/software/emacs/manual/ See , for how to view the manual on-line. Where can I get documentation on Emacs Lisp? Documentation on Emacs Lisp Function documentation Variable documentation Emacs Lisp Reference Manual Reference manual for Emacs Lisp Within Emacs, you can type C-h f to get the documentation for a function, C-h v for a variable. For more information, the Emacs Lisp Reference Manual is available on-line, in Info format. See See section ``Top'' in The Emacs Lisp Reference Manual. You can also order a hardcopy of the manual, details on ordering it from FSF are on the GNU Web site. An HTML version of the Emacs Lisp Reference Manual is available at http://www.gnu.org/software/emacs/elisp-manual/elisp.html How do I install a piece of Texinfo documentation? Texinfo documentation, installing Installing Texinfo documentation New Texinfo files, installing Documentation, installing new Texinfo files Info files, how to install First, you must turn the Texinfo files into Info files. You may do this using the stand-alone makeinfo program, available as part of the latest Texinfo package at ftp://ftp.gnu.org/pub/gnu/texinfo/texinfo-4.8.tar.gz and all mirrors of ‘ftp.gnu.org’ (for a list, see ). For information about the Texinfo format, read the Texinfo manual which comes with the Texinfo package. This manual also comes installed in Info format, so you can read it on-line; type C-h i m texinfo RET. Alternatively, you could use the Emacs command M-x texinfo-format-buffer, after visiting the Texinfo source file of the manual you want to convert. Neither texinfo-format-buffer nor makeinfo installs the resulting Info files in Emacs's Info tree. To install Info files, perform these steps: Move the files to the info directory in the installed Emacsdistribution. See , if you don't know where thatis. Run the install-info command, which is part of the Texinfodistribution, to update the main Info directory menu, like this: install-info --info-dir=dir-path dir-path/file where dir-path is the full path to the directory where you copiedthe produced Info file(s), and file is the name of the Info fileyou produced and want to install.If you don't have the install-info command installed, you canedit the 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: * Topic: (relative-pathname). Short description of topic. If you want to install Info files and you don't have the necessary privileges, you have several options: Info files don't actually need to be installed before being used.You can use a prefix argument for the info command and specifythe name of the Info file in the minibuffer. This goes to the nodenamed ‘Top’ in that file. For example, to view a Info file namedinfo-file in your home directory, you can type this: C-u C-h i ~/info-file RET Alternatively, you can feed a file name to the Info-goto-nodecommand (invoked by pressing g in Info mode) by typing the nameof the file in parentheses, like this: C-h i g (~/info-file) RET You can create your own Info directory. You can tell Emacs where thatInfo directory is by adding its pathname to the value of the variableInfo-default-directory-list. For example, to use a private Infodirectory which is a subdirectory of your home directory named Info,you could put this in your .emacs file:(setq Info-default-directory-list (cons "~/Info" Info-default-directory-list))You will need a top-level Info file named dir in this directorywhich has everything the system 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 dirfiles. The node lists from all dir files inInfo-default-directory-list are merged by the Info system. How do I print a Texinfo file? Printing a Texinfo file Texinfo file, printing Printing documentation You can't get nicely printed output from Info files; you must still have the original Texinfo source file for the manual you want to print. Assuming you have &tex; installed on your system, follow these steps: Make sure the first line of the Texinfo file looks like this: \input texinfo You may need to change ‘texinfo’ to the full pathname of thetexinfo.tex file, which comes with Emacs asman/texinfo.tex (or copy or link it into the current directory). Type texi2dvi texinfo-source, where texinfo-source isthe name of the Texinfo source file for which you want to produce aprinted copy.The ‘texi2dvi’ script is part of the GNU Texinfo distribution(see ). Print the DVI file texinfo-source.dvi in the normal way forprinting DVI files at your site. For example, if you have a PostScriptprinter, run the dvips program to print the DVI file on thatprinter. To get more general instructions, retrieve the latest Texinfo package (see ). Can I view Info files without using Emacs? Viewing Info files Info file viewers Alternative Info file viewers Yes. Here are some alternative programs: info, a stand-alone version of the Info program, comes as part ofthe Texinfo package. See , fordetails. Xinfo, a stand-alone version of the Info program that runs under XWindow system. You can get it atftp://ftp.gnu.org/pub/gnu/xinfo/xinfo-1.01.01.tar.gz and allmirrors of ‘ftp.gnu.org’ (see , for alist of mirrors). Tkinfo, an Info viewer that runs under X Window system and uses Tcl/Tk.You can get Tkinfo athttp://math-www.uni-paderborn.de/~axel/tkinfo/. What informational files are available for Emacs? Informational files included with Emacs Files included with Emacs COPYING, description of file DISTRIB, description of file FTP, description of file GNU, description of file INTERVIEW, description of file LPF, description of file MACHINES, description of file MAILINGLISTS, description of file NEWS, description of file SERVICE, description of file SUN-SUPPORT, description of file This isn't a frequently asked question, but it should be! A variety of informational files about Emacs and relevant aspects of the GNU project are available for you to read. The following files are available in the etc directory of the Emacs distribution (see , if you're not sure where that is). COPYING GNU General Public License DISTRIB Emacs Availability Information, including the popular Free SoftwareFoundation Order Form FTP How to get GNU Software by Internet FTP or by UUCP GNU The GNU Manifesto INTERVIEW Richard Stallman discusses his public-domain UNIX-compatible softwaresystem with BYTE editors LPF Why you should join the League for Programming Freedom MACHINES Status of Emacs on Various Machines and Systems MAILINGLISTS GNU Project Electronic Mailing Lists NEWS Emacs news, a history of recent user-visible changes SERVICE GNU Service Directory SUN-SUPPORT including “Using Emacstool with GNU Emacs” More GNU information, including back issues of the GNU's Bulletin, are at http://www.gnu.org/bulletins/bulletins.html and http://www.cs.pdx.edu/~trent/gnu/gnu.html Where can I get help in installing Emacs? Installation help Help installing Emacs See , for some basic installation hints, and see , or , if you have problems with the installation. The file etc/SERVICE (see , if you're not sure where that is) lists companies and individuals willing to sell you help in installing or using Emacs. An up-to-date version this file is available on ‘ftp.gnu.org’ (see ). Where can I get the latest version of this FAQ? FAQ, obtaining the Latest FAQ version, obtaining the Retrieving the latest FAQ version E-mail, retrieving the FAQ via Web, reading the FAQ on the The Emacs FAQ is available in several ways: Inside of Emacs itself. You can get it from selecting the ‘EmacsFAQ’ option from the ‘Help’ menu of the Emacs menu bar at the topof any Emacs frame, or by typing C-h C-f (M-x view-emacs-FAQ). Via USENET. If you can read news, the FAQ should be available in yournews spool, in both the news:gnu.emacs.help andnews: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 rn, this commandwill do this for you at the article selection level: ?GNU Emacs Frequently Asked Questions?rc:m In Gnus, you should type C-u C-x C-s from the *Summary*buffer or C-u SPC from the *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. In the Emacs distribution. Since Emacs 18.56, the FAQ at the timeof release has been part of the Emacs distribution as eitheretc/FAQ or man/faq.texi (see ). Via anonymous ftp and e-mail from rtfm.mit.edu (and its mirror inEurope), the main repository for FAQs and other items posted tonews.answers. The Emacs FAQs are available atftp://rtfm.mit.edu/pub/usenet/comp.emacs/ andftp://ftp.uni-paderborn.de/pub/doc/FAQ/comp/emacs/If you do not have access to anonymous FTP, you can access the archivesusing the rtfm.mit.edu mail server. The Emacs FAQ can beretrieved by sending mail to with ablank subject and containing send usenet/news.answers/GNU-Emacs-FAQ/diffs send usenet/news.answers/GNU-Emacs-FAQ/part1 send usenet/news.answers/GNU-Emacs-FAQ/part2 send usenet/news.answers/GNU-Emacs-FAQ/part3 send usenet/news.answers/GNU-Emacs-FAQ/part4 send usenet/news.answers/GNU-Emacs-FAQ/part5 For more information, send email to with ‘help’ and ‘index’ in the body on separate lines. Status of Emacs Status of Emacs This chapter gives you basic information about Emacs, including its latest version status. Where does the name “Emacs” come from? Origin of the term “Emacs” Emacs name origin TECO Original version of Emacs Emacs originally was an acronym for Editor MACroS. RMS says he “picked the name Emacs because E was not in use as an abbreviation on ITS at the time.” The first Emacs was a set of macros written in 1976 at MIT by RMS for the editor TECO (Text Editor and COrrector, originally Tape Editor and COrrector) under ITS on a PDP-10. RMS had already extended TECO with a “real-time” full-screen mode with reprogrammable keys. Emacs was started by Guy Steele as a project to 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; you can read more at news:alt.lang.teco. Someone has written a TECO implementation in Emacs Lisp (to find it, see ); it would be an interesting project to run the original TECO Emacs inside of Emacs. Why Emacs? For some not-so-serious alternative reasons for Emacs to have that name, check out the file etc/JOKES (see ). What is the latest version of Emacs? Version, latest Latest version of Emacs Emacs 22.1 is the current version as of this writing. What is different about Emacs 20? Differences between Emacs 19 and Emacs 20 Emacs 20, new features in To find out what has changed in recent versions, type C-h C-n (M-x view-emacs-news). The oldest changes are at the bottom of the file, so you might want to read it starting there, rather than at the top. The differences between Emacs versions 18 and 19 was rather dramatic; the introduction of frames, faces, and colors on windowing systems was obvious to even the most casual user. There are differences between Emacs versions 19 and 20 as well, but many are more subtle or harder to find. Among the changes are the inclusion of MULE code for languages that use non-Latin characters and for mixing several languages in the same document; the “Customize” facility for modifying variables without having to use Lisp; and automatic conversion of files from Macintosh, Microsoft, and Unix platforms. A number of older Lisp packages, such as Gnus, Supercite and the calendar/diary, have been updated and enhanced to work with Emacs 20, and are now included with the standard distribution. What is different about Emacs 21? Differences between Emacs 20 and Emacs 21 Emacs 21, new features in Recently introduced features Variable-size fonts Toolbar support Emacs 21 features a thorough rewrite of the display engine. The new display engine supports variable-size fonts, images, and can play sounds on platforms which support that. As a result, the visual appearance of Emacs, when it runs on a windowed display, is much more reminiscent of modern GUI programs, and includes 3D widgets (used for the mode line and the scroll bars), a configurable and extensible toolbar, tooltips (a.k.a. balloon help), and other niceties. Colors on text-only terminals TTY colors In addition, Emacs 21 supports faces on text-only terminals. This means that you can now have colors when you run Emacs on a GNU/Linux console and on xterm with emacs -nw. What is different about Emacs 22? Differences between Emacs 21 and Emacs 22 Emacs 22, new features in Recently introduced features Default features GTK+ Toolkit Drag-and-drop Emacs can be built with GTK+ widgets, and supports drag-and-dropoperation on X. Supported systems Emacs 22 features support for GNU/Linux systems on S390 and x86-64machines, as well as support for the Mac OS X and Cygwin operatingsystems. The native MS-Windows, Mac OS 9 and Mac OS X builds include full supportfor images, toolbar, and tooltips. Font Lock mode, Auto Compression mode, and File Name Shadow Mode areenabled by default. The maximum size of buffers has been doubled and is 256M on 32-bitmachines. Links can be followed with mouse-1, in addition to mouse-2. Mouse wheel Mouse wheel support is enabled by default. Window fringes are customizable. The mode line of the selected window is now highlighted. The minibuffer prompt is displayed in a distinct face. Abbrev definitions are read automatically at startup. Grep mode is separate from Compilation mode and has many new options andcommands specific to grep. The original Emacs macro system has been replaced by the new Kmacropackage, which provides many new commands and features and a simpleinterface that uses the function keys F3 and F4. Macros are stored in amacro ring, and can be debugged and edited interactively. The Grand Unified Debugger (GUD) can be used with a full graphical userinterface to GDB; this provides many features found in traditionaldevelopment environments, making it easy to manipulate breakpoints, addwatch points, display the call stack, etc. Breakpoints are visuallyindicated in the source buffer. New modesMany new modes and packages have been included in Emacs, such as Calc,TRAMP, URL, IDO, CUA, ERC, rcirc, Table, Image-Dired, SES, Ruler, Org,PGG, Flymake, Password, Printing, Reveal, wdired, t-mouse, longlines,savehist, Conf mode, Python mode, DNS mode, etc. Multilingual Environment Leim is now part of Emacs. Unicode support has been much improved, andthe following input methods have been added: belarusian, bulgarian-bds,bulgarian-phonetic, chinese-sisheng, croatian, dutch, georgian,latin-alt-postfix, latin-postfix, latin-prefix, latvian-keyboard,lithuanian-numeric, lithuanian-keyboard, malayalam-inscript, rfc1345,russian-computer, sgml, slovenian, tamil-inscript, ucs,ukrainian-computer, vietnamese-telex, and welsh.The following language environments have also been added: Belarusian,Bulgarian, Chinese-EUC-TW, Croatian, French, Georgian, Italian, Latin-6,Latin-7, Latvian, Lithuanian, Malayalam, Russian, Slovenian, Swedish,Tajik, Tamil, UTF-8, Ukrainian, Welsh, and Windows-1255. Documentation Emacs Lisp Manual In addition, Emacs 22 now includes the Emacs Lisp Reference Manual(see ) and the Emacs Lisp Intro. Many other changes have been made in Emacs 22, use C-h n to get a full list. Common requests Common requests How do I set up a .emacs file properly? .emacs file, setting up .emacs file, locating Init file, setting up Customization file, setting up *note Init File: (emacs)Init File. In general, new Emacs users should not have .emacs files, because it causes confusing non-standard behavior. Then they send questions to asking why Emacs isn't behaving as documented. Beginning with version 20.1, Emacs includes the new Customize facility (see ). This allows users who are unfamiliar with Emacs Lisp to modify their .emacs files in a relatively straightforward way, using menus rather than Lisp code. Most packages support Customize as of this writing. While Customize might indeed make it easier to configure Emacs, consider taking a bit of time to learn Emacs Lisp and modifying your .emacs directly. Simple configuration options are described rather completely in *note Init File: (emacs)Init File, for users interested in performing frequently requested, basic tasks. Sometimes users are unsure as to where their .emacs file should be found. Visiting the file as ~/.emacs from Emacs will find the correct file. How do I start using Customize? Customize groups Customizing variables Customizing faces The main Customize entry point is M-x customize RET. This command takes you to a buffer listing all the available Customize groups. From there, you can access all customizable options and faces, change their values, and save your changes to your init file. *note Easy Customization: (emacs)Easy Customization. If you know the name of the group in advance (e.g. “shell”), use M-x customize-group RET. If you wish to customize a single option, use M-x customize-option RET. This command prompts you for the name of the option to customize, with completion. How do I get colors and syntax highlighting on a TTY? Colors on a TTY Syntax highlighting on a TTY Console, colors In 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 when invoked as ‘emacs -nw’ on X, MS-Windows, and Mac. (Colors and faces were supported in the MS-DOS port since Emacs 19.29.) Emacs automatically detects color support at startup and uses it if available. If you think that your terminal supports colors, but Emacs won't use them, check the termcap entry for your display type for color-related capabilities. The command M-x list-colors-display pops up a window which exhibits all the colors Emacs knows about on the current display. Syntax highlighting is on by default since version 22.1. How do I debug a .emacs file? Debugging .emacs file .emacs debugging Init file debugging -debug-init’ option Start Emacs with the ‘-debug-init’ command-line option. This enables the Emacs Lisp debugger before evaluating your .emacs file, and places you in the debugger if something goes wrong. The top line in the trace-back buffer will be the error message, and the second or third line of that buffer will display the Lisp code from your .emacs file that caused the problem. You can also evaluate an individual function or argument to a function in your .emacs file by moving the cursor to the end of the function or argument and typing C-x C-e (M-x eval-last-sexp). Use C-h v (M-x describe-variable) to check the value of variables which you are trying to set or use. How do I make Emacs display the current line (or column) number? line-number-mode Displaying the current line or column Line number, displaying the current Column, displaying the current mode-line-format To have Emacs automatically display the current line number of the point in the mode line, do M-x line-number-mode. You can also put the form(setq line-number-mode t) in your .emacs file to achieve this whenever you start Emacs. (Line number display is on by default, unless your site-specific initialization disables it.) Note that Emacs will not display the line number if the buffer's size in bytes is larger than the value of the variable line-number-display-limit. You can similarly display the current column with M-x column-number-mode, or by putting the form(setq column-number-mode t) in your .emacs file. The "%c" format specifier in the variable mode-line-format will insert the current column's value into the mode line. See the documentation for mode-line-format (using C-h v mode-line-format RET) for more information on how to set and use this variable. Users of all Emacs versions can display the current column using the ‘column’ package written by Per Abrahamsen. See , for instructions on how to get it. Set number capability in vi emulators None of the vi emulation modes provide the “set number” capability of vi (as far as we know). The ‘setnu’ package written by Kyle Jones provides this feature. So too does ‘wb-line-number’, written by Naoki Nakamura. How can I modify the titlebar to contain the current file name? Titlebar, displaying the current file name in File name, displaying in the titlebar frame-title-format The contents of an Emacs frame's titlebar is controlled by the variable frame-title-format, which has the same structure as the variable mode-line-format. (Use C-h v or M-x describe-variable to get information about one or both of these variables.) By default, the titlebar for a frame does contain the name of the buffer currently being visited, except if there is a single frame. In such a case, the titlebar contains Emacs invocation name and the name of the machine at which Emacs was invoked. This is done by setting frame-title-format to the default value of(multiple-frames "%b" ("" invocation-name "@" system-name)) To modify the behavior such that frame titlebars contain the buffer's name regardless of the number of existing frames, include the following in your .emacs:(setq frame-title-format "%b") How do I turn on abbrevs by default just in mode mymode? Abbrevs, turning on by default Put this in your .emacs file:(condition-case () (quietly-read-abbrev-file) (file-error nil))(add-hook ' mymode-mode-hook (lambda () (setq abbrev-mode t))) Starting with Emacs 22, the standard abbrevs file is read automatically at startup, so the first of these two forms becomes unnecessary. How do I make Emacs use a certain major mode for certain files? Associating modes with files File extensions and modes auto-mode-alist, modifying Modes, associating with file extensions If you want to use a certain mode foo for all files whose names end with the extension .bar, this will do it for you:(setq auto-mode-alist (cons '("\\. bar\\'" . foo-mode) auto-mode-alist)) Otherwise put this somewhere in the first line of any file you want to edit in the mode foo (in the second line, if the first line begins with ‘#!’): -*- foo -*- Major mode for shell scripts Beginning with Emacs 19, the variable interpreter-mode-alist specifies which mode to use when loading a shell script. (Emacs determines which interpreter you're using by examining the first line of the script.) This feature only applies when the file name doesn't indicate which mode to use. Use C-h v (or M-x describe-variable) on interpreter-mode-alist to learn more. How can I highlight a region of text in Emacs? Highlighting text Text, highlighting transient-mark-mode Region, highlighting a You can cause the region to be highlighted when the mark is active by including(transient-mark-mode t) in your .emacs file. How can I replace highlighted text with what I type? delete-selection-mode Replacing highlighted text Highlighting and replacing text Use delete-selection-mode, which you can start automatically by placing the following Lisp form in your .emacs file:(delete-selection-mode 1) According to the documentation string for delete-selection-mode (which you can read using M-x describe-function RET delete-selection-mode RET): When ON, typed text replaces the selection if the selection is active. When OFF, typed text is just inserted at point. This mode also allows you to delete (not kill) the highlighted region by pressing DEL. How do I control Emacs's case-sensitivity when searching/replacing? case-fold-search Case sensitivity of searches Searching without case sensitivity Ignoring case in searches For searching, the value of the variable case-fold-search determines whether they are case sensitive:(setq case-fold-search nil) ; make searches case sensitive(setq case-fold-search t) ; make searches case insensitive Case sensitivity in replacements Replacing, and case sensitivity case-replace Similarly, for replacing, the variable case-replace determines whether replacements preserve case. You can also toggle case sensitivity at will in isearch with M-c. To change the case sensitivity just for one major mode, use the major mode's hook. For example:(add-hook ' foo-mode-hook (lambda () (setq case-fold-search nil))) How do I search for, delete, or replace unprintable (eight-bit or control) characters? Unprintable characters, working with Working with unprintable characters Control characters, working with Eight-bit characters, working with Searching for unprintable characters Regexps and unprintable characters To search for a single character that appears in the buffer as, for example, ‘\237’, you can type C-s C-q 2 3 7. (This assumes the value of search-quote-char is 17 (i.e., C-q).) Searching for all unprintable characters is best done with a regular expression (regexp) search. The easiest regexp to use for the unprintable chars is the complement of the regexp for the printable chars. Regexp for the printable chars: ‘[\t\n\r\f -~] Regexp for the unprintable chars: ‘[^\t\n\r\f -~] To type these special characters in an interactive argument to isearch-forward-regexp or re-search-forward, you need to use C-q. (‘\t’, ‘\n’, ‘\r’, and ‘\f’ stand respectively for TAB, LFD, RET, and C-l.) So, to search for unprintable characters using re-search-forward: M-x re-search-forward RET [^ TAB C-q LFD C-q RET C-q C-l SPC -~] RET Using isearch-forward-regexp: C-M-s [^ TAB LFD C-q RET C-q C-l SPC -~] To delete all unprintable characters, simply use replace-regexp: M-x replace-regexp RET [^ TAB C-q LFD C-q RET C-q C-l SPC -~] RET RET Replacing is similar to the above. To replace all unprintable characters with a colon, use: M-x replace-regexp RET [^ TAB C-q LFD C-q RET C-q C-l SPC -~] RET : RET How do I input a newline character in isearch or query-replace? Searching for newlines Replacing newlines Use C-q C-j. For more information, see *note Special Input for Incremental Search: (emacs)Special Isearch. How do I copy text from the kill ring into the search string? Yanking text into the search string isearch yanking Use M-y. *note Isearch Yanking: (emacs)Isearch Yank. How do I make Emacs wrap words for me? Wrapping word automatically Wrapping lines Line wrap auto-fill-mode, introduction to Maximum line width, default value fill-column, default value Use auto-fill-mode, activated by typing M-x auto-fill-mode. The default maximum line width is 70, determined by the variable fill-column. To learn how to turn this on automatically, see . How do I turn on auto-fill-mode by default? auto-fill-mode, activating automatically Filling automatically Automatic entry to auto-fill-mode To turn on auto-fill-mode just once for one buffer, use M-x auto-fill-mode. To turn it on for every buffer in a certain mode, you must use the hook for that mode. For example, to turn on auto-fill mode for all text buffers, including the following in your .emacs file:(add-hook 'text-mode-hook 'turn-on-auto-fill) If you want auto-fill mode on in all major modes, do this:(setq-default auto-fill-function 'do-auto-fill) Where can I get a better spelling checker for Emacs? Checking spelling Spelling, checking text documents Use Ispell. See . How can I spell-check &tex; or *roff documents? Spelling, checking &tex; documents &tex; documents, checking spelling in Use Ispell. Ispell can handle &tex; and *roff documents. See . How do I change load-path? load-path, modifying Modifying load-path Adding to load-path In general, you should only add to the load-path. You can add directory /dir/subdir to the load path like this:(setq load-path (cons "/dir/subdir/" load-path)) To do this relative to your home directory:(setq load-path (cons "~/mysubdir/" load-path)) How do I use an already running Emacs from another window? emacsclient Emacs server functions Using an existing Emacs process emacsclient, which comes with Emacs, is for editing a file using an already running Emacs rather than starting up a new Emacs. It does this by sending a request to the already running Emacs, which must be expecting the request. Setup:Emacs must have executed the server-start function for‘emacsclient’ to work. This can be done either by a command lineoption: emacs -f server-start or by invoking server-start from .emacs:(if (some conditions are met) (server-start))When this is done, Emacs creates a Unix domain socket namedserver in /tmp/emacsuserid. Seeserver-socket-dir.To get your news reader, mail reader, etc., to invoke‘emacsclient’, try setting the environment variable EDITOR(or sometimes VISUAL) to the value ‘emacsclient’. You mayhave to specify the full pathname of the ‘emacsclient’ programinstead. Examples: # csh commands: setenv EDITOR emacsclient # using full pathname setenv EDITOR /usr/local/emacs/etc/emacsclient # sh command: EDITOR=emacsclient ; export EDITOR Normal use:When ‘emacsclient’ is run, it connects to the socket and passes itscommand line options to Emacs, which at the next opportunity will visitthe files specified. (Line numbers can be specified just like withEmacs.) The user will have to switch to the Emacs window by hand. Whenthe user is done editing a file, the user can type C-x # (orM-x server-edit) to indicate this. If there is another bufferrequested by emacsclient, Emacs will switch to it; otherwiseemacsclient will exit, signaling the calling program to continue. gnuservThere is an enhanced version of ‘emacsclient’ called‘gnuserv’, written by Andy Norman(see ). ‘gnuserv’ usesInternet domain sockets, so it can work across most network connections.The most recent ‘gnuserv’ package is available athttp://meltin.net/hacks/emacs/ How do I make Emacs recognize my compiler's funny error messages? Compiler error messages, recognizing Recognizing non-standard compiler errors Regexps for recognizing compiler errors Errors, recognizing compiler Customize the compilation-error-regexp-alist variable. How do I change the indentation for switch? switch, indenting Indenting of switch Many people want to indent their switch statements like this: f() { switch(x) { case A: x1; break; case B: x2; break; default: x3; } } The solution at first appears to be: set c-indent-level to 4 and c-label-offset to -2. However, this will give you an indentation spacing of four instead of two. The real solution is to use cc-mode (the default mode for C programming in Emacs 20 and later) and add the following line to your .emacs:(c-set-offset 'case-label '+) There appears to be no way to do this with the old c-mode. How to customize indentation in C, C++, and Java buffers? Indentation, how to customize Customize indentation The Emacs cc-mode features an interactive procedure for customizing the indentation style, which is fully explained in the CC Mode manual that is part of the Emacs distribution, see See section ``Customization Indentation'' in The CC Mode Manual. Here's a short summary of the procedure: Go to the beginning of the first line where you don't like theindentation and type C-c C-o. Emacs will prompt you for thesyntactic symbol; type RET to accept the default it suggests. Emacs now prompts for the offset of this syntactic symbol, showing thedefault (the current definition) inside parentheses. You can chooseone of these: 0 No extra indentation. + Indent one basic offset. - Outdent one basic offset. ++ Indent two basic offsets -- Outdent two basic offsets. * Indent half basic offset. / Outdent half basic offset. After choosing one of these symbols, type C-c C-q to reindentthe line or the block according to what you just specified. If you don't like the result, go back to step 1. Otherwise, add thefollowing line to your .emacs:(c-set-offset 'syntactic-symbol offset)where syntactic-symbol is the name Emacs shows in the minibufferwhen you type C-c C-o at the beginning of the line, andoffset is one of the indentation symbols listed above (+,/, 0, etc.) that you've chosen during the interactiveprocedure. Go to the next line whose indentation is not to your liking and repeatthe process there. It is recommended to put all the resulting (c-set-offset ...) customizations inside a C mode hook, like this:(defun my-c-mode-hook () (c-set-offset ...) (c-set-offset ...))(add-hook 'c-mode-hook 'my-c-mode-hook) Using c-mode-hook avoids the need to put a (require 'cc-mode) into your .emacs file, because c-set-offset might be unavailable when cc-mode is not loaded. Note that c-mode-hook runs for C source files only; use c++-mode-hook for C++ sources, java-mode-hook for Java sources, etc. If you want the same customizations to be in effect in all languages supported by cc-mode, use c-mode-common-hook. How can I make Emacs automatically scroll horizontally? hscroll-mode Horizontal scrolling Scrolling horizontally In Emacs 21 and later, this is on by default: if the variable truncate-lines is non-nil in the current buffer, Emacs automatically scrolls the display horizontally when point moves off the left or right edge of the window. Note that this is overridden by the variable truncate-partial-width-windows if that variable is non-nil and the current buffer is not full-frame width. In Emacs 20, use the hscroll-mode. Here is some information from the documentation, available by typing C-h f hscroll-mode RET: Automatically scroll horizontally when the point moves off the left or right edge of the window. Type M-x hscroll-mode to enable it in the current buffer. Type M-x hscroll-global-mode to enable it in every buffer. turn-on-hscroll is useful in mode hooks as in:(add-hook 'text-mode-hook 'turn-on-hscroll) hscroll-margin controls how close the cursor can get to theedge of the window. hscroll-step-percent controls how far to jump once we decide to do so. How do I make Emacs “typeover” or “overwrite” instead of inserting? Insert overwrite-mode Overwriting existing text Toggling overwrite-mode M-x overwrite-mode (a minor mode). This toggles overwrite-mode on and off, so exiting from overwrite-mode is as easy as another M-x overwrite-mode. On some systems, Insert toggles overwrite-mode on and off. How do I stop Emacs from beeping on a terminal? Beeping, turning off Visible bell Bell, visible Martin R. Frank writes: Tell Emacs to use the visible bell instead of the audible bell, and set the visible bell to nothing. That is, put the following in your TERMCAP environment variable (assuming you have one): ... :vb=: ... And evaluate the following Lisp form: (setq visible-bell t) How do I turn down the bell volume in Emacs running under X? Bell, volume of Volume of bell On X Window system, you can adjust the bell volume and duration for all programs with the shell command xset. Invoking xset without any arguments produces some basic information, including the following: usage: 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 How do I tell Emacs to automatically indent a new line to the indentation of the previous line? Indenting new lines New lines, indenting of Previous line, indenting according to Text indentation Such behavior is automatic in Emacs 20 and later. From the etc/NEWS file for Emacs 20.2: ** In Text mode, now only blank lines separate paragraphs. This makes it possible to get the full benefit of Adaptive Fill mode in Text mode, and other modes derived from it (such as Mail mode). TAB in Text mode now runs the command indent-relative; this makes a practical difference 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, use the new mode, Paragraph Indent Text mode. Prefixing lines Fill prefix If you have auto-fill-mode turned on (see ), you can tell Emacs to prefix every line with a certain character sequence, the fill prefix. Type the prefix at the beginning of a line, position point after it, and then type C-x . (set-fill-prefix) to set the fill prefix. Thereafter, auto-filling will automatically put the fill prefix at the beginning of new lines, and M-q (fill-paragraph) will maintain any fill prefix when refilling the paragraph. If you have paragraphs with different levels of indentation, you will have to set the fill prefix to the correct value each time you move to a new paragraph. There are many packages available to deal with this (see ). Look for “fill” and “indent” keywords for guidance. How do I show which parenthesis matches the one I'm looking at? Parentheses, matching paren.el Highlighting matching parentheses Pairs of parentheses, highlighting Matching parentheses Call show-paren-mode in your .emacs file:(show-paren-mode 1) You can also enable this mode by selecting the ‘Paren Match Highlighting’ option from the ‘Options’ menu of the Emacs menu bar at the top of any Emacs frame. Alternatives to this mode include: If 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. C-M-f (forward-sexp) and C-M-b (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.) Show matching paren as in vi Here is some Emacs Lisp that will make the % key show the matchingparenthesis, like in vi. In addition, if the cursor isn't over aparenthesis, it simply inserts a % like normal.;; 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))))) In C mode, can I show just the lines that will be left after #ifdef commands are handled by the compiler? #ifdef, selective display of hide-ifdef-mode Hiding #ifdef text Selectively displaying #ifdef code M-x hide-ifdef-mode. (This is a minor mode.) You might also want to investigate cpp.el, which is distributed with Emacs. How do I repeat a command as many times as possible? Repeating commands many times Commands, repeating many times ., equivalent to vi command As of Emacs 20.3, there is indeed a repeat command (C-x z) that repeats the last command. If you preface it with a prefix argument, the prefix arg is applied to the command. You can also type C-x ESC ESC (repeat-complex-command) to reinvoke commands that used the minibuffer to get arguments. In repeat-complex-command you can type M-p and M-n (and also up-arrow and down-arrow, if your keyboard has these keys) to scan through all the different complex commands you've typed. To repeat a set of commands, use keyboard macros. Use C-x ( and C-x ) to make a keyboard macro that invokes the command and then type C-x e. (*note Keyboard Macros: (emacs)Keyboard Macros.) If you're really desperate for the . command in vi that redoes the last insertion/deletion, use VIPER, a vi emulation mode which comes with Emacs, and which appears to support it. (See .) What are the valid X resource settings (i.e., stuff in .Xdefaults)? Resources, X X resources Setting X resources *note X Resources: (emacs)X Resources. You can also use a resource editor, such as editres (for X11R5 and onwards), to look at the resource names for the menu bar, assuming Emacs was compiled with the X toolkit. How do I execute (“evaluate”) a piece of Emacs Lisp code? Evaluating Lisp code Lisp forms, evaluating There are a number of ways to execute (evaluate, in Lisp lingo) an Emacs Lisp form: If you want it evaluated every time you run Emacs, put it in a filenamed .emacs in your home directory. This is known as “your.emacs file,” and contains all of your personal customizations. You can type the form in the *scratch* buffer, and then typeLFD (or C-j) after it. The result of evaluating the formwill be inserted in the buffer. In emacs-lisp-mode, typing C-M-x evaluates a top-level formbefore or around point. Typing C-x C-e in any buffer evaluates the Lisp form immediatelybefore point and prints its value in the echo area. Typing M-: or M-x eval-expression allows you to type a Lispform in the minibuffer which will be evaluated once you press RET. You can use M-x load-file to have Emacs evaluate all the Lispforms in a file. (To do this from Lisp use the function loadinstead.)The functions load-library, eval-region,eval-buffer, require, and autoload are alsouseful; see , if you want to learn moreabout them. How do I change Emacs's idea of the TAB character's length? Tab length Length of tab character default-tab-width Set the variable default-tab-width. For example, to set TAB stops every 10 characters, insert the following in your .emacs file:(setq default-tab-width 10) Do not confuse variable tab-width with variable tab-stop-list. The former is used for the display of literal TAB characters. The latter controls what characters are inserted when you press the TAB character in certain modes. How do I insert <some text> at the beginning of every line? Prefixing a region with some text Prefix character, inserting in mail/news replies Replies to mail/news, inserting a prefix character mail-yank-prefix Mail replies, inserting a prefix character News replies, inserting a prefix character To do this to an entire buffer, type M-< M-x replace-regexp RET ^ RET your text RET. To do this to a region, use string-insert-rectangle. Set the mark (C-SPC) at the beginning of the first line you want to prefix, move the cursor to last line to be prefixed, and type M-x string-insert-rectangle RET. To do this for the whole buffer, type C-x h M-x string-insert-rectangle RET. If you are trying to prefix a yanked mail message with ‘>’, you might want to set the variable mail-yank-prefix. In Message buffers, you can even use M-; to cite yanked messages (M-; runs the function comment-region, it is a general-purpose mechanism to comment regions) (see ). How do I insert ‘_^H’ before each character in a region to get an underlined paragraph? Underlining a region of text underline-region Mark the region and then type M-x underline-region RET. 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? picture-mode Remaining in the same column, regardless of contents Vertical movement in empty documents Use M-x picture-mode. See also the variable track-eol and the command set-goal-column bound to C-x C-n (see See section ``Moving Point'' in The GNU Emacs Manual). How do I tell Emacs to iconify itself? Iconification under the X Window System X Window System and iconification Suspending Emacs C-z iconifies Emacs when running under X and suspends Emacs otherwise. *note Frame Commands: (emacs)Frame Commands. How do I use regexps (regular expressions) in Emacs? Regexps Regular expressions Differences between Unix and Emacs regexps Unix regexps, differences from Emacs Text strings, putting regexps in *note Regexp Backslash: (emacs)Regexp Backslash. The or operator is ‘\|’, not ‘|’, and the grouping operators are ‘\(’ and ‘\)’. Also, the string syntax for a backslash is ‘\\’. To specify a regular expression like ‘xxx\(foo\|bar\)’ in a Lisp string, use ‘xxx\\(foo\\|bar\\)’. Note the doubled backslashes! Unlike in Unix grep, sed, etc., a complement character set(‘[^...]’) can match a newline character (LFD a.k.a.C-j a.k.a. ‘\n’), unless newline is mentioned as one of thecharacters not to match. The character syntax regexps (e.g., ‘\sw’) are notmeaningful inside character set regexps (e.g., ‘[aeiou]’). (Thisis actually typical for regexp syntax.) How do I perform a replace operation across more than one file? Replacing strings across files Multiple files, replacing across Files, replacing strings across multiple Recursive search/replace operations As of Emacs 19.29, Dired mode (M-x dired RET, or C-x d) supports the command dired-do-query-replace (Q), which allows users to replace regular expressions in multiple files. You can use this command to perform search/replace operations on multiple files by following the following steps: Assemble a list of files you want to operate on with eitherfind-dired, find-name-dired or find-grep-dired. Mark all files in the resulting Dired buffer using t. Use Q to start a query-replace-regexp session on the markedfiles. To accept all replacements in each file, hit !. Another way to do the same thing is to use the “tags” feature of Emacs: it includes the command tags-query-replace which performs a query-replace across all the files mentioned in the TAGS file. *note Tags Search: (emacs)Tags Search. Where is the documentation for etags? Documentation for etags etags, documentation for The etags man page should be in the same place as the emacs man page. Quick command-line switch descriptions are also available. For example, ‘etags -H’. How do I disable backup files? Backups, disabling Disabling backups You probably don't want to do this, since backups are useful, especially when something goes wrong. To avoid seeing backup files (and other “uninteresting” files) in Dired, load dired-x by adding the following to your .emacs file:(add-hook 'dired-load-hook (lambda () (load "dired-x"))) With dired-x loaded, M-o toggles omitting in each dired buffer. You can make omitting the default for new dired buffers by putting the following in your .emacs:(add-hook 'dired-mode-hook 'dired-omit-toggle) If you're tired of seeing backup files whenever you do an ‘ls’ at the Unix shell, try GNU ls with the ‘-B’ option. GNU ls is part of the GNU Fileutils package, available from ‘ftp.gnu.org’ and its mirrors (see ). To disable or change the way backups are made, *note (emacs)Backup Names::. Backup files in a single directory Beginning with Emacs 21.1, you can control where Emacs puts backup files by customizing the variable backup-directory-alist. This variable's value specifies that files whose names match specific patters should have their backups put in certain directories. A typical use is to add the element ("." . dir) to force Emacs to put all backup files in the directory dir. How do I disable auto-save-mode? Disabling auto-save-mode Auto-saving Saving at frequent intervals You probably don't want to do this, since auto-saving is useful, especially when Emacs or your computer crashes while you are editing a document. Instead, you might want to change the variable auto-save-interval, which specifies how many keystrokes Emacs waits before auto-saving. Increasing this value forces Emacs to wait longer between auto-saves, which might annoy you less. You might also want to look into Sebastian Kremer's auto-save package (see ). This package also allows you to place all auto-save files in one directory, such as /tmp. To disable or change how auto-save-mode works, *note (emacs)Auto Save::. How can I go to a certain line given its number? Going to a line by number Compilation error messages Recompilation Are you sure you indeed need to go to a line by its number? Perhaps all you want is to display a line in your source file for which a compiler printed an error message? If so, compiling from within Emacs using the M-x compile and M-x recompile commands is a much more effective way of doing that. Emacs automatically intercepts the compile error messages, inserts them into a special buffer called *compilation*, and lets you visit the locus of each message in the source. Type C-x ` to step through the offending lines one by one (starting with Emacs 22, you can also use M-g M-p and M-g M-n to go to the previous and next matches directly). Click Mouse-2 or press RET on a message text in the *compilation* buffer to go to the line whose number is mentioned in that message. But if you indeed need to go to a certain text line, type M-g M-g (which is the default binding of the goto-line function starting with Emacs 22). Emacs will prompt you for the number of the line and go to that line. You can do this faster by invoking goto-line with a numeric argument that is the line's number. For example, C-u 286 M-g M-g will jump to line number 286 in the current buffer. How can I create or modify new pull-down menu options? Pull-down menus, creating or modifying Menus, creating or modifying Creating new menu options Modifying pull-down menus Menus and keymaps Keymaps and menus Each menu title (e.g., ‘File’, ‘Edit’, ‘Buffers’) represents a local or global keymap. Selecting a menu title with the mouse displays that keymap's non-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 a new definition to the appropriate keymap. Adding a ‘Forward Word’ item to the ‘Edit’ menu thus requires the following Lisp code:(define-key global-map [menu-bar edit forward] '("Forward word" . forward-word)) The first line adds the entry to the global keymap, which includes global menu bar entries. Replacing the reference to global-map with a local keymap would add this menu option only within a particular mode. The second line describes the path from the menu-bar to the new entry. Placing this menu entry underneath the ‘File’ menu would mean changing the word edit in the second line to file. The third line is a cons cell whose first element is the title that will be displayed, and whose second element is the function that will be called when that menu option is invoked. To add a new menu, rather than a new option to an existing menu, we must define an entirely new keymap:(define-key global-map [menu-bar words] (cons "Words" (make-sparse-keymap "Words"))) The above code creates a new sparse keymap, gives it the name ‘Words’, and attaches it to the global menu bar. Adding the ‘Forward Word’ item to this new menu would thus require the following code:(define-key global-map [menu-bar words forward] '("Forward word" . forward-word)) Note that because of the way keymaps work, menu options are displayed with the more recently defined items at the top. Thus if you were to define menu options ‘foo’, ‘bar’, and ‘baz’ (in that order), the menu option ‘baz’ would appear at the top, and ‘foo’ would be at the bottom. One way to avoid this problem is to use the function define-key-after, which works the same as define-key, but lets you modify where items appear. The following Lisp code would insert the ‘Forward Word’ item in the ‘Edit’ menu immediately following the ‘Undo’ item:(define-key-after (lookup-key global-map [menu-bar edit]) [forward] '("Forward word" . forward-word) 'undo) Note how the second and third arguments to define-key-after are different from those of define-key, and that we have added a new (final) argument, the function after which our new key should be defined. To move a menu option from one position to another, simply evaluate define-key-after with the appropriate final argument. More detailed information—and more examples of how to create and modify menu options—are in the Emacs Lisp Reference Manual, under “Menu Keymaps.” (See , for information on this manual.) How do I delete menus and menu options? Deleting menus and menu options Menus, deleting The simplest way to remove a menu is to set its keymap to ‘nil’. For example, to delete the ‘Words’ menu (see ), use:(define-key global-map [menu-bar words] nil) Similarly, removing a menu option requires redefining a keymap entry to nil. For example, to delete the ‘Forward word’ menu option from the ‘Edit’ menu (we added it in ), use:(define-key global-map [menu-bar edit forward] nil) How do I turn on syntax highlighting? Syntax highlighting font-lock-mode Highlighting based on syntax Colorizing text FAQ, font-lock-mode font-lock-mode is the standard way to have Emacs perform syntax highlighting in the current buffer. It is enabled by default in Emacs 22.1 and later. With font-lock-mode turned on, different types of text will appear in different colors. For instance, in a programming mode, variables will appear in one face, keywords in a second, and comments in a third. hilit19 is deprecated Earlier versions of Emacs supported hilit19, a similar package. Use of hilit19 is now considered non-standard, although hilit19.el comes with the stock Emacs distribution. It is no longer maintained. To turn font-lock-mode off within an existing buffer, use M-x font-lock-mode RET. In Emacs 21 and earlier versions, you could use the following code in your .emacs file to turn on font-lock-mode globally:(global-font-lock-mode 1) Highlighting a buffer with font-lock-mode can take quite a while, and cause an annoying delay in display, so several features exist to work around this. Just-In-Time syntax highlighting In Emacs 21 and later, turning on font-lock-mode automatically activates the new Just-In-Time fontification provided by jit-lock-mode. jit-lock-mode defers the fontification of portions of buffer until you actually need to see them, and can also fontify while Emacs is idle. This makes display of the visible portion of a buffer almost instantaneous. For details about customizing jit-lock-mode, type C-h f jit-lock-mode RET. Levels of syntax highlighting Decoration level, in font-lock-mode In versions of Emacs before 21, different levels of decoration are available, from slight to gaudy. More decoration means you need to wait more time for a buffer to be fontified (or a faster machine). To control how decorated your buffers should become, set the value of font-lock-maximum-decoration in your .emacs file, with a nil value indicating default (usually minimum) decoration, and a t value indicating the maximum decoration. For the gaudiest possible look, then, include the line(setq font-lock-maximum-decoration t) in your .emacs file. You can also set this variable such that different modes are highlighted in a different ways; for more information, see the documentation for font-lock-maximum-decoration with C-h v (or M-x describe-variable RET). Also see the documentation for the function font-lock-mode, available by typing C-h f font-lock-mode (M-x describe-function RET font-lock-mode RET). To print buffers with the faces (i.e., colors and fonts) intact, use M-x ps-print-buffer-with-faces or M-x ps-print-region-with-faces. You will need a way to send text to a PostScript printer, or a PostScript interpreter such as Ghostscript; consult the documentation of the variables ps-printer-name, ps-lpr-command, and ps-lpr-switches for more details. How can I force Emacs to scroll only one line when I move past the bottom of the screen? Scrolling only one line Reducing the increment when scrolling Customize the scroll-conservatively variable with M-x customize-variable RET scroll-conservatively RET and set it to a large value like, say, 10000. For an explanation of what this means, *note Auto Scrolling: (emacs)Auto Scrolling. Alternatively, use the following Lisp form in your .emacs:(setq scroll-conservatively most-positive-fixnum) How can I edit MS-DOS files using Emacs? Editing MS-DOS files MS-DOS files, editing Microsoft files, editing Windows files, editing As of Emacs 20, detection and handling of MS-DOS (and Windows) files is performed 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 it is a DOS file. On Unix and GNU/Linux systems, and also on a Macintosh, the string ‘(DOS)’ will appear near the left edge of the mode line; on DOS and Windows, where the DOS end-of-line (EOL) format is the default, a backslash (‘\’) will appear in the mode line. If you are running a version of Emacs before 20.1, get crypt++ (see ). Among other things, crypt++ transparently modifies MS-DOS files as they are loaded and saved, allowing you to ignore the different conventions that Unix and MS-DOS have for delineating the end of a line. How can I tell Emacs to fill paragraphs with a single space after each period? One space following periods Single space following periods Periods, one space following Add the following line to your .emacs file:(setq sentence-end-double-space nil) Why these strange escape sequences from ls from the Shell mode? Escape sequences in ls output ls in Shell mode This happens because ls is aliased to ‘ls --color’ in your shell init file. You have two alternatives to solve this: Make the alias conditioned on the EMACS variable in theenvironment. When Emacs runs a subsidiary shell, it exports theEMACS variable to that shell, with value equal to the absolutefile name of Emacs. You canunalias ls when that happens, thus limiting the alias to yourinteractive sessions. Install the ansi-color package (bundled with Emacs 21.1 andlater), which converts these ANSI escape sequences into colors. How can I start Emacs in fullscreen mode on MS-Windows? Maximize frame Fullscreen mode Use the function w32-send-sys-command. For example, you can put the following in your .emacs file:(add-hook 'term-setup-hook #'(lambda () (w32-send-sys-command ?\xF030))) To avoid the slightly distracting visual effect of Emacs starting with its default frame size and then growing to fullscreen, you can add an ‘Emacs.Geometry’ entry to the Windows registry settings (see see ). To compute the correct values for width and height, first maximize the Emacs frame and then evaluate (frame-height) and (frame-width) with M-:. Bugs and problems Bugs and problems The Emacs manual lists some common kinds of trouble users could get into, see See section ``Dealing with Emacs Trouble'' in The GNU Emacs Manual, so you might look there if the problem you encounter isn't described in this chapter. If you decide you've discovered a bug, see See section ``Reporting Bugs'' in The GNU Emacs Manual, for instructions how to do that. The file etc/PROBLEMS in the Emacs distribution lists various known problems with building and using Emacs on specific platforms; type C-h C-e to read it. Does Emacs have problems with files larger than 8 megabytes? Very large files, opening Large files, opening Opening very large files Maximum file size Files, maximum size Old versions (i.e., anything before 19.29) of Emacs had problems editing files larger than 8 megabytes. In versions 19.29 and later, the maximum buffer size is at least 2^27-1, or 134,217,727 bytes, or 132 MBytes. And in Emacs 22, the maximum buffer size has been increased to 268,435,455 bytes (or 256 MBytes) on 32-bit machines. How do I get rid of ‘^M’ or echoed commands in my shell buffer? Shell buffer, echoed commands and ‘^M’ in Echoed commands in shell-mode Try typing M-x shell-strip-ctrl-m RET while in shell-mode to make them go away. If that doesn't work, you have several options: For tcsh, put this in your .cshrc (or .tcshrc) file: if ($?EMACS) then if ("$EMACS" =~ /*) then if ($?tcsh) unset edit stty nl endif endif Or put this in your .emacs_tcsh or ~/.emacs.d/init_tcsh.sh file: unset edit stty nl Alternatively, use csh in your shell buffers instead of tcsh. One way is:(setq explicit-shell-file-name "/bin/csh") and another is to do this in your .cshrc (or .tcshrc) file: setenv ESHELL /bin/csh (You must start Emacs over again with the environment variable properly set for this to take effect.) You can also set the ESHELL environment variable in Emacs Lisp with the following Lisp form,(setenv "ESHELL" "/bin/csh") The above solutions try to prevent the shell from producing the ‘^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 these characters from the buffer by adding this to your .emacs init file:(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m) On a related note: if your shell is echoing your input line in the shell buffer, you might want to customize the comint-process-echoes variable in your shell buffers, or try the following command in your shell start-up file: stty -icrnl -onlcr -echo susp ^Z Why do I get “Process shell exited abnormally with code 1”? Abnormal exits from shell-mode shell-mode exits Process shell exited The most likely reason for this message is that the ‘env’ program is not properly installed. Compile this program for your architecture, and install it with ‘a+x’ permission in the architecture-dependent Emacs program directory. (You can find what this directory is at your site by inspecting the value of the variable exec-directory by typing C-h v exec-directory RET.) You should also check for other programs named ‘env’ in your path (e.g., SunOS has a program named /usr/bin/env). We don't understand why this can cause a failure and don't know a general solution for working around the problem in this case. The ‘make clean’ command will remove ‘env’ and other vital programs, so be careful when using it. It has been reported that this sometimes happened when Emacs was started as an X client from an xterm window (i.e., had a controlling tty) but the xterm was later terminated. See also ‘PROBLEMS’ (in the etc subdirectory of the top-level directory when you unpack the Emacs source) for other possible causes of this message. Why do I get an error message when I try to run M-x shell? Shell Mode, and MS-Windows explicit-shell-file-name On MS-Windows, this might happen because Emacs tries to look for the shell in a wrong place. The default file name /bin/sh is usually incorrect for non-Unix systems. If you know where your shell executable is, set the variable explicit-shell-file-name in your .emacs file to point to its full file name, like this:(setq explicit-shell-file-name "d:/shells/bash.exe") If you don't know what shell does Emacs use, try the M-! command; if that works, put the following line into your .emacs:(setq explicit-shell-file-name shell-file-name) Antivirus programs, and Shell Mode Some people have trouble with Shell Mode because of intrusive antivirus software; disabling the resident antivirus program solves the problems in those cases. Where is the termcap/terminfo entry for terminal type ‘emacs’? Termcap Terminfo Emacs entries for termcap/terminfo The termcap entry for terminal type ‘emacs’ is ordinarily put in the ‘TERMCAP’ environment variable of subshells. It may help in certain situations (e.g., using rlogin from shell buffer) to add an entry for ‘emacs’ to the system-wide termcap file. Here is a correct termcap entry for ‘emacs’: emacs:tc=unknown: To make a terminfo entry for ‘emacs’, use tic or captoinfo. You need to generate /usr/lib/terminfo/e/emacs. It may work to simply copy /usr/lib/terminfo/d/dumb to /usr/lib/terminfo/e/emacs. Having a termcap/terminfo entry will not enable the use of full screen programs in shell buffers. Use M-x terminal-emulator for that instead. A workaround to the problem of missing termcap/terminfo entries is to change terminal type ‘emacs’ to type ‘dumb’ or ‘unknown’ in your shell start up file. csh users could put this in their .cshrc files: if ("$term" == emacs) set term=dumb Why does Emacs spontaneously start displaying ‘I-search:’ and beeping? Spontaneous entry into isearch-mode isearch-mode, spontaneous entry into Beeping without obvious reason Your terminal (or something between your terminal and the computer) is sending C-s and C-q for flow control, and Emacs is receiving these characters and interpreting them as commands. (The C-s character normally invokes the isearch-forward command.) For possible solutions, see . Why can't Emacs talk to certain hosts (or certain hostnames)? Hosts, Emacs cannot talk to gethostbyname, problematic version The problem may be that Emacs is linked with a wimpier version of gethostbyname than the rest of the programs on the machine. This is often manifested as a message on startup of “X server not responding. Check your ‘DISPLAY’ environment variable.” or a message of “Unknown host” from open-network-stream. On a Sun, this may be because Emacs had to be linked with the static C library. The version of gethostbyname in the static C library may only look in /etc/hosts and the NIS (YP) maps, while the version in the dynamic C library may be smart enough to check DNS in addition to or instead of NIS. On a Motorola Delta running System V R3.6, the version of 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: Explicitly add the host you want to communicate with to /etc/hosts. Relink Emacs with this line in src/config.h: #define LIBS_SYSTEM -lresolv Replace gethostbyname and friends in libc.a with moreuseful versions such as the ones in libresolv.a. Then relinkEmacs. If you are actually running NIS, make sure that ypbind isproperly told to do DNS lookups with the correct command line switch. Why does Emacs say ‘Error in init file’? Error in .emacs Error in init file Init file, errors in .emacs file, errors in Debugging .emacs file An error occurred while loading either your .emacs file or the system-wide file lisp/default.el. Emacs 21.1 and later pops the *Messages* buffer, and puts there some additional information about the error, to provide some hints for debugging. For information on how to debug your .emacs file, see . It may be the case that you need to load some package first, or use a hook that will be evaluated after the package is loaded. A common case of this is explained in . Why does Emacs ignore my X resources (my .Xdefaults file)? X resources being ignored Ignored X resources .Xdefaults As of version 19, Emacs searches for X resources in the files specified by the following environment variables: XFILESEARCHPATH XUSERFILESEARCHPATH XAPPLRESDIR This emulates the functionality provided by programs written using the Xt toolkit. XFILESEARCHPATH and XUSERFILESEARCHPATH should be a list of file names separated by colons. XAPPLRESDIR should be a list of directory names separated by colons. Emacs searches for X resources: specified on the command line, with the ‘-xrm RESOURCESTRING’ option, then in the value of the ‘XENVIRONMENT’ environment variable, or if that is unset, in the file named~/.Xdefaults-hostname if it exists (where hostname isthe name of the machine Emacs is running on), then in the screen-specific and server-wide resource properties providedby the server, or if those properties are unset, in the file named ~/.Xdefaultsif it exists, then in the files listed in ‘XUSERFILESEARCHPATH’, or in files named lang/Emacs in directories listed in‘XAPPLRESDIR’ (where lang is the value of the LANGenvironment variable), if the ‘LANG’ environment variable is set, or in files named Emacs in the directories listed in ‘XAPPLRESDIR or in ~/lang/Emacs (if the LANG environment variableis set), or in ~/Emacs, then in the files listed in XFILESEARCHPATH. Why don't my customizations of the frame parameters work? Frame parameters This probably happens because you have set the frame parameters in the variable initial-frame-alist. That variable holds parameters used only for the first frame created when Emacs starts. To customize the parameters of all frames, change the variable default-frame-alist instead. These two variables exist because many users customize the initial frame in a special way. For example, you could determine the position and size of the initial frame, but would like to control the geometry of the other frames by individually positioning each one of them. Why does Emacs take 20 seconds to visit a file? Visiting files takes a long time Delay when visiting files Files, take a long time to visit Old versions of Emacs (i.e., versions before Emacs 20.x) often encountered this when the master lock file, !!!SuperLock!!!, has been left in the lock directory somehow. Delete it. Mark Meuer says that NeXT NFS has a bug where an exclusive create succeeds but returns an error status. This can cause the same problem. Since Emacs's file locking doesn't work over NFS anyway, the best solution is to recompile Emacs with CLASH_DETECTION undefined. How do I edit a file with a ‘$’ in its name? Editing files with ‘$’ in the name $’ in file names File names containing ‘$’, editing When entering a file name in the minibuffer, Emacs will attempt to expand a ‘$’ followed by a word as an environment variable. To suppress this behavior, type $$ instead. Why does shell mode lose track of the shell's current directory? Current directory and shell-mode shell-mode and current directory Directory, current in shell-mode Emacs has no way of knowing when the shell actually changes its directory. This is an intrinsic limitation of Unix. So it tries to guess by recognizing ‘cd’ commands. If you type cd followed by a directory name with a variable reference (cd $HOME/bin) or with a shell metacharacter (cd ../lib*), Emacs will fail to correctly guess the shell's new current directory. A huge variety of fixes and enhancements to shell mode for this problem have been written to handle this problem (see ). You can tell Emacs the shell's current directory with the command M-x dirs. Are there any security risks in Emacs? Security with Emacs movemail’ and security file-local-variable and security Synthetic X events and security X events and security The movemail incident. (No, this is not a risk.)In his book The Cuckoo's Egg, Cliff Stoll describes this inchapter 4. The site at LBL had installed the /etc/movemailprogram setuid root. (As of version 19, movemail is in yourarchitecture-specific directory; type C-h v exec-directoryRET to see what it is.) Since movemail had not beendesigned for this situation, a security hole was created and users couldget root privileges.movemail has since been changed so that this security hole willnot exist, even if it is installed setuid root. However,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. The 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.As of Emacs 22, Emacs has a list of local variables that are known tobe safe to set. If a file tries to set any variable outside thislist, it asks the user to confirm whether the variables should be set.You can also tell Emacs whether to allow the evaluation of Emacs Lispcode found at the bottom of files by setting the variableenable-local-eval.For more information, *note File Variables: (emacs)File Variables. Synthetic X events. (Yes, a risk; use ‘MIT-MAGIC-COOKIE-1’ orbetter.)Emacs accepts synthetic X events generated by the SendEventrequest 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 ‘MIT-MAGIC-COOKIE-1’. If usingthe xauth program has any effect, then you are probably using‘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, butdoes not eliminate the risk.On most computers running Unix and X, you enable and disableaccess using the xhost command. To allow all hosts access toyour X server, use xhost + at the shell prompt, which (on an HP machine, at least) produces thefollowing message: access control disabled, clients can connect from any host To deny all hosts access to your X server (except those explicitlyallowed by name), use xhost - On the test HP computer, this command generated the following message: access control enabled, only authorized clients can connect Dired says, ‘no file on this line’ when I try to do something. Dired does not see a file Chances are you're using a localized version of Unix that doesn't use US date format in dired listings. You can check this by looking at dired listings or by typing ls -l to a shell and looking at the dates that come out. Dired uses a regular expression to find the beginning of a file name. In a long Unix-style directory listing (‘ls -l’), the file name starts after the date. The regexp has thus been written to look for the date, the format of which can vary on non-US systems. There are two approaches to solving this. The first one involves setting things up so that ‘ls -l’ outputs US date format. This can be done by setting the locale. See your OS manual for more information. The second approach involves changing the regular expression used by dired, directory-listing-before-filename-regexp. Compiling and installing Emacs Compiling and installing Emacs How do I install Emacs? Installing Emacs Unix systems, installing Emacs on Downloading and installing Emacs Retrieving and installing Emacs Building Emacs from source Source code, building Emacs from Unpacking and installing Emacs This answer is meant for users of Unix and Unix-like systems. Users of other operating systems should see the series of questions beginning with , which describe where to get non-Unix source and binaries, and how to install Emacs on those systems. For Unix and Unix-like systems, the easiest way is often to compile it from scratch. You will need: Emacs sources. See , for a list of ftp sitesthat make them available. On ftp.gnu.org, the main GNUdistribution site, sources are available asftp://ftp.gnu.org/pub/gnu/emacs/emacs-22.1.tar.gzThe above will obviously change as new versions of Emacs come out. Forinstance, when Emacs 22.42 is released, it will most probably beavailable asftp://ftp.gnu.org/pub/gnu/emacs/emacs-22.42.tar.gzAgain, you should use one of the GNU mirror sites (see , and adjust the URL accordingly) so as to reduce load onftp.gnu.org. gzip, the GNU compression utility. You can get gzip viaanonymous ftp at mirrors of 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 gunzip --verbose emacs-22.1.tar.gz changing the Emacs version (22.1), as necessary. Oncegunzip has finished doing its job, a file by the name ofemacs-22.1.tar should be in your build directory. tar, the tape archiving program, which moves multiple filesinto and out of archive files, or tarfiles. All of the filescomprising the Emacs source come in a single tarfile, and must beextracted using tar before you can build Emacs. Typically, theextraction command would look like tar -xvvf emacs-22.1.tar The ‘x’ indicates that we want to extract files from this tarfile,the two ‘v’s force verbose output, and the ‘f’ tellstar to use a disk file, rather than one on the tape drive.If you're using GNU tar (available at mirrors offtp.gnu.org), you can combine this step and the previous one byusing the command tar -zxvvf emacs-22.1.tar.gz The additional ‘z’ at the beginning of the options list tells GNUtar to uncompress the file with gunzip before extractingthe tarfile's components. At this point, the Emacs sources (all 70+ megabytes of them) should be sitting in a directory called emacs-22.1. On most common Unix and Unix-like systems, you should be able to compile Emacs (with X Window system support) with the following commands: cd emacs-22.1 # change directory to emacs-22.1 ./configure # configure Emacs for your particular system make # use Makefile to build components, then Emacs If the make completes successfully, the odds are fairly good that the build has gone well. (See , if you weren't successful.) By default, Emacs is installed in the following directories: /usr/local/bin binaries. /usr/local/share/emacs/22.1 Lisp code and support files. /usr/local/info Info documentation. To install files in those default directories, become the superuser and type make install Note that ‘make install’ will overwrite /usr/local/bin/emacs and any Emacs Info files that might be in /usr/local/info. Much more verbose instructions (with many more hints and suggestions) come with the Emacs sources, in the file INSTALL. How do I update Emacs to the latest version? Updating Emacs See , and follow the instructions there for installation. Most files are placed in version-specific directories. Emacs 22.1, for instance, places files in /usr/local/share/emacs/22.1. Upgrading should overwrite only, /usr/local/bin/emacs (the Emacs binary) and documentation in /usr/local/info. Back up these files before you upgrade, and you shouldn't have too much trouble. What should I do if I have trouble building Emacs? Problems building Emacs Errors when building Emacs First look in the file etc/PROBLEMS (where you unpack the Emacs source) to see if there is already a solution for your problem. Next, look for other questions in this FAQ that have to do with Emacs installation and compilation problems. If you'd like to have someone look at your problem and help solve it, see . If you cannot find a solution in the documentation, send a message to . Please don't post it to news:gnu.emacs.help or send e-mail to . For further guidelines, see and . Why does linking Emacs with -lX11 fail? Linking with -lX11 fails lX11, linking fails with Emacs needs to be linked with the static version of the X11 library, libX11.a. This may be missing. On OpenWindows, you may need to use add_services to add the “OpenWindows Programmers” optional software category from the CD-ROM. On HP-UX 8.0, you may need to run update again to load the X11-PRG “fileset.” This may be missing even if you specified “all filesets” the first time. If libcurses.a is missing, you may need to load the “Berkeley Development Option.” David Zuhn says that MIT X builds shared libraries by default, and only shared libraries, on those platforms that support them. These shared libraries can't be used when undumping temacs (the last stage of the Emacs build process). To get regular libraries in addition to shared libraries, add this to site.cf: #define ForceNormalLib YES Other systems may have similar problems. You can always define CANNOT_DUMP and link with the shared libraries instead. X Menus don't work To get the Xmenu stuff to work, you need to find a copy of MIT's liboldX.a. Finding Emacs and related packages Finding Emacs and related packages Where can I get Emacs on the net (or by snail mail)? Finding Emacs on the Internet Snail mail, ordering Emacs via Postal service, ordering Emacs via Distribution, retrieving Emacs Internet, retrieving from Look in the files etc/DISTRIB and etc/FTP for information on nearby archive sites. If you don't already have Emacs, see , for how to get these files. See , for information on how to obtain and build the latest version of Emacs, and see , for a list of archive sites that make GNU software available. How do I find a Emacs Lisp package that does XXX? Package, finding Finding an Emacs Lisp package Functionality, finding a particular package First of all, you should check to make sure that the package isn't already available. For example, typing M-x apropos RET wordstar RET lists all functions and variables containing the string ‘wordstar’. It is also possible that the package is on your system, but has not been loaded. To see which packages are available for loading, look through your computer's lisp directory (see ). The Lisp source to most packages contains a short description of how they should be loaded, invoked, and configured—so before you use or modify a Lisp package, see if the author has provided any hints in the source code. The command C-h p (finder-by-keyword) allows you to browse the constituent Emacs packages. For advice on how to find extra packages that are not part of Emacs, see . Where can I get Emacs Lisp packages that don't come with Emacs? Unbundled packages Finding other packages Lisp packages that do not come with Emacs Packages, those that do not come with Emacs Emacs Lisp List Emacs Lisp Archive The Emacs Lisp List (ELL), maintained by Stephen Eglen, aims to provide one compact list with links to all of the current Emacs Lisp files on the Internet. The ELL can be browsed over the web, or from Emacs with the ell package. Many authors post their packages to the Emacs sources newsgroup. You can search the archives of this group with Google, or Gmane, for example. Several packages are stored in the Lisp area of the Emacs Wiki. For a long time, the Emacs Lisp Archive provided a central repository for Emacs packages. Sadly, it has not been active for some time, although you can still access the old files at http://www.club.cc.cmu.edu/pub/gnu/elisp-archive/ Read the file etc/MORE.STUFF for more information about external packages. Where can I get other up-to-date GNU stuff? Current GNU distributions Sources for current GNU distributions Stuff, current GNU Up-to-date GNU stuff Finding current GNU software Official GNU software sites The most up-to-date official GNU software is normally kept at ftp://ftp.gnu.org/pub/gnu Read the files etc/DISTRIB and etc/FTP for more information. A list of sites mirroring ‘ftp.gnu.org’ can be found at http://www.gnu.org/order/ftp.html What is the difference between Emacs and XEmacs (formerly Lucid Emacs)? XEmacs Difference Emacs and XEmacs Lucid Emacs Epoch XEmacs is a branch version of Emacs. It was first called Lucid Emacs, and was initially derived from a prerelease version of Emacs 19. In this FAQ, we use the name “Emacs” only for the official version. Emacs and XEmacs each come with Lisp packages that are lacking in the other. The two versions have some significant differences at the Lisp programming level. Their current features are roughly comparable, though the support for some operating systems, character sets and specific packages might be quite different. Some XEmacs code has been contributed to Emacs, and we would like to use other parts, but the earlier XEmacs maintainers did not always keep track of the authors of contributed code, which makes it impossible for the FSF to get copyright papers signed for that code. (The FSF requires these papers for all the code included in the Emacs release, aside from generic C support packages that retain their separate identity and are not integrated into the code of Emacs proper.) 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 its origin in the work of the GNU Project. Terms such as “Emacsen” and “(X)Emacs” are not wrong, but they are not very clear, so it is better to write “Emacs and XEmacs.” Where can I get Emacs for my PC running MS-DOS? MS-DOS, Emacs for DOS, Emacs for Compiling Emacs for DOS Emacs for MS-DOS Tools needed to compile Emacs under DOS A pre-built binary distribution of Emacs is available from the SimTel.NET archives. This version apparently works under MS-DOS and Windows (3.X, 9X, ME, NT, and 2000) and supports long file names under Windows 9X, Windows ME, and Windows 2000. More information is available from ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/emacs.README The binary itself is available in the files em*.zip in the directory ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/ If you prefer to compile Emacs for yourself, you can do so with the current distribution directly. You will need a 386 (or better) processor, and to be running MS-DOS 3.0 or later. According to Eli Zaretskii and Darrel Hankerson, you will need the following: Compiler DJGPP 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 inftp://ftp.delorie.com/pub/djgpp/current/v2* Unpacking program The easiest way is to use djtar which comes with DJGPP v2.x,because it can open gzip'ed tarfiles (i.e., those ending with.tar.gz) in one step. Djtar comes indjdevnnn.zip archive (where nnn is the DJGPP versionnumber), from the URL mentioned above.Warning! Do 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! make, mv, sed, and rm All of these utilities are available atftp://ftp.delorie.com/pub/djgpp/current/v2gnu16-bit utilities can be found in GNUish, athttp://www.simtel.net/pub/gnuish/(mv and rm are in the Fileutils package, sed andmake are each one in a separate package named after them.) The files INSTALL (near its end) and etc/PROBLEMS in the directory of the Emacs sources contains some additional information regarding Emacs under MS-DOS. For a list of other MS-DOS implementations of Emacs (and Emacs look-alikes), consult the list of “Emacs implementations and literature,” available at ftp://rtfm.mit.edu/pub/usenet/comp.emacs/ Note that while many of these programs look similar to Emacs, they often lack certain features, such as the Emacs Lisp extension language. Where can I get Emacs for Microsoft Windows? FAQ for NT Emacs Emacs for MS-Windows Microsoft Windows, Emacs for Windows 9X, ME, NT, 2K, and CE, Emacs for For information on Emacs for Windows 95 and NT, read the FAQ produced by Geoff Voelker and currently maintained by Ramprasad B, available at http://www.gnu.org/software/emacs/windows/ntemacs.html See , for Windows 3.1. A port of Emacs 20.7 for Windows CE, based on NTEmacs, is available at http://www.rainer-keuchel.de/software.html This port was done by 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. Where can I get Emacs for my PC running OS/2? OS/2, Emacs for Emacs 20.6 is ported for emx on OS/2 2.0 or 2.1, and is available at ftp://hobbes.nmsu.edu/pub/os2/apps/editors/emacs/ and also at http://www.dotemacs.de/os2/emacs.html Instructions for installation, basic setup, and other useful information for OS/2 users of Emacs can be found at http://home.snafu.de/ohei/emacs/emacs206-os2.html Where can I get Emacs for my Atari ST? Atari ST, Emacs for TOS, Emacs for Roland Schäuble reports that Emacs 18.58 running on plain TOS and MiNT is available at ftp://atari.archive.umich.edu/Editors/Emacs-18-58/1858b-d3.zoo. Where can I get Emacs for my Amiga? Amiga, Emacs for The files you need are available at ftp://ftp.wustl.edu/pub/aminet/util/gnu/ David Gilbert has released a beta version of Emacs 19.25 for the Amiga. You can get the binary at ftp://ftp.wustl.edu/pub/aminet/util/gnu/a2.0bEmacs-bin.lha Where can I get Emacs for NeXTSTEP? NeXTSTEP, Emacs for Emacs.app is a NeXTSTEP version of Emacs 19.34 which supports colors, menus, and multiple frames. You can get it from ftp://next-ftp.peak.org/pub/next-ftp/next/apps/emacs/Emacs_for_NeXTstep.4.20a1.NIHS.b.tar.gz Where can I get Emacs for my Apple computer? Apple computers, Emacs for Macintosh, Emacs for Beginning with version 21.1, the Macintosh is supported in the official Emacs distribution; see the files mac/README and mac/INSTALL in the Emacs distribution for build instructions. Beginning with version 22.1, Emacs supports Mac OS X natively. Where do I get Emacs that runs on VMS under DECwindows? DECwindows, Emacs for VMS, Emacs for Up-to-date information about GNU software (including Emacs) for VMS is available at http://www.lp.se/gnu-vms/. Where can I get modes for Lex, Yacc/Bison, Bourne shell, csh, C++, Objective-C, Pascal, Java, and Awk? Awk, mode for awk-mode Bison, mode for Bourne Shell, mode for C++, mode for Java, mode for Lex mode Objective-C, mode for pascal-mode Shell mode Yacc mode csh mode sh-mode cc-mode Most of these modes are now available in standard Emacs distribution. To get additional modes, see . Barry Warsaw's cc-mode now works for C, C++, Objective-C, and Java code. It is distributed with Emacs, but has its own homepage. Major packages and programs Major packages and programs VM (View Mail) — another mail reader within Emacs, with MIME support VM Alternative mail software View Mail E-mail reader, VM Author Kyle Jones Latest version 7.19 Distribution ftp://ftp.wonderworks.com/pub/vm/vm.tar.gz Informational newsgroup news:gnu.emacs.vm.info Bug reports newsgroup news:gnu.emacs.vm.bugOr send reports to VM 7 works well with Emacs 21 and Emacs 22. Older versions of VM suitable for use with older versions of Emacs are available from the same FTP site. Supercite — mail and news citation package within Emacs Supercite Superyank Mail and news citations News and mail citations Citations in mail and news Author Barry Warsaw Latest version 3.54 (comes bundled with Emacs since version 20) Distribution http://www.python.org/emacs/supercite.tar.gz Mailing list Subscription requests to Submissions Superyank is an old version of Supercite. Calc — poor man's Mathematica within Emacs Programmable calculator Calc Mathematical package Author Dave Gillespie Latest version 2.1 (part of Emacs since version 22.1) Distribution No separate distribution outside of Emacs. Older versionsare available at ftp://ftp.gnu.org/pub/gnu/calc/. Note that Calc 2.02f needs patching to work with Emacs 21 and later. calculator, a package Emacs 21.1 and later comes with a package called calculator.el. It doesn't support all the mathematical wizardry offered by Calc, such as matrices, special functions, and statistics, but is more than adequate as a replacement for xcalc and similar programs. VIPER — vi emulation for Emacs vi emulation VIPER Emulation of vi Since Emacs 19.29, the preferred vi emulation in Emacs is VIPER (M-x viper-mode RET), which comes with Emacs. It extends and supersedes VIP (including VIP 4.3) and provides vi emulation at several levels, from one that closely follows vi to one that departs from vi in several significant ways. For Emacs 19.28 and earlier, the following version of VIP is generally better than the one distributed with Emacs: Author Aamod Sane Latest version 4.3 Distribution ftp://www.club.cc.cmu.edu/pub/gnu/elisp-archive/modes/vip-mode.tar.Z AUC&tex; — enhanced &tex; modes with debugging facilities Mode for &tex; &tex; mode AUC&tex; mode for editing &tex; 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; shell functionality, and debugging. Be also sure to check out See section ``Introduction'' in Ref@TeX{} User Manual. Current versions of AUC&tex; include the preview-latex package for WYSIWYG previews of various LaTeX constructs in the Emacs source buffer. Authors Kresten Krab Thorup, Per Abrahamsen, and others. Maintainer David Kastrup Latest version 11.84 Distribution ftp://ftp.gnu.org/pub/gnu/auctex/ Web site http://www.gnu.org/software/auctex/ Mailing list: Subscription requests to Submissions to BBDB — personal Info Rolodex integrated with mail/news readers BBDB Rolodex-like functionality Integrated contact database Contact database Big Brother Database Address book Maintainer Ronan Waide Latest version 2.34 Distribution http://bbdb.sourceforge.net/ Mailing lists Subscription requests to Submissions to Release announcements: Ispell — spell checker in C with interface for Emacs Spell-checker Checking spelling Ispell Author Geoff Kuenning Latest version 3.3.02 Distribution http://fmg-www.cs.ucla.edu/geoff/tars/ispell-3.3.02.tar.gz Web site http://fmg-www.cs.ucla.edu/geoff/ispell.html This Ispell program is distinct from GNU Ispell 4.0. GNU Ispell 4.0 is no longer a supported product. Emacs/W3 — A World Wide Web browser inside of Emacs WWW browser Web browser HTML browser in Emacs w3-mode Author Bill Perry Maintainer Emacs/W3 needs a maintainer. It has lain dormant for several years. Ifyou would like to take over the project, please contact. Latest version 4.0pre.47 Distribution http://savannah.gnu.org/projects/w3 Mailing lists Receive announcements from Help to develop Emacs/W3 at EDB — Database program for Emacs; replaces forms editing modes EDB Database Forms mode Author Michael Ernst Latest version 1.21 Distribution ftp://theory.lcs.mit.edu/pub/emacs/edb Mailcrypt — PGP interface within Emacs mail and news PGP GPG Interface to PGP from Emacs mail and news News, interface to PGP from Mail, interface to PGP from Encryption software, interface to Authors Patrick J. LoPresti andJin S. Choi Maintainer Brian Warner Latest version 3.5.8 Distribution http://dl.sourceforge.net/sourceforge/mailcrypt/mailcrypt-3.5.8.tar.gz Web site http://mailcrypt.sourceforge.net/ Note that a new package called PGG is bundled with Emacs starting with version 22.1. It is a modern interface to various PGP implementations, including The GNU Privacy Guard and supports symmetric encryption. JDE — Integrated development environment for Java Java development environment Integrated Java development environment JDE Author Paul Kinnucan Latest version 2.3.5 Web site http://jdee.sunsite.dk/ Mailing lists Subscription requests to Receive announcements from Patch — program to apply “diffs” for updating files Updating files with diffs Patching source files with diffs Diffs and patching patch Author Larry Wall (with GNU modifications) Latest version 2.5.4 Distribution See . Key bindings Key bindings How do I bind keys (including function keys) to commands? Binding keys to commands Keys, binding to commands Commands, binding keys to Keys can be bound to commands either interactively or in your .emacs file. To interactively bind keys for all modes, type M-x global-set-key RET key cmd RET. To bind a key just in the current major mode, type M-x local-set-key RET key cmd RET. *note Key Bindings: (emacs)Key Bindings, for further details. To make the process of binding keys interactively easier, use the following “trick”: First bind the key interactively, then immediately type C-x ESC ESC C-a C-k C-g. Now, the command needed to bind the key is in the kill ring, and can be yanked into your .emacs file. If the key binding is global, no changes to the command are required. For example,(global-set-key (quote [f1]) (quote help-for-help)) can be placed directly into the .emacs file. If the key binding is local, the command is used in conjunction with the ‘add-hook’ function. For example, in TeX mode, a local binding might be(add-hook 'tex-mode-hook (lambda () (local-set-key (quote [f1]) (quote help-for-help)))) Control characters in key sequences, in the form yanked from the killring are given in their graphic form—i.e., CTRL is shown as‘^’, TAB as a set of spaces (usually 8), etc. You may wantto convert these into their vector or string forms. If 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 ESC { is previously bound:(global-unset-key [?\e ?{]) ;; or(local-unset-key [?\e ?{]) Aside from commands and “lambda lists,” a vector or string alsocan be bound to a key and thus treated as a macro. For example:(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") Why does Emacs say ‘Key sequence XXX uses invalid prefix characters’? Prefix characters, invalid Invalid prefix characters Misspecified key sequences Usually, one of two things has happened. In one case, the control character in the key sequence has been misspecified (e.g. ‘C-f’ used instead of ‘\C-f’ within a Lisp expression). In the other case, a prefix key in the keystroke sequence you were trying to bind was already bound as a complete key. Historically, the ‘ESC [’ prefix was usually the problem, in which case you should evaluate either of these forms before attempting to bind the key sequence:(global-unset-key [?\e ?[]) ;; or(global-unset-key "\e[") Why doesn't this [terminal or window-system setup] code work in my .emacs file, but it works just fine after Emacs starts up? Terminal setup code in .emacs During startup, Emacs initializes itself according to a given code/file order. If some of the code executed in your .emacs file needs to be postponed until the initial terminal or window-system setup code has been executed but is not, then you will experience this problem (this code/file execution order is not enforced after startup). To postpone the execution of Emacs Lisp code until after terminal or window-system setup, treat the code as a lambda list and set the value of either the term-setup-hook or window-setup-hook variable to this lambda function. For example,(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)))) For information on what Emacs does every time it is started, see the lisp/startup.el file. How do I use function keys under X? Function keys X Window System and function keys Binding function keys With Emacs 19, functions keys under X are bound like any other key. See , for details. How do I tell what characters or symbols my function or arrow keys emit? Working with arrow keys Arrow keys, symbols generated by Working with function keys Function keys, symbols generated by Symbols generated by function keys Type C-h c then the function or arrow keys. The command will return either a function key symbol or character sequence (see the Emacs on-line documentation for an explanation). This works for other keys as well. How do I set the X key “translations” for Emacs? X key translations Key translations under X Translations for keys under X Emacs 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 translations if 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 xmodmap (outside Emacs) or define-key (inside Emacs). The define-key command should be used in conjunction with the function-key-map map. For instance,(define-key function-key-map [M- TAB] [?\M-\t]) defines the M-TAB key sequence. How do I handle C-s and C-q being used for flow control? Flow control, C-s and C-q with C-s and C-q with flow control C-s and 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 Emacs won't honor them as flow control characters, too many of these characters are not passed on and overwhelm output buffers. Sometimes, intermediate software using XON/XOFF flow control will prevent Emacs from ever seeing C-s and C-q. Possible solutions: Disable the use of C-s and C-q for flow control.You need to determine the cause of the flow control. your 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 ‘termcap’ entry for your terminal toinclude extra NUL padding characters. a modemIf you are using a dialup connection, the modems may be usingXON/XOFF flow control. It's not clear how to get around this. a 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. tty and/or pty devicesIf your connection to Emacs goes through multiple tty and/orpty devices, they may be using XON/XOFF flow control even when itis not necessary.Eirik Fuller writes: Some versions of rlogin (and possibly telnet) do not pass flow control characters to the remote system to which they connect. On such systems, Emacs on the remote system cannot disable flow control on the local system. Sometimes ‘rlogin -8’ will avoid this problem. One way to cure this is to disable flow control on the local host (the one running rlogin, not the one running rlogind) using the stty command, before starting the rlogin process. On many systems, ‘stty start u stop u’ will do this. Some versions of ‘tcsh’ will prevent even this from working. One way around this is to start another shell before starting rlogin, and issue the ‘stty’ command to disable flow control from that shell. Use ‘stty -ixon’ instead of ‘stty start u stop u’ on some systems. Make Emacs speak the XON/XOFF flow control protocol.You can make Emacs treat C-s and C-q as flow control characters byevaluating the form(enable-flow-control)to unconditionally enable flow control or(enable-flow-control-on "vt100" "h19")(using your terminal names instead of ‘vt100’ or ‘h19’) toenable selectively. These commands will automatically swap C-sand C-q to C-\ and C-^. Variables can be used tochange the default swap keys (flow-control-c-s-replacement andflow-control-c-q-replacement).If you are fixing this for yourself, simply put the form in your.emacs file. If you are fixing this for your entire site, thebest place to put it is in the site-lisp/site-start.el file.(Here site-lisp is actually a subdirectory of your Emacsinstallation directory, typically /usr/local/share/emacs.)Putting this form in site-lisp/default.el has the problem thatif the user's .emacs file has an error, this will preventdefault.el from being loaded and Emacs may be unusable for theuser, even for correcting their .emacs file (unless they'resmart enough to move it to another name).enable-flow-control can be invoked interactively as well:M-x enable-flow-control RET. For further discussion of this issue, read the file etc/PROBLEMS (in the Emacs source directory when you unpack the Emacs distribution). How do I bind C-s and C-q (or any key) if these keys are filtered out? Binding C-s and C-q C-s and C-q, binding To bind C-s and C-q, use either enable-flow-control or enable-flow-control-on. See , for usage and implementation details. To bind other keys, use keyboard-translate. See , for usage details. To do this for an entire site, you should swap the keys in site-lisp/site-start.el. See , for an explanation of why site-lisp/default.el should not be used. If you do this for an entire site, the users will be confused bythe disparity between what the documentation says and how Emacsactually behaves. Why does the Backspace key invoke help? Backspace key invokes help Help invoked by Backspace DEL key does not delete The Backspace key (on most keyboards) generates ASCII code 8. C-h sends the same code. In Emacs by default C-h invokes help-command. This is intended to be easy to remember since the first letter of ‘help’ is ‘h’. The easiest solution to this problem is to use C-h (and Backspace) for help and DEL (the Delete key) for deleting the previous character. For many people this solution may be problematic: They normally use Backspace outside of Emacs for deleting theprevious character. This can be solved by making DEL the commandfor deleting the previous character outside of Emacs. On many Unixsystems, this command will remap DEL: stty erase `^?' The user may prefer the Backspace key for deleting theprevious character because it is more conveniently located on theirkeyboard or because they don't even have a separate Delete key.In this case, the Backspace key should be made to behave likeDelete. There are several methods. Some terminals (e.g., VT3## terminals) and terminal emulators (e.g.,TeraTerm) allow the character generated by the Backspace key to bechanged from a setup menu. You may be able to get a keyboard that is completely programmable, or aterminal emulator that supports remapping of any key to any other key. With Emacs 21.1 and later, you can control the effect of theBackspace and Delete keys, on both dumb terminals and awindowed displays, by customizing the optionnormal-erase-is-backspace-mode, or by invoking M-xnormal-erase-is-backspace. See the documentation of these symbols(see ) for more info. It is possible to swap the Backspace and DEL keys insideEmacs:(keyboard-translate ?\C-h ?\C-?)This is the recommended method of forcing Backspace to act asDEL, because it works even in modes which bind DEL tosomething other than delete-backward-char.Similarly, you could remap DEL to act as C-d, which bydefault deletes forward:(keyboard-translate ?\C-? ?\C-d)See , for further details about keyboard-translate. Another approach is to switch key bindings and put help on C-x hinstead:(global-set-key "\C-h" 'delete-backward-char);; overrides mark-whole-buffer(global-set-key "\C-xh" 'help-command)This method is not recommended, though: it only solves the problem forthose modes which bind DEL to delete-backward-char. Modeswhich bind DEL to something else, such as view-mode, willnot work as you expect when you press the Backspace key. For thisreason, we recommend the keyboard-translate method, shownabove.Other popular key bindings for help are M-? and C-x ?. Don't try to bind DEL to help-command, because there aremany modes that have local bindings of DEL that will interfere. When Emacs 21 or later runs on a windowed display, it binds the Delete key to a command which deletes the character at point, to make Emacs more consistent with keyboard operation on these systems. For more information about troubleshooting this problem, see See section ``If @key{DEL} Fails to Delete'' in The GNU Emacs Manual. Why doesn't Emacs look at the stty settings for Backspace vs. Delete? stty and Emacs Backspace and stty Delete and stty Good question! How do I swap two keys? Swapping keys Keys, swapping keyboard-translate You can swap two keys (or key sequences) by using the keyboard-translate function. For example, to turn C-h into DEL and DEL to C-h, use(keyboard-translate ?\C-h ?\C-?) ; translate `C-h' to DEL(keyboard-translate ?\C-? ?\C-h) ; translate DEL to `C-h'. The first key sequence of the pair after the function identifies what is produced by the keyboard; the second, what is matched for in the keymaps. However, in the specific case of C-h and DEL, you should toggle normal-erase-is-backspace-mode instead of calling keyboard-translate. *note DEL Does Not Delete: (emacs)DEL Does Not Delete. Keyboard translations are not the same as key bindings in keymaps. Emacs contains numerous keymaps that apply in different situations, but there is only one set of keyboard translations, and it applies to every character that Emacs reads from the terminal. Keyboard translations take place at the lowest level of input processing; the keys that are looked up in keymaps contain the characters that result from keyboard translation. How do I produce C-XXX with my keyboard? Producing control characters Generating control characters Control characters, generating On terminals (but not under X), some common “aliases” are: C-2 or C-SPC C-@ C-6 C-^ C-7 or C-S– C-_ C-4 C-\ C-5 C-] C-/ C-? Often other aliases exist; use the C-h c command and try CTRL with all of the digits on your keyboard to see what gets generated. You can also try the C-h w command if you know the name of the command. What if I don't have a Meta key? No Meta key Meta key, what to do if you lack it On many keyboards, the Alt key acts as Meta, so try it. Instead of typing M-a, you can type ESC a. In fact, Emacs converts M-a internally into ESC a anyway (depending on the value of meta-prefix-char). Note that you press Meta and a together, but with ESC, you press ESC, release it, and then press a. What if I don't have an Escape key? No Escape key Lacking an Escape key Escape key, lacking Type C-[ instead. This should send ASCII code 27 just like an Escape key would. C-3 may also work on some terminal (but not under X). For many terminals (notably DEC terminals) F11 generates ESC. If not, the following form can be used to bind it:;; F11 is the documented ESC replacement on DEC terminals.(define-key function-key-map [f11] [?\e]) Can I make my Compose Character key behave like a Meta key? Compose Character key, using as Meta Meta, using Compose Character for On a dumb terminal such as a VT220, no. It is rumored that certain VT220 clones could have their Compose key configured this way. If you're using X, you might be able to do this with the xmodmap command. How do I bind a combination of modifier key and function key? Modifiers and function keys Function keys and modifiers Binding modifiers and function keys With Emacs 19 and later, you can represent modified function keys in vector format by adding prefixes to the function key symbol. For example (from the on-line documentation):(global-set-key [?\C-x right] 'forward-page) where ‘?\C-x’ is the Lisp character constant for the character C-x. You can use the modifier keys Control, Meta, Hyper, Super, Alt, and Shift with function keys. To represent these modifiers, prepend the strings ‘C-’, ‘M-’, ‘H-’, ‘s-’, ‘A-’, and ‘S-’ to the symbol name. Here is how to make H-M-RIGHT move forward a word:(global-set-key [H-M-right] 'forward-word) Not all modifiers are permitted in all situations. Hyper,Super, and Alt are not available on Unix characterterminals. Non-ASCII keys and mouse events (e.g. C-= andMouse-1) also fall under this category. See , for general key binding instructions. Why doesn't my Meta key work in an xterm window? Meta key and xterm Xterm and Meta key *note Single-Byte Character Set Support: (emacs)Unibyte Mode. If the advice in the Emacs manual fails, try all of these methods before asking for further help: You may have big problems using mwm as your window manager.(Does anyone know a good generic solution to allow the use of theMeta key in Emacs with mwm?) For X11: Make sure it really is a Meta key. Use xev tofind out what keysym your Meta key generates. It should be eitherMeta_L or Meta_R. If it isn't, use xmodmap to fixthe situation. If Meta does generate Meta_L orMeta_R, but M-x produces a non-ASCII character, put this inyour ~/.Xdefaults file: XTerm*eightBitInput: false XTerm*eightBitOutput: true Make sure the pty the xterm is using is passing 8 bitcharacters. ‘stty -a’ (or ‘stty everything’) should show‘cs8’ somewhere. If it shows ‘cs7’ instead, use ‘sttycs8 -istrip’ (or ‘stty pass8’) to fix it. If there is an rlogin connection between xterm and Emacs, the‘-8’ argument may need to be given to rlogin to make it pass all 8 bitsof every character. If Emacs is running on Ultrix, it is reported that evaluating(set-input-mode t nil) helps. If all else fails, you can make xterm generate ESC W whenyou type M-W, which is the same conversion Emacs would make if itgot the M-W anyway. In X11R4, the following resourcespecification will do this: XTerm.VT100.EightBitInput: false (This changes the behavior of the insert-eight-bit action.)With older xterms, you can specify this behavior with a translation: XTerm.VT100.Translations: #override \ Meta<KeyPress>: string(0x1b) insert() You might have to replace ‘Meta’ with ‘Alt’. Why doesn't my ExtendChar key work as a Meta key under HP-UX 8.0 and 9.x? ExtendChar key as Meta Meta, using ExtendChar for HP-UX, the ExtendChar key This is a result of an internationalization extension in X11R4 and the fact that HP is now using this extension. Emacs assumes that the XLookupString function returns the same result regardless of the Meta key state which is no longer necessarily true. Until Emacs is fixed, the temporary kludge is to run this command after each time the X server is started but preferably before any xterm clients are: xmodmap -e 'remove mod1 = Mode_switch' This will disable the use of the extra keysyms systemwide, which may be undesirable if you actually intend to use them. Why doesn't SPC complete file names anymore? SPC file name completion Starting with Emacs 22.1, SPC no longer completes file names in the minibuffer, so that file names with embedded spaces could be typed without the need to quote the spaces. You can get the old behavior by binding SPC to minibuffer-complete-word in the minibuffer, as follows:(define-key minibuffer-local-filename-completion-map (kbd "SPC") 'minibuffer-complete-word)(define-key minibuffer-local-must-match-filename-map (kbd "SPC") 'minibuffer-complete-word) Alternate character sets Alternate character sets How do I make Emacs display 8-bit characters? Displaying eight-bit characters Eight-bit characters, displaying *note Single-byte Character Set Support: (emacs)Unibyte Mode. On a Unix, when Emacs runs on a text-only terminal display or is invoked with ‘emacs -nw’, you typically need to use set-terminal-coding-system to tell Emacs what the terminal can display, even after setting the language environment; otherwise non-ASCII characters will display as ‘?’. On other operating systems, such as MS-DOS and MS-Windows, Emacs queries the OS about the character set supported by the display, and sets up the required terminal coding system automatically. How do I input eight-bit characters? Entering eight-bit characters Eight-bit characters, entering Input, 8-bit characters Various methods are available for input of eight-bit characters. See *note Single-byte Character Set Support: (emacs)Unibyte Mode. For more sophisticated methods, *note Input Methods: (emacs)Input Methods. Where can I get an Emacs that handles kanji, Chinese, or other Far-Eastern character sets? Kanji, handling with Emacs Chinese, handling with Emacs Japanese, handling with Emacs Korean, handling with Emacs Emacs 20 and later includes many of the features of MULE, the MULtilingual Enhancement to Emacs. See , for information on where to find and download the latest version of Emacs. Where is an Emacs that can handle Semitic (right-to-left) alphabets? Right-to-left alphabets Hebrew, handling with Emacs Semitic alphabets Arabic alphabets Emacs 20 and later supports Hebrew characters (ISO 8859-8), but does not yet support right-to-left character entry and display. Joel M. Hoffman has written a Lisp package called hebrew.el that allows right-to-left editing of Hebrew. It reportedly works out of the box with Emacs 19, but requires patches for Emacs 18. Write to Joel if you want the patches or package. 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 querying archie for files named with hebrew; several ftp sites in Israel may also have the necessary files. How do I add fonts for use with Emacs? add fonts for use with Emacs intlfonts First, download and install the BDF font files and any auxiliary packages they need. The GNU Intlfonts distribution can be found on the GNU Software Directory Web site. Next, if you are on X Window system, issue the following two commands from the shell's prompt: xset +fp /usr/local/share/emacs/fonts xset fp rehash (Modify the first command if you installed the fonts in a directory that is not /usr/local/share/emacs/fonts.) You also need to arrange for these two commands to run whenever you log in, e.g., by adding them to your window-system startup file, such as ~/.xsessionrc or ~/.gnomerc. Now, add the following line to your ~/.emacs init file: (add-to-list 'bdf-directory-list "/usr/share/emacs/fonts/bdf") (Again, modify the file name if you installed the fonts elsewhere.) Finally, if you wish to use the installed fonts with ps-print, add the following line to your ~/.emacs: (setq ps-multibyte-buffer 'bdf-font-except-latin) A few additional steps are necessary for MS-Windows; they are listed below. First, make sure all the directories with BDF font files are mentioned in bdf-directory-list. On Unix and GNU/Linux systems, one normally runs make install to install the BDF fonts in the same directory. By contrast, Windows users typically don't run the Intlfonts installation command, but unpack the distribution in some directory, which leaves the BDF fonts in its subdirectories. For example, assume that you unpacked Intlfonts in C:/Intlfonts; then you should set bdf-directory-list as follows: (setq bdf-directory-list '("C:/Intlfonts/Asian" "C:/Intlfonts/Chinese" "C:/Intlfonts/Chinese.X" "C:/Intlfonts/Chinese.BIG" "C:/Intlfonts/Ethiopic" "C:/Intlfonts/European" "C:/Intlfonts/European.BIG" "C:/Intlfonts/Japanese" "C:/Intlfonts/Japanese.X" "C:/Intlfonts/Japanese.BIG" "C:/Intlfonts/Korean.X" "C:/Intlfonts/Misc")) w32-bdf-filename-alist w32-find-bdf-fonts Next, you need to set up the variable w32-bdf-filename-alist to an alist of the BDF fonts and their corresponding file names. Assuming you have set bdf-directory-list to name all the directories with the BDF font files, the following Lisp snippet will set up w32-bdf-filename-alist: (setq w32-bdf-filename-alist (w32-find-bdf-fonts bdf-directory-list)) Now, create fontsets for the BDF fonts: (create-fontset-from-fontset-spec "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf, japanese-jisx0208:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1983-*, katakana-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, latin-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, japanese-jisx0208-1978:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1978-*, thai-tis620:-misc-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1, lao:-misc-fixed-medium-r-normal--16-160-72-72-m-80-MuleLao-1, tibetan-1-column:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-80-MuleTibetan-1, ethiopic:-Admas-Ethiomx16f-Medium-R-Normal--16-150-100-100-M-160-Ethiopic-Unicode, tibetan:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-160-MuleTibetan-0") Many of the international bdf fonts from Intlfonts are type 0, and therefore need to be added to font-encoding-alist: (setq font-encoding-alist (append '(("MuleTibetan-0" (tibetan . 0)) ("GB2312" (chinese-gb2312 . 0)) ("JISX0208" (japanese-jisx0208 . 0)) ("JISX0212" (japanese-jisx0212 . 0)) ("VISCII" (vietnamese-viscii-lower . 0)) ("KSC5601" (korean-ksc5601 . 0)) ("MuleArabic-0" (arabic-digit . 0)) ("MuleArabic-1" (arabic-1-column . 0)) ("MuleArabic-2" (arabic-2-column . 0))) font-encoding-alist)) You can now use the Emacs font menu to select the ‘bdf: 16-dot medium’ fontset, or you can select it by setting the default font in your ~/.emacs: (set-default-font "fontset-bdf") Mail and news Mail and news How do I change the included text prefix in mail/news followups? Prefix in mail/news followups, changing Included text prefix, changing Setting the included text character Quoting in mail messages If you read mail with Rmail or news with Gnus, set the variable mail-yank-prefix. For VM, set vm-included-text-prefix. For mh-e, set mh-ins-buf-prefix. For fancier control of citations, use Supercite. See . To prevent Emacs from including various headers of the replied-to message, set the value of mail-yank-ignored-headers to an appropriate regexp. How do I save a copy of outgoing mail? Saving a copy of outgoing mail Copying outgoing mail to a file Filing outgoing mail Automatic filing of outgoing mail Mail, saving outgoing automatically You can either mail yourself a copy by including a ‘BCC’ header in the mail message, or store a copy of the message directly to a file by including an ‘FCC’ header. If you use standard mail, you can automatically create a ‘BCC’ to yourself by putting(setq mail-self-blind t) in your .emacs file. You can automatically include an ‘FCC’ field by putting something like the following in your .emacs file:(setq mail-archive-file-name (expand-file-name "~/outgoing")) The output file will be in Unix mail format, which can be read directly by VM, but not always by Rmail. See . If you use mh-e, add an ‘FCC’ or ‘BCC’ field to your components file. It does not work to put ‘set record filename’ in the .mailrc file. Why doesn't Emacs expand my aliases when sending mail? Expanding aliases when sending mail Mail alias expansion Sending mail with aliases You must separate multiple addresses in the headers of the mail bufferwith commas. This is because Emacs supports RFC822 standard addresseslike this one: To: Willy Smith <wks@xpnsv.lwyrs.com> However, you do not need to—and probably should not, unless yoursystem's version of /usr/ucb/mail (a.k.a. mailx)supports RFC822—separate addresses with commas in your~/.mailrc file. Emacs normally only reads the .mailrc file once per session,when you start to compose your first mail message. If you edit.mailrc, you can type M-x rebuild-mail-abbrevs RET tomake Emacs reread ~/.mailrc. If you like, you can expand mail aliases as abbrevs, as soon as youtype them in. To enable this feature, execute the following:(add-hook 'mail-mode-hook 'mail-abbrevs-setup)Note that the aliases are expanded automatically only after you typeRET or a punctuation character (e.g. ,). You can force theirexpansion by moving point to the end of the alias and typing C-x a e(M-x expand-abbrev). Why does Rmail think all my saved messages are one big message? Rmail thinks all messages are one large message A file created through the ‘FCC’ field in a message is in Unix mail format, not the format that Rmail uses (BABYL format). Rmail will try to convert a Unix mail file into BABYL format on input, but sometimes it makes errors. For guaranteed safety, you can make the saved-messages file be an inbox for your Rmail file by using the function set-rmail-inbox-list. How can I sort the messages in my Rmail folder? Rmail, sorting messages in Folder, sorting messages in an Rmail Sorting messages in an Rmail folder In Rmail, type C-c C-s C-h to get a list of sorting functions and their key bindings. Why does Rmail need to write to /usr/spool/mail? Rmail and /usr/spool/mail /usr/spool/mail and Rmail This is the behavior of the movemail program which Rmail uses. This indicates that movemail is configured to use lock files. RMS writes: Certain systems require lock files to interlock access to mail files. On these systems, movemail must write lock files, or you risk losing mail. You simply must arrange to let movemail write them. Other systems use the flock system call to interlock access. On these systems, you should configure movemail to use flock. How do I recover my mail files after Rmail munges their format? Recovering munged mail files Rmail munged my files Mail files, recovering those munged by Rmail If you have just done M-x rmail-input on a file and you don't want to save it in Rmail's format (called BABYL), just kill the buffer (with C-x k). Exporting messages as Unix mail files If you typed M-x rmail and it read some messages out of your inbox and you want to put them in a Unix mail file, use C-o on each message. Converting from BABYL to Unix mail format unrmail command If you want to convert an existing file from BABYL format to Unix mail format, use the command M-x unrmail: it will prompt you for the input and output file names. b2m Alternatively, you could use the b2m program supplied with Emacs. b2m is a filter, and is used like this: b2m < babyl-file > mbox-file where babyl-file is the name of the BABYL file, and mbox-file is the name of the file where the converted mail will be written. How can I force Rmail to reply to the sender of a message, but not the other recipients? Replying only to the sender of a message Sender, replying only to Rmail, replying to the sender of a message in Ron Isaacson says: When you hit r to reply in Rmail, by default it CCs all of the original recipients (everyone on the original ‘To’ and ‘CC’ lists). With a prefix argument (i.e., typing C-u before r), it replies only to the sender. However, going through the whole C-u business every time you want to reply is a pain. This is the best fix I've been able to come up with:(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))) How can I get my favorite Emacs mail package to support MIME? MIME and Emacs mail packages Mail packages and MIME FAQ for MIME and Emacs Version 6.x of VM supports MIME. See . Gnus supports MIME in mail and news messages as of version 5.8.1 (Pterodactyl). Rmail has limited support for single-part MIME messages beginning with Emacs 20.3. How do I make Emacs automatically start my mail/news reader? Mail reader, starting automatically News reader, starting automatically Starting mail/news reader automatically To start Emacs in Gnus: emacs -f gnus in Rmail: emacs -f rmail A more convenient way to start with Gnus: alias gnus 'emacs -f gnus' gnus It is probably unwise to automatically start your mail or news reader from your .emacs file. This would cause problems if you needed to run two copies of Emacs at the same time. Also, this would make it difficult for you to start Emacs quickly when you needed to. How do I read news under Emacs? Reading news under Emacs Usenet reader in Emacs Gnus newsreader Use M-x gnus. It is documented in Info (see ). Why doesn't Gnus work via NNTP? Gnus and NNTP NNTP, Gnus fails to work with There is a bug in NNTP version 1.5.10, such that when multiple requests are sent to the NNTP server, the server only handles the first one before blocking waiting for more input which never comes. NNTP version 1.5.11 claims to fix this. You can work around the bug inside Emacs like this:(setq nntp-maximum-request 1) You can find out what version of NNTP your news server is running by telnetting to the NNTP port (usually 119) on the news server machine (i.e., telnet server-machine 119). The server should give its version number in the welcome message. Type quit to get out. See , for some additional ideas. How do I view news articles with embedded underlining (e.g., ClariNews)? Underlining, embedded in news articles News articles with embedded underlining Embedded underlining in news articles Underlining appears like this: _^Hu_^Hn_^Hd_^He_^Hr_^Hl_^Hi_^Hn_^Hi_^Hn_^Hg Per Abrahamsen suggests using the following code, which uses the underline face to turn such text into true underlining, inconjunction with Gnus:(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) Latest versions of Gnus do such a conversion automatically. If you prefer to do away with underlining altogether, you can destructively remove it with M-x ununderline-region; do this automatically via(add-hook 'gnus-article-prepare-hook (lambda () (ununderline-region (point-min) (point-max)))) How do I save all the items of a multi-part posting in Gnus? Multi-part postings in Gnus, saving Saving multi-part postings in Gnus Gnus, saving multi-part postings in Use gnus-uu. Type C-c C-v C-h in the Gnus summary buffer to see a list of available commands. How do I make Gnus start up faster? Faster, starting Gnus Starting Gnus faster Gnus, starting faster From the Gnus FAQ (see ): Pranav Kumar Tiwari writes: I posted the same query recently and I got an answer to it. I am going to repeat the answer. What you need is a newer version of gnus, version 5.0.4+. I am using 5.0.12 and it works fine with me with the following settings: (setq gnus-check-new-newsgroups nil gnus-read-active-file 'some gnus-nov-is-evil nil gnus-select-method '(nntp gnus-nntp-server)) How do I catch up all newsgroups in Gnus? Catching up all newsgroups in Gnus Gnus, Catching up all newsgroups in In the *Newsgroup* buffer, type M-< C-x ( c y C-x ) M-0 C-x e Leave off the initial M-< if you only want to catch up from point to the end of the *Newsgroup* buffer. Why can't I kill in Gnus based on the Newsgroups/Keywords/Control headers? Killing articles based on nonstandard headers Newsgroups header, killing articles based on Keywords header, killing articles based on Control header, killing articles based on Gnus will complain that the ‘Newsgroups’, ‘Keywords’, and ‘Control’ headers are “Unknown header” fields. For the ‘Newsgroups’ header, there is an easy workaround: kill on the ‘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 like this:(gnus-kill nil "^Newsgroups: .*\\(bad\\.group\\|worse\\.group\\)") How do I get rid of flashing messages in Gnus for slow connections? Flashing Gnus messages, removing Removing flashing Gnus messages Slow connections causing flashing messages in Gnus Gnus, flashing messages in Set nntp-debug-read to nil. Why is catch up slow in Gnus? Slow catch up in Gnus Gnus is slow when catching up Crosspostings make Gnus catching up slow Because Gnus is marking crosspostings read. You can control this with the variable gnus-use-cross-reference. Why does Gnus hang for a long time when posting? Hangs in Gnus Gnus hangs while posting Posting, Gnus hangs wile David Lawrence explains: The problem is almost always interaction between NNTP and C News. NNTP POST asks C News's inews to not background itself but rather hang around 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 the waited for job is a different sort of problem.) It ends up taking a long time because inews is calling relaynews, which often waits for another relaynews to free the lock on the news system so it can file the article. My preferred solution is to change inews to not call relaynews, but rather use newsspool. This loses some error-catching functionality, but is for the most part safe as inews will detect a lot of the errors on its own. The C News folks have sped up inews, too, so speed should look better to most folks as that update propagates around. Where can I find out more about Gnus? FAQ for Gnus Gnus FAQ Learning more about Gnus For more information on Gnus, consult the Gnus manual and FAQ, which are part of the Gnus distribution. xreflabel="Concept Index" id="Concept-index"> Concept Index #ifdef, selective display of, see $’ in file names, see -debug-init’ option, see movemail’ and security, see &tex; documents, checking spelling in, see &tex; mode, see ., equivalent to vi command, see .emacs debugging, see .emacs file, errors in, see .emacs file, locating, see .emacs file, setting up, see .Xdefaults, see /usr/spool/mail and Rmail, see A Abbrevs, turning on by default, see Abnormal exits from shell-mode, see Acronyms, definitions for, see add fonts for use with Emacs, see Adding to load-path, see Address book, see Alternate character sets, see Alternative Info file viewers, see Alternative mail software, see Amiga, Emacs for, see Antivirus programs, and Shell Mode, see Apple computers, Emacs for, see Apropos, see Arabic alphabets, see Archived postings from gnu.emacs.help, see Arrow keys, symbols generated by, see Associating modes with files, see Atari ST, Emacs for, see AUC&tex; mode for editing &tex;, see auto-fill-mode, activating automatically, see auto-fill-mode, introduction to, see auto-mode-alist, modifying, see Auto-saving, see Automatic entry to auto-fill-mode, see Automatic filing of outgoing mail, see Awk, mode for, see awk-mode, see B Backspace and stty, see Backspace key invokes help, see Backup files in a single directory, see Backups, disabling, see Basic editing with Emacs, see Basic keys, see BBDB, see Beeping without obvious reason, see Beeping, turning off, see Beginning editing, see Bell, visible, see Bell, volume of, see Big Brother Database, see Binding C-s and C-q, see Binding function keys, see Binding keys to commands, see Binding modifiers and function keys, see Bison, mode for, see Bourne Shell, mode for, see Bug reporting, see Bugs and problems, see Building Emacs from source, see C C++, mode for, see C-h, definition of, see C-M-h, definition of, see C-s and C-q with flow control, see C-s and C-q, binding, see Calc, see calculator, a package, see Case sensitivity in replacements, see Case sensitivity of searches, see case-fold-search, see case-replace, see Catching up all newsgroups in Gnus, see cc-mode, see Checking spelling, see Checking spelling, see Chinese, handling with Emacs, see Citations in mail and news, see Colorizing text, see Colors on a TTY, see Colors on text-only terminals, see Column, displaying the current, see Command description in the manual, see Commands, binding keys to, see Commands, extended, see Commands, repeating many times, see Common acronyms, definitions for, see Common requests, see Compilation error messages, see Compiler error messages, recognizing, see Compiling and installing Emacs, see Compiling Emacs for DOS, see Compose Character key, using as Meta, see Console, colors, see Contact database, see Contracting the FSF, see Control characters, generating, see Control characters, working with, see Control header, killing articles based on, see Control key, notation for, see Control-Meta characters, notation for, see Conventions for file names, see Converting from BABYL to Unix mail format, see Copying outgoing mail to a file, see COPYING, description of file, see Copyleft, real meaning of, see Creating new menu options, see Crosspostings make Gnus catching up slow, see csh mode, see Current directory and shell-mode, see Current GNU distributions, see Customization file, setting up, see Customize groups, see Customize indentation, see Customizing faces, see Customizing variables, see D Database, see Debugging .emacs file, see Debugging .emacs file, see Decoration level, in font-lock-mode, see DECwindows, Emacs for, see Default features, see default-tab-width, see DEL key does not delete, see DEL, definition of, see Delay when visiting files, see Delete and stty, see delete-selection-mode, see Deleting menus and menu options, see Difference Emacs and XEmacs, see Differences between Emacs 19 and Emacs 20, see Differences between Emacs 20 and Emacs 21, see Differences between Emacs 21 and Emacs 22, see Differences between Unix and Emacs regexps, see Diffs and patching, see Directories and files that come with Emacs, see Directory, current in shell-mode, see Dired does not see a file, see Disabling auto-save-mode, see Disabling backups, see Discussion of the GPL, see Displaying eight-bit characters, see Displaying the current line or column, see DISTRIB, description of file, see Distribution, retrieving Emacs, see Do key, see Documentation, see Documentation for etags, see Documentation on Emacs Lisp, see Documentation, installing new Texinfo files, see DOS, Emacs for, see Downloading and installing Emacs, see Drag-and-drop, see E E-mail reader, VM, see E-mail, retrieving the FAQ via, see Echoed commands in shell-mode, see EDB, see Editing files with ‘$’ in the name, see Editing MS-DOS files, see Eight-bit characters, displaying, see Eight-bit characters, entering, see Eight-bit characters, working with, see Emacs 20, new features in, see Emacs 21, new features in, see Emacs 22, new features in, see Emacs entries for termcap/terminfo, see Emacs for MS-DOS, see Emacs for MS-Windows, see Emacs Lisp Archive, see Emacs Lisp List, see Emacs Lisp Manual, see Emacs Lisp Reference Manual, see Emacs manual, obtaining a printed or HTML copy of, see Emacs name origin, see Emacs server functions, see emacsclient, see Embedded underlining in news articles, see Emulation of vi, see Encryption software, interface to, see Entering eight-bit characters, see Epoch, see Error in .emacs, see Error in init file, see Errors when building Emacs, see Errors, recognizing compiler, see ESC, definition of, see Escape key, lacking, see Escape sequences in ls output, see etags, documentation for, see Evaluating Lisp code, see Expanding aliases when sending mail, see explicit-shell-file-name, see Exporting messages as Unix mail files, see ExtendChar key as Meta, see Extended commands, see F FAQ for Gnus, see FAQ for MIME and Emacs, see FAQ for NT Emacs, see FAQ notation, see FAQ, font-lock-mode, see FAQ, obtaining the, see Faster, starting Gnus, see File extensions and modes, see File name, displaying in the titlebar, see File names containing ‘$’, editing, see file-local-variable and security, see File-name conventions, see Files included with Emacs, see Files, maximum size, see Files, replacing strings across multiple, see Files, take a long time to visit, see Filing outgoing mail, see Fill prefix, see fill-column, default value, see Filling automatically, see Finding an Emacs Lisp package, see Finding commands and variables, see Finding current GNU software, see Finding Emacs and related packages, see Finding Emacs on the Internet, see Finding other packages, see Finding topics in the on-line manual, see Flashing Gnus messages, removing, see Flow control, C-s and C-q with, see Folder, sorting messages in an Rmail, see font-lock-mode, see Forms mode, see Frame parameters, see frame-title-format, see Free Software Foundation, contacting, see FSF, definition of, see FTP, definition of, see FTP, description of file, see Fullscreen mode, see Function documentation, see Function keys, see Function keys and modifiers, see Function keys, symbols generated by, see Functionality, finding a particular package, see G General Public License, real meaning of, see General questions, see Generating control characters, see gethostbyname, problematic version, see Getting help, see GNU mailing lists, see GNU newsgroups, appropriate messages for, see GNU, definition of, see GNU, description of file, see Gnus and NNTP, see Gnus FAQ, see Gnus hangs while posting, see Gnus is slow when catching up, see Gnus newsreader, see Gnus, Catching up all newsgroups in, see Gnus, flashing messages in, see Gnus, saving multi-part postings in, see Gnus, starting faster, see gnuserv, see Going to a line by number, see Good bug reports, see GPG, see GPL, definition of, see GPL, real meaning of, see GTK+ Toolkit, see H Hangs in Gnus, see Hebrew, handling with Emacs, see Help for Emacs, see Help installing Emacs, see Help invoked by Backspace, see Help system, entering the, see hide-ifdef-mode, see Hiding #ifdef text, see Highlighting and replacing text, see Highlighting based on syntax, see Highlighting matching parentheses, see Highlighting text, see hilit19 is deprecated, see Horizontal scrolling, see Hosts, Emacs cannot talk to, see How to submit a bug report, see HP-UX, the ExtendChar key, see hscroll-mode, see HTML browser in Emacs, see HTML version of Emacs manual, obtaining, see I Iconification under the X Window System, see Ignored X resources, see Ignoring case in searches, see Included text prefix, changing, see Indentation, how to customize, see Indenting new lines, see Indenting of switch, see Index search in a manual, see Info file viewers, see Info files, how to install, see Info, finding topics in, see Informational files included with Emacs, see Init file debugging, see Init file, errors in, see Init file, setting up, see Input, 8-bit characters, see Insert, see Installation help, see Installing Emacs, see Installing Texinfo documentation, see Integrated contact database, see Integrated Java development environment, see Interface to PGP from Emacs mail and news, see Internet, retrieving from, see INTERVIEW, description of file, see intlfonts, see Invalid prefix characters, see isearch yanking, see isearch-mode, spontaneous entry into, see Ispell, see J Japanese, handling with Emacs, see Java development environment, see Java, mode for, see JDE, see Just-In-Time syntax highlighting, see K Kanji, handling with Emacs, see Key bindings, see Key translations under X, see keyboard-translate, see Keymaps and menus, see Keys, binding to commands, see Keys, swapping, see Keywords header, killing articles based on, see Killing articles based on nonstandard headers, see Korean, handling with Emacs, see L Lacking an Escape key, see Large files, opening, see Latest FAQ version, obtaining the, see Latest version of Emacs, see League for Programming Freedom, see Learning more about Gnus, see Learning to do something in Emacs, see Length of tab character, see Levels of syntax highlighting, see Lex mode, see LFD, definition of, see Line number, displaying the current, see Line wrap, see line-number-mode, see Linking with -lX11 fails, see Lisp forms, evaluating, see Lisp packages that do not come with Emacs, see load-path, modifying, see Lookup a subject in a manual, see LPF, definition of, see LPF, description of, see LPF, description of file, see ls in Shell mode, see Lucid Emacs, see lX11, linking fails with, see M M-x, meaning of, see MACHINES, description of file, see Macintosh, Emacs for, see Mail alias expansion, see Mail and news, see Mail and news citations, see Mail files, recovering those munged by Rmail, see Mail packages and MIME, see Mail reader, starting automatically, see Mail replies, inserting a prefix character, see Mail, interface to PGP from, see Mail, saving outgoing automatically, see mail-yank-prefix, see Mailing lists, appropriate messages for, see MAILINGLISTS, description of file, see Major mode for shell scripts, see Major packages and programs, see Manual, obtaining a printed or HTML copy of, see Matching parentheses, see Mathematical package, see Maximize frame, see Maximum file size, see Maximum line width, default value, see Menus and keymaps, see Menus, creating or modifying, see Menus, deleting, see Meta key and xterm, see Meta key, notation for, see Meta key, what to do if you lack it, see Meta, using Compose Character for, see Meta, using ExtendChar for, see Microsoft files, editing, see Microsoft Windows, Emacs for, see MIME and Emacs mail packages, see Misspecified key sequences, see Mode for &tex;, see mode-line-format, see Modes, associating with file extensions, see Modifiers and function keys, see Modifying load-path, see Modifying pull-down menus, see Mouse wheel, see MS-DOS files, editing, see MS-DOS, Emacs for, see Multi-part postings in Gnus, saving, see Multilingual Environment, see Multiple files, replacing across, see N New lines, indenting of, see New modes, see New Texinfo files, installing, see News and mail citations, see News articles with embedded underlining, see News reader, starting automatically, see News replies, inserting a prefix character, see NEWS, description of file, see News, interface to PGP from, see Newsgroups header, killing articles based on, see Newsgroups, appropriate messages for, see NeXTSTEP, Emacs for, see NNTP, Gnus fails to work with, see No Escape key, see No Meta key, see Notation for keys, see O Objective-C, mode for, see Official GNU software sites, see Old Usenet postings for GNU groups, see On-line manual, reading topics in, see One space following periods, see Opening very large files, see Ordering GNU software, see Origin of the term “Emacs”, see Original version of Emacs, see OS/2, Emacs for, see OSF, definition of, see Overview of help systems, see overwrite-mode, see Overwriting existing text, see P Package, finding, see Packages, those that do not come with Emacs, see Pairs of parentheses, highlighting, see paren.el, see Parentheses, matching, see pascal-mode, see patch, see Patching source files with diffs, see Patents for software, opposition to, see Periods, one space following, see PGP, see picture-mode, see Postal address of the FSF, see Postal service, ordering Emacs via, see Posting messages to newsgroups, see Posting, Gnus hangs wile, see Prefix character, inserting in mail/news replies, see Prefix characters, invalid, see Prefix in mail/news followups, changing, see Prefixing a region with some text, see Prefixing lines, see Previous line, indenting according to, see Printed Emacs manual, obtaining, see Printing a Texinfo file, see Printing documentation, see Problems building Emacs, see Process shell exited, see Producing control characters, see Programmable calculator, see Pull-down menus, creating or modifying, see Q Quoting in mail messages, see R Reading news under Emacs, see Reading the Emacs manual, see Reading topics in the on-line manual, see Recently introduced features, see Recently introduced features, see Recognizing non-standard compiler errors, see Recompilation, see Recovering munged mail files, see Recursive search/replace operations, see Reducing the increment when scrolling, see Reference card for Emacs, see Reference cards, in other languages, see Reference manual for Emacs Lisp, see Regexps, see Regexps and unprintable characters, see Regexps for recognizing compiler errors, see Region, highlighting a, see Regular expressions, see Remaining in the same column, regardless of contents, see Removing flashing Gnus messages, see Removing yourself from GNU mailing lists, see Repeating commands many times, see Replacing highlighted text, see Replacing newlines, see Replacing strings across files, see Replacing, and case sensitivity, see Replies to mail/news, inserting a prefix character, see Replying only to the sender of a message, see Reporting bugs, see Resources, X, see RET, definition of, see Retrieving and installing Emacs, see Retrieving the latest FAQ version, see Richard Stallman, acronym for, see Right-to-left alphabets, see Rmail and /usr/spool/mail, see Rmail munged my files, see Rmail thinks all messages are one large message, see Rmail, replying to the sender of a message in, see Rmail, sorting messages in, see RMS, definition of, see Rolodex-like functionality, see S Saving a copy of outgoing mail, see Saving at frequent intervals, see Saving multi-part postings in Gnus, see Scrolling horizontally, see Scrolling only one line, see Searching for newlines, see Searching for unprintable characters, see Searching without case sensitivity, see Security with Emacs, see Selectively displaying #ifdef code, see Self-paced tutorial, invoking the, see Semitic alphabets, see Sender, replying only to, see Sending mail with aliases, see SERVICE, description of file, see Set number capability in vi emulators, see Setting the included text character, see Setting X resources, see sh-mode, see Shell buffer, echoed commands and ‘^M’ in, see Shell mode, see Shell Mode, and MS-Windows, see shell-mode and current directory, see shell-mode exits, see Show matching paren as in vi, see Single space following periods, see Slow catch up in Gnus, see Slow connections causing flashing messages in Gnus, see Snail mail address of the FSF, see Snail mail, ordering Emacs via, see Software patents, opposition to, see Sorting messages in an Rmail folder, see Source code, building Emacs from, see Sources for current GNU distributions, see SPC file name completion, see SPC, definition of, see Spell-checker, see Spelling, checking &tex; documents, see Spelling, checking text documents, see Spontaneous entry into isearch-mode, see Stallman, Richard, acronym for, see Starting Gnus faster, see Starting mail/news reader automatically, see Status of Emacs, see stty and Emacs, see Stuff, current GNU, see SUN-SUPPORT, description of file, see Supercite, see Superyank, see Supported systems, see Suspending Emacs, see Swapping keys, see switch, indenting, see Symbols generated by function keys, see Syntax highlighting, see Syntax highlighting on a TTY, see Synthetic X events and security, see T Tab length, see TAB, definition of, see TECO, see Termcap, see Terminal setup code in .emacs, see Terminfo, see Texinfo documentation, installing, see Texinfo file, printing, see Text indentation, see Text strings, putting regexps in, see Text, highlighting, see Titlebar, displaying the current file name in, see Toggling overwrite-mode, see Toolbar support, see Tools needed to compile Emacs under DOS, see TOS, Emacs for, see transient-mark-mode, see Translations for keys under X, see TTY colors, see Tutorial, invoking the, see U Unbundled packages, see underline-region, see Underlining a region of text, see Underlining, embedded in news articles, see Unix regexps, differences from Emacs, see Unix systems, installing Emacs on, see Unpacking and installing Emacs, see Unprintable characters, working with, see unrmail command, see Unsubscribing from GNU mailing lists, see Up-to-date GNU stuff, see Updating Emacs, see Updating files with diffs, see Usenet archives for GNU groups, see Usenet groups, appropriate messages for, see Usenet reader in Emacs, see Using an existing Emacs process, see V Variable documentation, see Variable-size fonts, see Version, latest, see Vertical movement in empty documents, see Very large files, opening, see vi emulation, see View Mail, see Viewing Info files, see VIPER, see Visible bell, see Visiting files takes a long time, see VM, see VMS, Emacs for, see Volume of bell, see w3-mode, see w32-bdf-filename-alist, see w32-find-bdf-fonts, see W Web browser, see Web, reading the FAQ on the, see Why Emacs?, see Windows 9X, ME, NT, 2K, and CE, Emacs for, see Windows files, editing, see Working with arrow keys, see Working with function keys, see Working with unprintable characters, see Wrapping lines, see Wrapping word automatically, see Writing and debugging &tex;, see WWW browser, see X X events and security, see X key translations, see X Menus don't work, see X resources, see X resources being ignored, see X Window System and function keys, see X Window System and iconification, see XEmacs, see Xterm and Meta key, see Y Yacc mode, see Yanking text into the search string, see