Editor Wars

Normally, I use vi for most of my editing work. But, I’ve been hearing much about emacs and its ability to do a better job at syntax highlighting, code completion, spell checking, even a writegood-mode for detecting passive voice. Emacs might be a pretty good editing OS, but it doesn’t come with an editing language. Here’s what I mean:

The beginning of understanding the Zen of Vi comes when you realize that you are not memorizing key-bindings, but rather, you are learning a language.

What a beautiful concept! You are not memorizing that “d$” means “delete from here to the end of the line”. You are instead learning how to tell Vi that you want to delete (“d”) from here to the end of the line (“$”). The operation command, “d”, can be seen as a verb, while the target of the operation, the end of the line, “$”, can be seen as the object.

Because these are “movements” they can also be used as subjects for other “statements.”

Searching forwards or backwards are movements in vi. Thus they can also be used as “subjects” in our “statements.”

In addition to “verbs” and “subjects” vi also has “objects” (in the grammatical sense of the term).

This notion of “prefixes” also adds the analogs of grammatical “adjectives” and “adverbs’ to our text manipulation “language.” Most commands (verbs) and movement (verbs or objects, depending on context) can also take numeric prefixes.

I can’t help but think, that for all the verbiage spilled about how Lisp encourages solving your problem in a domain specific language you create just for that purpose[Clementson’s Blog, The Lisp Difference, John Foderaro, Lisp is a Chameleon, Paul Graham, Beating The Averages] How did this concept of an editing language elude the author of Emacs?

So I read what RMS had to say about Emacs’s beginnings. It didn’t start out with Lisp, but rather was an interpreter written for TECO, which itself did have an editing language. But RMS describes it as “extremely ugly …, as ugly as could possibly be.” After adding several extension to TECO RMS observes “the language that you build your extensions on shouldn’t be thought of as a programming language in afterthought; it should be designed as a programming language. In fact, we discovered that the best programming language for that purpose was Lisp.”

I’m still flummoxed. Why, after seeing that TECO was an editing language, were the Emacs commands not created likewise? Why is delete-char a separate keystroke, rather than a command followed by a command? Why are Emacs movement commands flung over the keyboard according to name, rather than position? If you find you need Lisp to design an extension language, why didn’t you also see that editing itself should be a language? Why did this not escape Bill Joy, who was implementing vi in C, so that it could be used over a 300 baud modem?