Cherry-picking

Aug 22 2008

One of the reasons I switched jobs earlier this year is that after a year and a half of media management, I was getting excited about programming again, thanks in no small part to the joy of working with Brandon Mitchell, a smart programmer and all-around decent guy. I jumped at the chance to develop and maintain software in an academic and scientific environment.

One of the decisions I also made at the time was to change my text editor. For a programmer, the choice of editor you use to write code is a personal statement similar to the one made by participants in the Ford vs. Chevy debate, and argued over in terms that approach religious and political debates. It's not surprising, since it's where we spend so much of our time. But for the normal folks who spend most of their day in Word or Outlook, it's a little mystifying. I'll try to explain.

I decided to give Emacs another chance. I had tried it several times before, but you must realize that Emacs requires a huge time commitment to learn and use proficiently. It has a unique interface and vocabulary all its own. Emacs is not just an editor, but an entire programming environment. This makes it both an extremely powerful tool and a dangerous waste of time, as you spend time creating the "perfect" work environment, at the expense of the work you were brought in to do in the first place.

It's not a surprise that Emacs is an excellent butt of jokes. XKCD, the finest geek comic on the Internet, delivers the perfect commentary on editor wars in general, and Emacs in particular:

It's funny, trust me. But I'm burying the lede, so let's get back on track. Emacs is an old piece of software. It dates back to the mid-70s, when I was just a little boy. It's been under constant development since then, and not only is it still actively developed, there is a tremendous amount of free code out there that gives Emacs almost any capability you could want. One reason for this lively community is that Emacs itself consists of a large amount of easily mutable code built on a small, fast and more fixed core. It's designed for tinkering. Of course, so's Microsoft Word, which doesn't quite have the same community or amount of free software, even though it has far more users.

In some ways, it's because Microsoft is more interested in providing opportunities for businesses to make money selling software, which is an admirable goal. But I also think it's because changing Word's behavior is less fun and less elegant, and the people who use Word are also much less likely to attempt to learn how to change it, even if they have a strong need to do so.

Emacs itself is largely written in a form of Lisp, an even older technology than Emacs. It dates back to 1958, which makes it the second-oldest programming language in widespread use today, according to Wikipedia. But that doesn't make it a hugely popular language. Aside from Emacs and the occasional Lisp shop, there isn't a lot of Lisp development, although there has been more interest in Lisp of late. It's never gone away, in part because Lisp allows you to program practical solutions while also keeping the theory of computer science right there on your screen. It's sometimes maligned for its syntax, which is a little different than most languages and also leads to a profusion of parentheses that can be confusing if your editor isn't designed to display it properly. Once again, XKCD hits the mark:

The Star Wars reference is particularly apt in relation to Emacs customization, which for a programmer is a lot like a Jedi building his own lightsaber.

The problem with Emacs is that in order to get the editor you want, you'll probably have to write your own code, and integrate a lot of other people's code as well. It's what I did, as everyone did before me. Your Emacs will necessarily be different from mine and anyone else's, sometimes radically so.

If you use more than one computer – say, one at home, and one at work, or a laptop and a desktop – this leaves you with the problem of keeping your Emacs configurations consistent. The obvious solution, since your Emacs configuration is a bunch of files full of code just like all the other software we produce, is to put your home directory under version control. Also called source control or revision control, this is the software most programmers install right after setting up their editor and their programming language of choice. It's like an unlimited Undo on steroids, or Apple's Time Machine feature.

My version control software of choice is git, which is a much more recent piece of software, about three years old. It's quickly become the flavor of the moment and the version control of choice for some very high-profile and important projects. It's a wonderfully flexible tool.

Using both Emacs and git together made me think about their relative ages, and about how when seen in the history of tools in general they may as well have been developed on the same day. One of the largest uses of the Internet still involves reading text like this blog post. The written word has been in use for thousands of years, and it's an essential part of our daily life. Even the most sophisticated technological artifacts are designed in large part by using text – text to describe them, discuss them, define them, and finally implement them in a way that a computer can realize in a more physical way.

It's easy to look at our new computers and think about the changes to daily life, especially if you still remember when the sound of typewriters echoed in the office. I like to think about the cherry-picking of technology we do on a daily basis. I sit at my new workstation and use a cutting-edge version control system to maintain a thirty-year-old editing environment that uses a fifty-year-old computer language rooted in a technology that's been with us for about 6,000 years. It puts the novelty of the moment into perspective, and it's humbling to imagine attempting to contribute to that history in some way.