[ Combined Document ] | Contents | Previous | Next

How do I unpack the distributions?

Open a command prompt (MSDOS) window. Decide on a directory in which to place Emacs. Move the distribution to that directory, and then unpack it. If you have the gzipped tar version, first use gunzip to uncompress the tar file, and then use tar with the "xvfm" flags to extract the files from the tar file:

% gunzip -c -d emacs.tar.gz | tar xvf -

(Note: Apparently the alpha version of gunzip cannot handle long file names, so you will need to rename the file to something like "emacstar.gz" before uncompressing it.)

The "-d" flag forces gunzip to decompress (its behavior depends upon the case of the name of the executable, and sometimes it doesn't recognize that it is really gunzip), and the "-c" flag tells it to pipe its output to stdout. Similarly, the "-" flag to tar tells it to read the tar file from stdin. Unpacking the distribution this way leaves the distribution in compressed form so it takes up less space.

You may see messages from tar about not being able to change the modification time on directories, and from gunzip complaining about a broken pipe. These messages are harmless and you can ignore them.

If for some reason you also want to have the tar file gunzipped, then invoke gunzip without the -c option:

% gunzip -d emacs.tar.gz

If you have the zip version, use unzip with the "-x" flag on all of the .zip files (note that you cannot use pkunzip on these files, as pkunzipwill not preserve the long filenames):

% unzip -x emacs-_1.zip
% (repeat for the remaining .zip files)

You can find precompiled versions of all of the compression and archive utilities in ftp://ftp.gnu.org/gnu/windows/emacs/utilities (ftp mirrors).

How do I install Emacs, after unpacking?

After unpacking the archive there's very little left to do, you have the choice of:

If you run "addpm.exe", and answer OK to the message box that pops up then GNU Emacs will be added to your start menu, and certain registry keys will be created for you. This isn't compulsorary as in previous releases - so the choice is yours.

What do I do if Emacs does not work?

See the section below on troubleshooting Emacs if, after downloading a precompiled distribution and unpacking it according to the instructions above, you have trouble running Emacs.

How do I customize Emacs?

 At its core Emacs contains a Lisp interpretter, this engine is used to implement most of the core functionality of Emacs.

 To customize Emacs mostly involves writing extra functions in Lisp, or changing variables that affect the behaviour which is already present.

 Emacs reads a file ".emacs" when it starts up, this is where it expects to find any customizations that you have made.

What is a .emacs file?

When Emacs starts up it attempts to load, and execute the contents of a file called ".emacs", or "_emacs". This file is where all the customizations are saved, and restored from when you restart Emacs. All of these settings are stored as Lisp expressions, for a general introduction to Lisp you could see : http://cons.org, more Emacs Specific information can be found in the Emacs Lisp Manual.

Where do I put my .emacs, (or _emacs), file?

Your startup file can be named either _emacs or .emacs, and should be placed in your "home" directory. If you have both files in your home directory, Emacs will load the .emacs file and ignore _emacs.

Your home directory is where the HOME configuration variable tells Emacs it is. As with the other Emacs configuration variables, HOME can be set in a number of ways:

If Emacs cannot find HOME set in any of the above locations, it will assume your HOME directory is "C:/".

The directory specified by HOME is also the directory substituted for tildes (~) in file names used in Emacs (so, by definition, you can always load your startup file in Emacs by doing C-x C-f "~/.emacs").

Troubleshooting: If you've set HOME to a directory using one of the above methods, and Emacs still doesn't load your startup file, the first thing you should do is check to see what Emacs thinks HOME is set to. You can do this by evaluating the following expression in the *scratch* buffer using C-x C-e:

(insert (getenv "HOME"))

Look carefully at what is printed and make sure the value is valid. For example, if the value has trailing whitespace, Emacs won't be able to find the directory. Also, be sure that the value isn't a relative drive letter (e.g., "d:" without a backslash); if it is, then HOME is going to be whatever the current directory on that drive is, which is likely not what you want to happen.

Sample .emacs Files

Ingo Koch <ingo.koch@ikoch.de> maintains a web site of sample .emacs files contributed by various users. His site is at http://www.dotemacs.de/.

There is also a small selection of sample .emacs files available at http://www.dotfiles.com

How can I have Emacs prompt me before closing?

If you would like to have Emacs prompt you before closing, add the following to your startup file:

(setq kill-emacs-query-functions
      (cons (lambda () (yes-or-no-p "Really kill Emacs? "))

How do I associate files with Emacs (i.e., use Emacs as a server with gnuserv/gnuclient)?

You can use a package like gnuserv to associate files with Emacs so that opening a file outside of Emacs (e.g., by double-clicking on its icon) will create a new frame in a running Emacs displaying that file. Peter Breton <pbreton@dirac.i-kinetics.com> originally ported a version of gnuserv to NT that used named pipes, and Nico Francois <nico.francois@ping.be> has continued development on gnuserv since. It now works on both NT and Windows 95, and has a number of useful features.

Also, be sure to place the gnuserv executables in your path (or modify your path or Emacs' exec-path to include them), and be sure that runemacs.exe is in your path if you use gnuserv to launch Emacs.

Note that you can set up file associations in Windows 95/98/NT 4.0 using Explorer by selecting the "View->Options..." menu operation, and then clicking on the "File Types" tab in the dialog that pops up. Clicking on a file type will allow you to edit it and associate the file with gnuclient.exe.

Warning: Be sure to quote the %1 in the association so that filenames with blanks in them are treated as one argument when sent to Emacs, e.g.:

C:\bin\gnuclientw.exe "%1"

[Discussion of other problems and solutions]

Controlling the use of frames

By default, gnuserv will load files into new frames. If you would rather have gnuserv load files into an existing frame, then evaluate the following in the chosen frame:

(setq gnuserv-frame (selected-frame))

Placing the above in your startup file, for example, will have gnuserv load files into the original Emacs frame. Note: one drawback of this approach is that if the frame associated with gnuserv is ever closed, gnuserv won't have a frame in which to place buffers.

For use with Internet Explorer

You can use Emacs as the editor for composing mail for mailto: links, reading news for news: links, and editing HTML files in Internet Explorer. You first need to install the gnuserv utilities above, and then modify or create the following registry entries using regedit:


Key: HKEY_CLASSES_ROOT\mailto\shell\open\command(Default)
Value: gnudoit -q (message-mail (substring \"%1\" 7))
Key: HKEY_CLASSES_ROOT\news\shell\open\command(Default)
Value: gnudoit -q (gnus-fetch-group (substring \"%1\" 5))
Key: HKEY_CLASSES_ROOT\htmlfile\shell\edit\command(Default)
Value: gnuclientw %1

Thanks to Jason Rumney <jasonr@gnu.org> and Sigbjorn Finne <sigbjorn@cse.ogi.edu> for these tips.

For use with Netscape

You can use Emacs to view document source from Netscape 3.1. First install the gnuserv utilities, and then edit the Preferences->Apps tab. In the "View Source" field, enter "gnuclientw.exe". Amy Abascal <vhchelp@wsos.com> describes what to do with Netscape 4.

I don't know of any way to have Netscape use Emacs for mailto: and news: links as with IE above.

PIF file for gnuserv

Jerrad Pierce <belg4mit@mit.edu> has packaged together a PIF file and batch file for associating Emacs with file-types via gnuserv.

How do I use find-file to load files that are on the desktop?

Files that you add to the desktop are stored in a directory somewhere under your Windows directory. On NT 4.0, this directory is %USERPROFILE%\desktop (in other words, c:\winnt\profiles(user)\desktop if you installed NT in c:\winnt).

How do I make the active window follow the mouse?

 If you're running Emacs in a windowing mode, and not in the console you may use a package called follow-mouse to make the current frame, or buffer the one with the mouse over it.

Find it here.

How do I swap CapsLock and Control?

CapsLock and Control cannot be swapped from within Emacs, and Windows does not have a convenient mechanism like xmodmap to change virtual key bindings. Instead, new keyboard layouts or device drivers can be installed, or the registry can be modified, to swap the two keys.

WARNING: If you use a new keyboard layout to switch CapsLock and Control, beware of the option to use hotkey sequences to switch keyboard layouts. This option is in Control Panel->Keyboard under the Language (Windows 95) or Input Locales (Windows NT) tabs; the sequences themselves are "Left Alt+Control" and "Ctrl+Shift". If you enable one of these options, then you will likely at some point switch keyboard layouts while trying to use an Emacs key combination.

NT 4.0:

NT 3.5, 3.51: James Kittock has provided a program for NT that installs a new keyboard layout with the two keys swapped. Once installed, you can then select it using the "International" control panel applet. Windows 95: Microsoft has placed a keyboard remapping program for Windows 95 on their ftp site (keyremap). For more info, take a look at their Kernel Toys page.

Mark Russinovich has also written a freeware VxD that swaps CapsLock and Control under Windows 95. (I've been told that you might have to hit the real Control key once after installing the VxD to jumpstart the mapping.)

Windows 98: I've been told that the Windows 95 keyremap utility also works on Windows 98, despite the warnings on the web page.

How can I modify Emacs to be more like a Windows app?

 There are several differences in the way in which Emacs behaves compared to a standard Windows application, however most of the functionality is already present within Emacs, its just a matter of enabling it.

Keypad keys, highlighting selections, etc.

Some behaviors typically found in other Windows apps, such as deleting typed-over highlighted selections, are not configured by default in Emacs. You can, however, enable them by loading various packages. If you would like to highlight the region between the point and the mark, see the help text for transient-mark-mode; if you would like highlighted selections to be deleted when you type over them, see the help text for delete-selection-mode; if you would like to change the semantics of keypad keys such as "home" and "end", see the help text for pc-selection-mode.

Standard Windows application keymaps (C-c, C-v, C-x, etc.)

If you are used to standard Windows application keybindings, such as C-c for copy, C-v for paste, and C-x for cut, or selecting text with <shift>-movement, then you probably want to use Kim Storms <stormware@get2net.dk> CUA-mode.el.

Window operations (maximize, minimize, etc.)

As of Emacs 20.4.1 there is native support for maximizing, and minimizing the Emacs window from Lisp, the following functions will do the job for you:
  (defun w32-restore-frame ()
    "Restore a minimized frame"
     (w32-send-sys-command 61728))

  (defun w32-maximize-frame ()
    "Maximize the current frame"
     (w32-send-sys-command 61488))

Open File dialog box

Binu Jose Philip <binu@teil.soft.net> has written the dlgopen package to use the Windows Open File dialog box for opening files. Download dlgopen.zip, unpack, and read the top of the dlgopen.el file for directions on using the package.

How do I uninstall Emacs?

The only thing that Emacs changes in your system is the registry (if you used addpm to install it). Emacs does not, for example, install any files in your system directory. If you don't mind the registry settings remaining in the registry, then you don't need to do anything to uninstall Emacs.

If you want to remove the registry settings, then you can use the regedt32 program to remove the Emacs registry keys. Depending upon what kind of permissions you have, the registry entries could have been installed in either HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs or HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs.

When I run Emacs, nothing happens. Whats the deal?

Emacs could have failed to run for a number of reasons. The most common symptom is that, when Emacs is started, the cursor changes for a second but nothing happens. If this happens to you, it is quite likely that the distribution was unpacked incorrectly.

Check for the following to see if there was a problem during unpacking:

  1. Be sure to disable the CR/LF translation or the executables will be unusable. Older versions of WinZipNT would enable this translation by default. If you are using WinZipNT, disable it.
  2. Check that filenames were not truncated to 8.3. For example, in Emacs 19.34.6 there should be a file lisp\term\win32-win.el (it has been renamed to w32-win.el in Emacs 20); if this has been truncated to win32-wi.el, your distribution has been corrupted while unpacking and Emacs will not start.
  3. I've also had reports that the GNU Windows port of tar corrupts the executables. Use the version of tar on my ftp site instead.

If you are in doubt about whether the utilities you used unpacked the distribution incorrectly, use the gunzip, tar, and unzip executables provided in the utilities directory. These are the ones I use to create and test the distributions. My advice would be to use these utilities from the start.

If it is still not working, send mail to the list, describing what you've done, and what you are seeing. (The more information you send the more likely it is that you'll receive a helpfull response..

I just upgraded the operating system, and Emacs no longer works.

I have received reports that, after upgrading the operating system (e.g., from NT 3.51 to NT 4.0), an installed Emacs will start but will not accept keyboard or mouse input. Apparantly, running addpm.exe as described in the installation section above fixes the problem.

I use anti-virus software. What problems can this cause?

Some anti-virus software seems to interact badly with older version of Emacs, these programs shouldn't cause any problems if you are running a version of Emacs newer than 20.3.

Dr. Solomons

A number of users have reported that Dr. Solomon's WinGuard prevent shell-related commands from working properly within Emacs. Turning off "Scan all files" makes it work, though.


A similar report from Charles Curley. <ccurley@wyoming.com> It has also been reported that you only need to select "Programming Files Only" instead of "All Files" to prevent Emacs from hanging.


A third report from Peter Haas about Norton Antivirus 2000 (Emacs 20.5.1, Win98): a DOS shell cannot be started within Emacs without disabling the antivirus autoprotect feature (e.g., clicking on the icon in the system tray).

Does Emacs contain a virus?

 There have been reports from some people that the McAfee virus scanner, (versions unreported), claims that the latest version of NTEmacs contains a virus.

 Assuming that you are downloading from the official gnu.org site, then these are false positive's which you might see in the following files:

 These warnings seem to be artifacts of the way in which Emacs is built - the process of compiling a program, then using a "dumping" process to ensure that things are pre-loaded in the emacs.exe executable - and can be safely ignored.

 To remove these warnings, update your virus scanner to the latest version.

Sometimes when I exit Emacs, my machine hangs or crashes immediately.

Have you installed an Iomega Zip drive recently? The Iomega driver and Emacs appear to have a conflict that causes this crash. At present, the only solution is to disable the driver, reboot, and then use Emacs normally. To do this, look in the Startup folder (inside the Programs folder in the taskbar), locate the Iomega-related programs, and move them to a different folder. Then reboot. Emacs will work normally. If you want to use the Zip drive, manually execute the Iomega programs you moved. Then reboot before you use Emacs again. It's not convenient, but at least ou won't crash. Thanks to Will Duquette for this information.

How does Emacs determine the name of my computer?

Emacs initializes the variable "system-name" with the name of your computer upon startup. However, Emacs uses two different methods for determining the computer name depending upon whether Winsock is loaded by default when Emacs starts up. If Winsock is automatically loaded, then Emacs uses gethostname, otherwise Emacs uses GetComputerName. Alternatively, you can override all of this by explicitly setting system-name in your startup file (also look at user-mail-address for composing mail messages).

By default, Emacs does not automatically load Winsock because doing so will cause Winsock to establish a connection to the network. If you are connected to a LAN, then nothing will happen, but if you dialup to an ISP then invoking Emacs (thereby loading Winsock) will prompt you to unexpectedly dialup to your ISP.

You can have Emacs automatically load Winsock by defining the environment variable PRELOAD_WINSOCK. You can set it to an arbitrary value; Emacs just checks to see if it is defined. Similarly, you can create a registry entry PRELOAD_WINSOCK with the other Emacs registry entries (in HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs or HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs), which will do the same thing.

[ Combined Document ] | Contents | Previous | Next
Steve Kemp, FAQ Maintainer
Translate this page into