Saturday, January 20, 2007

First, a bit of history.

I started using GNU Emacs in 1990. The latest version at the time was version 18. It had almost no support for menus, the mouse, fonts, colors, dialog boxes, drag & drop, etc. It was basically a text-only application. In these respects it was a step back from the editors I had been using in DOS, Windows, Mac, and OS/2. However, Emacs was what people used at school, and I needed to use it for some of my classes, so I learned it. I found that it was quite powerful, and I learned how to customize it to match my needs better. One of the things I liked best was automatic indentation. When you press Tab it will indent the line correctly based on what you're typing now and what you had typed earlier in the file. I want this on every line. Most of my classmates press Return and then Tab every line. I'm too lazy for that, so I changed Return to do the indentation (for Emacs users among you: (global-set-key "\r" 'reindent-then-newline-and-indent) does the trick). So now whenever I typed normally, it would automatically indent each line properly. A simple change but it made a big difference, and it encouraged me to learn more about Emacs customization.

I was still annoyed by the lack of colors, though. Colors in particular are quite useful when programming, because they can be used to highlight langauge constructs (keywords, punctuation, identifiers, expressions, definitions, etc.). It makes programs easier to read, and you can quickly spot errors as you type them because they show up in the wrong color. My classmates who had never used non-Unix editors had no idea what they were missing, but I did, and I kept looking for a way to have colors in Emacs. It was 1990, after all, six years after the introduction of Macintosh. Why should I be stuck in a black-and-white text-only world with only a single font? Ugh!

Well, Emacs 18 had come out in 1986. The Mac didn't even have color back then (but at least it had multiple fonts, which could have served the same purpose). Where was Emacs 19, I wondered, and would it have the features I wanted? As I looked around I found something intriguing: a version of Emacs called Epoch, maintained by someone named Marc Andreesen. I tried it out and I loved it. It had colors and fonts and supported multiple windows (what a concept!). I finally had a version of Emacs that gave me what I had been looking for. (Side note: Marc went on to write Mosaic, and then started a company called Netscape.)

Meanwhile, a few people were trying to work on Emacs 19, but work was apparently going very slowly, and a company named Lucid had been working on their own version of Emacs 19, called Lucid Emacs 19. Lucid's version progressed much faster than GNU Emacs 19 (thanks to Lucid's uber-hacker, Jamie Zawinski), and this was the beginning of the big split between Emacs and XEmacs. Around 1992 or 1993 I switched from Epoch to Lucid Emacs 19, and it was everything I wanted out of an Emacs system. When GNU Emacs 19 came out, I tried it, but it was missing so much. The menubar didn't match the standard Mac/Windows menubar, the scrollbar acted weird, you couldn't use multiple fonts, and lots of things in the UI seemed wrong to me. My impression was that GNU Emacs 19 had a UI designed for long-time Emacs users, and Lucid Emacs 19 was designed for the rest of us (DOS, Windows, Mac users). I stuck with Lucid Emacs, which later became XEmacs. (Side note: Jamie went on to a company called Netscape.)

While in school I found plenty of ways to procrastinate, and one of them was learning to customize my environment instead of working on my class project. I spent some time trying out and customizing window managers (twm, ctwm, vtwm, mwm, etc.), but most of my time I spent learning and customizing XEmacs. I tried out lots of extension packages and wrote my own customization. My classmates benefited from my procrastination, as I shared the best of what I had learned with them. Some of the Emacs customizations I developed back then are still in use.

Over the years I've continued to do learn, extend, and customize, and I've built up more and more XEmacs customization. A few years ago I tried running GNU Emacs, and my customization didn't work, and it didn't look easy to fix. XEmacs and GNU Emacs have diverged enough that the things I've learned for XEmacs weren't working in GNU Emacs. So I gave up on ever using GNU Emacs again.

The problem is that XEmacs development has slowed quite a bit. The “stable” version, XEmacs 21.4, came out in 2001. Features like anti-aliased fonts, support for the Mac, and UTF-8 are not available in that version. I've been using the development version, 21.5, and it has partial support for those things. One of the developers left XEmacs to work on his own version of Emacs, called SXEmacs (which looks neat). GNU Emacs on the other hand seems to be progressing faster, and is catching up in many ways to XEmacs. The stable version of GNU Emacs is also a few years old, so people who care about features run the development version (GNU Emacs 22).

The other problem is that last year, when I got a Mac, I found that none of the versions of XEmacs available on the Mac were satisfying. I tried out Aquamacs, which is GNU Emacs 22 for the Mac, and I liked it, except that none of my customizations worked. Non-Emacs editors like TextMate seem somewhat limited, and would require me to unlearn 15 years of Emacs. I had a tough choice to make: after 15 years of being on the XEmacs side of the Emacs/XEmacs split, should I switch back? After talking to several people about their experiences with both, I decided that I should at least consider it. GNU Emacs 22 seems like it has caught up with XEmacs in some ways (not all), and it's ahead of it in other ways.

I still love XEmacs. I like that it uses a package system, so you can choose packages, install new ones, and upgrade a package without upgrading XEmacs. The package system in XEmacs is somewhat like packages in popular Linux distributions. For example, I can download a new version of the Python editing package when that package is released, instead of installing it manually or waiting until a new version of Emacs is available. GNU Emacs doesn't seem to have anything like this. I like the XEmacs philosophy for colors/fonts (they are properties of how you look at a file) more than the GNU Emacs philosophy (that they are properties of the file itself). I like that XEmacs has abstract data types like hash tables. I like that XEmacs uses more readable names of key and mouse commands, like [(ctrl x) (alt tab)] instead of "C-x A-\t" . I like that the XEmacs colorization package, font-lock , was more capable than the Emacs package, hilit19 , although these days GNU Emacs also uses font-lock . I like that XEmacs had a menu structure more like other apps, although GNU Emacs seems to have adopted this too. I like that XEmacs can run as a “server”, where I can connect to it remotely and access all my open files from multiple machines (I've heard that GNU Emacs will get this at some point). I like that default XEmacs packages have historically seemed more advanced than GNU Emacs versions (for example, psgml seems much more advanced than html-helper-mode , and vm was more advanced than rmail ). I like that XEmacs came with more packages standard. I like that XEmacs supported proportional fonts and multiple sized fonts in the same document (GNU Emacs seems to do that now, but it took them ten years). I like the XEmacs experiments (embedding XEmacs inside other apps, embedding other apps inside XEmacs, GTK support, incremental garbage collector, ability to run as a window manager, embedding images inside documents). I really like XEmacs. But I want really good Mac support, nice fonts, and UTF-8 support, so I'm going to try out GNU Emacs again.

This weekend's project is to look at GNU Emacs 22 (the Aquamacs version) much more closely. I'll try porting some of my XEmacs customizations to GNU Emacs. I'll look for GNU Emacs packages that do things similar to the XEmacs packages I had been using. And over the next few months I'll use both XEmacs (at work) and GNU Emacs (at home) and see how it goes.

Labels: emacs, mac