No Clean Feed - Stop Internet Censorship in Australia

HOWTO: Emacs: Windows Installation

I have deleted The GitHub repositories referred to in this post; see Clearing the deck for details.

This post is part of my HOWTO series on Emacs.

Thanks to Nigel Thorne for feedback and bug reports on this HOWTO.

Installing Emacs on Microsoft Windows is a little more convoluted than on Linux, because a lot of the functionality we take for granted on most modern Linux distros is missing from Windows.

  1. Download Emacs 22.3 from http://ftpmirror.gnu.org/emacs/windows/emacs-22.3-bin-i386.zip (this URL will find the closest GNU mirror to you).
  2. Extract the emacs-22.3 folder inside the ZIP file into your Program Files directory (Program Files (x86) on Windows 7). (I suggest using a free third-party ZIP utility like FilZip - credit to Joseph Iscaro for bringing FilZip to my attention).

    You should be left with a directory called something like C:\Program Files\emacs-22.3 that contains the following:
    bin
    etc
    info
    leim
    lisp
    site-lisp
    BUGS
    COPYING
    INSTALL
    README
    README.W32


  3. Create a per-user environment variable (instructions for Vista / Windows 7 and XP) called HOME, with the value %USERPROFILE%. Emacs uses the HOME environment variable to work out where to store your settings, and by default HOME isn't set on Windows.

    You can test that your new environment variable is set correctly by opening a Command Prompt and typing:
    echo %HOME%

    You should see something like:

    C:\Users\duncan

    ... in response.



  4. Add Emacs to your start menu by opening Program Files\emacs-22.3\bin (Program Files\emacs-22.3\bin on Windows 7), and double-clicking on runemacs.exe. Once Emacs has opened, close it, then right-click on runemacs.exe and choose Pin to Start Menu. (You could have pinned emacs.exe but then you'd get a DOS box opening every time you ran Emacs from the Start Menu).

    In the following steps, we'll get my personalised Emacs configuration and plugins from GitHub. You could skip them as I'll be going through how it all works in detail in subsequent posts, but for now if you want all the Emacs Goodness (TM) and you want it now! then you should follow these steps.





  5. Download and install Git from http://msysgit.googlecode.com/files/Git-1.6.5.1-preview20091022.exe. When installing, choose Unix line endings but accept all other defaults. (Thanks to the msysgit team for this - up until recently installing Git on Windows was a truly painful experience).
  6. Open Git Bash from the Start Menu, and enter the following commands:
    cd ~/
    git clone git://github.com/duncan-bayne/duncans_emacs.git duncans_emacs
    ln duncans_emacs/emacs .emacs
    ln -s duncans_emacs/emacs.d .emacs.d

    Note that if the git clone fails, you might be behind a firewall that prevents Git traffic; if so, try using http:// instead of git://.

With installation complete, you can now verify that all is well by running Emacs from the Start Menu (just click on the runemacs.exe shortcut we created in step 4. You should be met with a window that looks a lot like this one:

Emacs Screenshot on Windows

Now might be a good time to introduce you to your first Emacs command, save-buffers-kill-emacs, which prompts you to save any open buffers and then exits.

You can run this command by pressing Crtl-x, then Ctrl-c. Or you can run it manually by typing Alt-x then typing save-buffers-kill-emacs and pressing enter (you can use tab-completion to avoid typing the entire command).

That's all there is to it. Now that I've covered installing Emacs, I'll soon get started with the meat of the series - how to improve your productivity as a developer using Emacs.