Saturday, December 25, 2004

I'm typing this from the sixth planet of the Hoth system.

I installed GNU Emacs on my laptop the other day and I'm beginning to understand like what adulterers feel like. (This is just a temporary experiment gVim honey, I promise, just for the short duration that I feel like learning Lisp, it'll pass.)

Now initially, I had installed both GNU Emacs and XEmacs but I quickly uninstalled XEmacs. Now why would I do? Especially considering that XEmacs:

  • Installed easily and more cleanly on Windows

  • Seemed to have a much more polished UI with a functional toolbar and a tab bar for open buffers

  • Seemed to have a better menu design etc. etc.

Well, XEmacs took a while to start up, even on my AMD Athlon XP, with 512Mb RAM. That was enough to uninstall it. I mean, the only editor that's allowed to take that long to load up is Microsoft Word. Besides why would I install a polished Open Source product and rid myself of all the pleasure of tweaking around with a crappy one?

Anyway, now I can begin my nice little rant about how crappy GNU Emacs is compared to gVim and how to tweak it to make it better.

Let's begin with how GNU Emacs doesn't seem to understand anything at all about setting up a profile in the correct directory on Windows. (Actually Vim doesn't setup a profile in the correct directory by default too, but at least it will read off a profile in %USERPROFILE%.) Note to all Open Source developers: Windows doesn't ship with a %HOME% variable. Your options are %USERPROFILE% or %APPDATA%. %USERPROFILE% will be a easily accessible path, while %APPDATA% is typically a hidden folder. After running addpm.exe, a user has to manually add a key called HOME with his path in it, inside HKEY_CURRENT_USER\Software\GNU\Emacs.

Let's move on to changing the default font. I tend to use Bitstream Vera Sans Mono as my default monospace font. So it's time to manually create a _emacs file in %USERPROFILE% and add the following lines to it.
;;; Set various font options for Win32

(setq w32-enable-italics t)
(set-default-font "-*-Bitstream Vera Sans

After doing that and restarting Emacs, you realize that Emacs doesn't seem to be using Windows XP ClearType rendering. (ClearType is sub-pixel font rendering for laptops and LCD displays which really improves the clarity of type on screen.) A quick Google reveals that the ClearType rendering mode on Emacs is disabled thanks to political issues with Microsoft i.e. due to unclear documentation from Microsoft. (Does anybody else except me see the irony in this?). gVim seems to have no problems using ClearType.

Now to install some keyboard shortcuts which are familiar to anyone who started on Win32. (Read: Mostly everyone). (These come preinstalled in gVim.) Stuff I needed to change was the familiar C-X, C-C and C-V for cut, copy and paste. C-Tab for next buffer, C-S-Tab for previous buffer and C-f4 for close current buffer. To achieve the clipboard stuff, you need to install the CUA mode for Emacs ( I also needed to set tab length = 4 and turn on syntax highlighting by default. Add the following lines to _emacs to achieve the all of this.
;;; Enable CUA mode

(require 'cua)
(CUA-mode t)

;;; Set some Win32 keybindings
(global-set-key [C-f4] 'kill-this-buffer)
(global-set-key [C-tab] 'bs-cycle-next)
(global-set-key [C-S-tab] 'bs-cycle-previous)

;;; Set tabs to display as 4 characters
(setq default-tab-width 4);

;;; Start global lazy font lock mode

We're not out of the woods yet though. I still haven't figured out how to install A-f4 to replace C-X C-C. Or rather I haven't figured out how to have multiple key-bindings for one command in Emacs.

And after 3 days of Emacs, RSI seems like a real threat now. And no, I don't feel like replacing caps-lock with ctrl globally on Windows. I would rather install C-` as a clone for C-X. Also, how do you get Emacs to remember the directory the last buffer was opened from? Anybody know how to do that? (No, I haven't googled for this, yes, I might in the future.)

And yes, my sincerest apologies to anyone who was offended by the sheer geekiness of this post. (Even more apologies for all the trolling, it's cold here and I've been cooped up at home.) To avoid further geeky posts like this, send hot babes to:
Madison, WI

1 comment:

Katie said...

I'm reading your blog from the beginning. Emacs? I hated that software but had to use it for running sas programs. Blek.

You are such a geek! I'm not worthy!