Making GNU Emacs play well on Microsoft Windows 7
Posted: - Modified: | emacsEmacs 24 has been released, hooray! Here’s how you can download and install it on Windows 7. Bonus tip: pin it to your taskbar so that you can open Emacs easily.
Step 1. Get the Emacs zip file from http://ftp.gnu.org/pub/gnu/emacs/windows/ . You’re looking for something like emacs-24.1-bin-i386.zip, or whatever the latest version is. Download and extract the files. I like extracting it to C:\ and renaming the new emacs-24.1 directory to c:\emacs so that I can get to it easily. I’ll assume you’re renaming it too, but if you prefer to keep your Emacs installation elsewhere, just translate the rest of these instructions.
Step 2. Add Emacs to your path. This way, you can start Emacs or emacsclient from anywhere. To change your system path, click on the Windows logo, right-click on Computer, and choose Properties. Click on Advanced system settings, then click on Environment Variables.
If you see a Path variable under User variables, click on it, then click on Edit. Add c:\emacs\bin
to the beginning of this path, separating it from the next item with a semicolon. Click OK.
On the other hand, if you don’t see a Path variable under User variables, click on New and add it. The variable name should be Path
and the value should be c:\emacs\bin
. Click OK.
Step 3. While you’re here, you might as well set your Home variable. This is what Emacs will use whenever you refer to ~, or the home directory. To set that, look under User variables and click on New. Create a variable called HOME
, and set the value to whichever directory you would like to use as your home directory. For example, I’ll set mine to c:\sacha. Again, click on OK, then click OK a few more times until you’re done with the System Properties dialog box.
Step 4. All right, let’s start up Emacs! Click on the Windows icon, and type runemacs
at the Run prompt. You should see runemacs in the list. If you don’t, you may need to log out and log in so that your new path settings are applied. Once you’ve sorted that out, start runemacs
. You should see Emacs open, yay!
Step 5. Want to be able to start up and switch to Emacs quickly? To pin Emacs to your task bar, right-click on the Emacs icon in the task bar. Right-click on the small Emacs icon that appears, and click on Properties. Change the target to c:\emacs\bin\runemacs.exe
, and change the start directory to whichever directory you prefer. You can also choose to start it maximized – handy. Once you’ve set that up, click OK. I like dragging the Emacs icon so that it’s the very first item in my task bar. That way, pressing the Windows key and the number 1 at the same time lets me switch to Emacs and away from Emacs easily.
That’s it. Check out http://planet.emacsen.org for lots of other Emacs bloggers. Happy editing!
11 comments
Ronnie Holm
2012-06-25T22:24:39ZOne possible issue with Step 3 and 4 is that HOME is now set for any application. Depending on which other Unix-type applications you're running, this can be an annoyance. What I do instead is create a shortcut with this destination:
C:\Windows\System32\cmd.exe /C "set HOME=E:\Shared\Software\emacs-24.1&&E:\Shared\Software\emacs-24.1\bin\runemacs.exe"
I've described this in a bit more detail here, together with my simple .emacs file:
http://www.bugfree.dk/blog/...
Sacha Chua
2012-06-25T22:50:43ZRonnie: Thanks for sharing that! Handy tip.
Raymond Zeitler
2012-06-26T20:58:38ZI plan to upgrade on July 2, but I've already downloaded the binary.
Step 2 (modifying PATH) isn't necessary if you use only shortcuts to invoke Emacs.
I was going to ask how you use Tag completion in Org. But I just figured it out. By default the keystroke is M-. But as this is the key Windows uses to switch applications, it's not available to us. Instead, Emacs will accept C-i for , so C-M-i works.
Ciaran Mulloy
2012-07-19T10:12:35ZMany thanks for the useful information provided in the above article.
I am trying to work out to replicate the ease of working in Windows (from time to time) that I enjoy in Linux.
On installing the zip file in your chosen windows folder if you execute the program 'addpm' which is located in the 'bin' subdirectory of the emacs-24.1 folder this will then add the emacs icon into the program listing (creates a folder called Gnu Emacs containing the Emacs executable). It's then possible to right click on the executable icon and pin it to task bar or start menu as required.
Abhishek L
2013-04-16T15:00:44ZI have most of this set, except for step2 on setting %HOME%. Here I use site-start.el to setenv HOME to a location like <myrootdir>/home the advantage being that this thing can be conveniently carried in a usb stick without having to worry about Home environments elsewhere. However tramp seems to somehow expand remote filenames to user@localhost:C:/ , though it works perfectly out of the box if HOME is not set though.
Mark Lewin
2013-05-17T10:08:02ZGreat to see someone posting about Emacs under Windows. In case it helps anyone, I was unable to get the emacs Window to maximize until I put this in my .emacs file:
;; Maximizes Emacs in Windows
(w32-send-sys-command #xf030)
sachac
2013-05-17T16:12:21ZYeah, Windows gets no love... <laugh>
Ooh, that's great. Thanks for sharing! =) It turns out there are more w32 sys commands on EmacsWiki - hmm, interesting...
Darren Irvine
2014-05-03T22:04:58ZThanks for the start.
Enigma0
2014-08-31T04:48:57ZThanks, Sacha. Maybe enjoy a good September weekend at Wasaga Beach? enigmaprime1@hushmail.com
Win7 acts oddly with emacs, blaring a 'security warning' and demanding an admin logon when emacs is started independently. Yet if I select emacs to edit a file, then no 'warning'.
Clayton Cramer
2016-05-23T02:13:04ZThank you. Very helpful. I have been using emacs on Unix since the 1980s and I find it too useful to give up.