Emacs is generally not very popular on Windows based operating systems. The default installation of Emacs leaves you with a very spartan UI and a very basic editor. However, due to Emacs’ extendibility, you can create a very powerful editor by customizing your .emacs file and making some OS specific tweaks. We will be concentrating on the latter as there are plenty of .emacs files floating around for your reference.
I have 5 simple yet useful tips below, which I have tested with a GNU Emacs 23.0.0.1 (i386-mingw-nt5.1.2600) running on Windows XP.
Most of us customize the fonts, colours and window position of Emacs. In fact, I have found that dark backgrounds are much suited to Emacs than the default light background. However, when Emacs starts up, it annoyingly shows the default fonts and colours first. As your .emacs files load, it jumps around and changes colours quite noticeably.
You can avoid this annoyance by making a simple registry modification. Create a new .reg file say set-frame-and-fonts.reg and copy paste the following lines. Open the file to add the changes to the registry. Restart Emacs and enjoy the difference!
Caveat: The lines above are my preferred colours, fonts and window positions. Your’s could be different. Please customize to your taste.
This will be indispensable once you are more used to Emacs. You will feel like opening anything and everything with it. And being the one true swiss-army-chainsaw it is, you will be delighted at the enormous no: of filetypes that Emacs supports out of the box.
This .reg file add an “Open in Emacs” option in Windows Explorer when you right click on any file. Copy the following lines to a .reg file say Add-Emacs-To-Open-Any-File.reg and open it to add the changes to the registry. Make sure that you have modified the path below to point to your emacs installation path (mine is in D: drive). The emacsclientw.exe resides in the same place where your runemacs.exe resides (right-clicking on the emacs icon, generally shows you this).
If you use Emacs a lot, you will find that you have to use the Ctrl key a lot. You might find your left thumb getting strained after prolonged use. The easiest solution for this is to reassign a less used key as the Ctrl key. Most people choose the Caps Lock key for this purpose. It is surprisingly not that much useful and soon you will forget that such a key ever existed.

Whenever I searched, I found that most people swap the Ctrl and Caps Lock keys. However, this is irritating as I might still want to use the old Ctrl key if I press it accidentally. Here is how to replace Caps Lock with the Ctrl Key.
Copy the following lines to a .reg file say replace_caps.reg and open it to add the changes to the registry. Now just reboot and you are done!
Yes, it takes some time to “unlearn” and “learn” the new key position, but trust me it’s worth the effort.
A spell checker is something I feel should be a part of any editor. Here is how to enable on the fly spell checking in Emacs.
By default, you can pretty-print all your documents directly from emacs. But this requires configuring a postscript printer. There is a nice package called Ghostscript which takes care of doing this.
Download and install Ghostscript from here say at D:\gs
Then add the following lines to your .emacs file:
Caveat: Be sure to switch to a light background color scheme before you print, else your fonts will be so light that they won’t be readable!
Bookmark this to del.icio.us | Digg | Furl | Netscape | Google Bookmarks | Technorati | reddit |
14 Responses
Giancarlo Angulo
February 21st, 2008 at 12:26 pm
1wow thanks for the tips!
James Shuttleworth
February 21st, 2008 at 6:39 pm
2Good stuff. I’m definitely going to go for the postscript printer for when I’m in Windows.
I’m a bit confused about the ctrl-key reassignment, though. Getting rid of capslock sounds like a good idea in itself, but how on earth does the normal control key make your thumb ache? I always press it with the little finger of my left hand. I’ve just tried using my thumb and it seems like it would take a contortionist to do anything that way.
James
steve cooper
February 21st, 2008 at 7:22 pm
3Great stuff! One problem with the registry files — it seems that backslashes have become un-escaped; paths should look like “c:\temp”, not “c:\temp”, which is interpreted as (”c” “:” “” “e” “m” “p”)
I got tip #2 to work using this code;
Windows Registry Editor Version 5.00
[HKEYCLASSESROOT*ShellOpen In EmacsCommand]
@=”\”C:\Program Files (x86)\Emacs\bin\emacsclientw.exe\” -a \”C:\Program Files (x86)\Emacs\bin\runemacs.exe\” \”%1\”"
steve cooper
February 21st, 2008 at 7:26 pm
4And of course, it happened in my comment, too!
What I’m trying to say (and excuse the horrible notation, but I needed to avoid all possibility that the comments would gulp what I was trying to say;
Windows Registry Editor Version 5.00
[HKEYCLASSESROOT (slash) * (slash) Shell (slash) Open In Emacs (slash) Command]
@=” (slash) “C: (slash) (slash) Program Files (x86) (slash) (slash) Emacs (slash) (slash) bin (slash) (slash) emacsclientw.exe (slash) ” -a (slash) “C: (slash) (slash) Program Files (x86) (slash) (slash) Emacs (slash) (slash) bin (slash) (slash) runemacs.exe (slash) ” (slash) “%1 (slash) “”
novaburst
February 21st, 2008 at 8:34 pm
5Do you know why the toolbar is grayed out with the new version of Emacs on Windows? It works, but it is ugly.
5 Indispensable Tips for Emacs on Windows « Guide 2 It
February 21st, 2008 at 10:21 pm
6[...] 5 Indispensable Tips for Emacs on Windows [...]
Salvador Jiménez
February 21st, 2008 at 11:39 pm
7Just a minor mistake in Tip #1
You omitted the “\” in:
[HKEYCURRENTUSER\SOFTWARE\GNU\Emacs]
thanks.
Dimitry Gashinsky
February 22nd, 2008 at 2:59 am
8Edi has good tips about emacs on W32 and other useful things: http://weitz.de/win/#emacs
Adding GNU Emacs to Explorer’s right-click menu in Windows XP « Computer bits & bobs
March 6th, 2008 at 7:36 am
9[...] Adding GNU Emacs to Explorer’s right-click menu in Windows XP Posted in Uncategorized by BKB on March 6th, 2008 Thanks to this blog post and the comments by Mr Steve Cooper, I was able to work out a script which adds GNU Emacs capabilities to the right click menu in Explorer (the Windows file manager). Save the following file as “EmacsToRightMenu.reg” (or any other file name ending in “.reg”) then click on it, and it will add GNU Emacs (in the form of Emacsclientw) to your right click menu on Windows. [...]
BKB
March 6th, 2008 at 7:48 am
10Tip number two was very useful for me. Thanks also to Steve Cooper for his detailed explanation with (slash) which helped me a lot.
By the way, you can do tip number one all in .emacs:
(add-to-list ‘default-frame-alist ‘(background-color . “dark blue”)) (add-to-list ‘default-frame-alist ‘(foreground-color . “sky blue”)) (add-to-list ‘default-frame-alist ‘(cursor-color . “orchid”))
Arun bhai
June 10th, 2008 at 3:19 pm
11@steve cooper:
Thanks for your feedback, most of the code was mangled because of the way Wordpress formatted the text. I have used a code highlighter plugin now. Hopefully there are no bugs in this because they are copied from my working emacs installation
Emacs Tip: A Key to open the Current Folder in Windows at ArunRocks
June 10th, 2008 at 3:52 pm
12[...] If the over-descriptive title was not enough, this is another one of my tips to use my favorite editor - Emacs. Some of you really liked my earlier post on Emacs tips on Windows, so here is one more tip to improve your productivity. [...]
Carsten
November 8th, 2008 at 11:55 am
13Thanks for the “Open everything with emacs” tip! Makes my life so much easier!
kill registry
November 18th, 2008 at 2:53 pm
14Seriously, KILL REGISTRY - why would ANY sane developer hook their app into the registry?
I don’t care if windows uses a registry, feck off!
Also, I want to pass the .emacs file to load into runemacs.exe, but fecked if I can find sheeet about it online.
RSS feed for comments on this post · TrackBack URI
Leave a reply
Categories
Recent Posts
Recent Comments
Meta
Bookmarks
My Twitter
Subscribe by Email
ArunRocks is proudly powered by WordPress - BloggingPro theme by: Design Disease