GNU Emacs on MS Windows

There are several distributions of binaries of Gnu-Emacs for MS-Windows to choose from, see CategoryWThirtyTwo#toc1.

There are two general flavours: native Windows and Cygwin builds. The have drawbacks as detailed below, so the guidelines here are only about the native Windows builds.

The latest stable version is 26.1. There are also snapshot versions, which are builds of the code currently under development (i.e., having newer features, and possibly more bugs). The current development version is 27.0.50 (snapshot versions always have a large 3rd number).

Guidelines for installing Emacs on MS Windows

To install the official stable binaries:

Visit https://ftp.gnu.org/gnu/emacs/windows/emacs-26/ (or https://ftpmirror.gnu.org/emacs/windows/emacs-26 to use a nearby mirror). Download the last zip-file ending in x86_64.zip for 64 bit or i686.zip for 32 bit listed (currently emacs-26.1-x86_64.zip and emacs-26.1-i686.zip, respectively). You might also want to read the README file at the same site (not the one inside the zip-file). Once the zip-file is downloaded, open it using Explorer (slow) or 7zip (faster) and extract all the files into a directory of your choice (e.g. c:\packages\emacs-26.1).

To install the official snapshot binaries:

Visit https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-27/. Download the installer.exe with the latest date (again with x86_64 and i686 indicating 64 bit or 32 bit, respectively). As of this writing, those are emacs-27.0.50-snapshot-2018-05-03-x86_64-installer.exe and emacs-27.0.50-snapshot-2018-05-03-i686-installer.exe. Run the executable to extract the Emacs installation into the directory of your choice. Alternatively, you can download snapshots in zip format, like for the stable release.

If installing the snapshot “emax64” version from SourceForge:

Visit the site https://ntemacs.sourceforge.io/ and download the .7z file marked “binary” near the bottom. Once downloaded, unzip it to a directory of your choice (e.g. c:\packages). A directory named emaxw64 will be created therein.

A subdirectory of the one just created will be bin (e.g. c:\packages\ntemacs23\bin). Enter this bin-directory and run addpm.exe (takes only a second). A shortcut to .../bin/runemacs.exe will be created in the Start Menu (Programs -- Gnu Emacs – Emacs). If you are using Vista you must run addpm.exe as an administrator, otherwise the registry entries will not be created.

Problems with Cygwin distributed Emacs

There are three versions of Gnu-Emacs distributed with Cygwin, 21.2.12, 21.2.13 and 22.1.3. All of these have (some) drawbacks. Without X-Windows they only run in the bash-command window where started, and at least in some settings the Window painting is garbled. To enable Emacs running in its own window one must install X-Windows, and in addition open an /xterm/-window and start Emacs from there. The xterm-window does not honour national keyboards (at least without some twitching).

Setting up Emacs on MS Windows

This section describes two of the more important steps for setting up Emacs on MS-Windows: The home directory and the starting directory. In addition, MS-Windows users may want to change the initial size and position of the Emacs window, the font and colours used, the indentation behaviour when editing programs, the behaviour of regions selected with the mouse, and last but not least they may want to redefine keyboard shortcuts to be more like what is traditional in MS-Windows. Customization of these features is described in MsWindowsCustomize.

When run by selecting the shortcut, by default Emacs starts in the bin subdirectory of the installation folder. When started from a command line, it starts in the current directory. In both cases, the home directory (aka ~, where customization files are read from, in particular the .emacs file) is set to C:\Documents and Settings\user\Application
Data (on Vista it is set to C:\Users\user\AppData\Roaming). It is possible to stick with this default behaviour and place customization files in Application Data, but here it is assumed that the default is changed. To take an example assume that Cygwin has been set up and the user’s home directory for Cygwin is c:\cygwin\home\smith (or cygwinized: /home/smith). It might be natural to make this the home directory for Emacs and make it start there (in the following replace smith with your username).

Changing the directory where Emacs starts: Right-click on the icon (shortcut) used to start Emacs, select Properties, and type c:\cygwin\home\smith into Shorcut -- Start in.

Setting the home directory: Select My Computer -- Advanced -- Environment variables -- System variables -- New and enter HOME as the variable name and c:\cygwin\home\smith as its value. See also MsWindowsDotEmacs.

Setting the home directory on Vista: Open the Control Panel. If you are using Classic View open User Accounts and then select Change my environment varaibles from the Task Pane. If you are using the default view of Control Panel, you have to select User Accounts and Family Safety before you can select User Accounts. Either way, set up the HOME environment variable as described above. See also MsWindowsDotEmacs.

Integration with Windows Shell: If you’re using Win7 or later and Emacs24, check out EmacsMsWindowsIntegration for how to start Emacs from a shortcut, use it to open file types, etc.

This work is licensed to you under version 2 of the
GNUGeneral Public License.
Alternatively, you may choose to receive this work under any other
license that grants the right to use, copy, modify, and/or distribute
the work, as long as that license imposes the restriction that
derivative works have to grant the same rights and impose the same
restriction. For example, you may choose to receive this work under
the
GNUFree Documentation License, the
CreativeCommonsShareAlike
License, the XEmacs manual license, or
similar licenses.