
A few weeks ago, Russ Cox released a tour of Acme, the Plan 9 editor written by Rob Pike. Since Acme looked so different from what I was used to, I installed Plan 9 from User Space and tried Acme out. Here are some quick thoughts on the interesting text editor. I should note that I have used Acme for maybe a week, and during that time, I was not using it exclusively, and I did not have a real mouse, only my laptop trackpad, so this certainly influenced how I perceived it.
Minimalist
If there is one adjective that comes to mind when using Acme, it’s “minimalist”. Everything about the editor is reduced to its barest minimum. The interface has no menu, no context menu, the scrollbars don’t have little arrows at both ends, the “toolbar” doesn’t use icons, but words, and the color scheme is very reminiscent of the early 1990′s. The editor is not only minimal in its interface, but also in its functionality: it has 28 commands internal commands, the rest of the functionality is provided by external programs.
From the original paper on Acme, this is by design. Rob wanted the program to be out of the programmer’s way. I don’t know if it’s my own habits using Emacs extensively, but I found that Acme was more in my way, mostly because it destroyed some of my long-held habits about editing text. The focus of the project was to make an editor, and anything else that the programmers wanted, they could write external programs and call them.
You probably won’t find anything in Acme that you don’t need, because there is so little. Also, you can probably know most of there is to know about the editor in an afternoon by reading the man page.
Absent features
I won’t call this section “missing feature”, but let’s look at some common text editor functions that Acme does without:
- Syntax highlighting: all text in Acme is black. It won’t highlight your string literals in one color and identifiers in another. Acme’s proponents claim that the colors distract them.
- Indenting according to mode: editors such as Emacs and vim allow for automatic indenting that is done according to the style of the languages they support. In Acme, automatic indentation simply copies the indentation of the line above. If you want to indent in a way that’s different from what the Tab key offers, you need to do it yourself.
- Keyboard navigation: I’ll discuss this further in the interface section, but pressing the Up arrow on your keyboard does not move your cursor to the previous line as you would expect. In fact, there are only 5 keyboard shortcuts.
There are other features that Acme has, but implements in different ways. Searching is quite different, going to a specific line as well. It can’t edit a remote, it can’t spell check a document or count its words, you can’t display line numbers, etc.
Interface
I won’t go too much into details, but let me talk a little about the interface of Acme. First, it’s aqua and yellowish; all windows are separated into two parts, a tag and a body. The body contains the text of a file and has a yellowish background; the tag is a scratch space with some commands associated with that file and it’s aqua. These colors cannot be changed without editing the Acme source code. The scrollbars are brownish, and don’t work as you expect them. Left-clicking will scroll up, no matter what, and right-clicking will scroll down. If you want to go to a certain position in the file, you need to middle click on the scroll bar. The amount that left-clicking and right-clicking scroll up/down depends on how far up the bar you are. Near the top, and they scroll line-by-line; near the bottom and it’s page-by-page.
Beyond what the interface looks like, the most important thing about the Acme interface is that it’s mouse-driven. As I said before, there are only 5 “standard” keyboard shortcuts; for everything else, you must use your mouse. If you want to write something on the line above your cursor, you reach for your mouse, click on the line and start typing. You cannot use the Up arrow or Ctrl+P. Saving is done by middle clicking (I’ll get to the middle click part in a moment) the command “Put” in the tag of the file, no Ctrl+S’ing every 8 keystrokes. Of course, cutting, copying (called snarfing in Acme) and pasting are all done with the mouse, using mouse chords. Mouse chords are going to be familiar to people using the Opera web-browser or using one of the mouse gesture addons for Firefox and Chrome. Basically, but holding down one button of the mouse, and clicking another one, you can perform different actions. Here are the two most important:
- After selecting some text by holding down the left button, keep it held down and middle click to cut the text.
- To paste text, hold down the left button and click the right click.
- If you combine these two actions (Select text, keep left button held down, middle click, right click), you copy text.
This way of manipulating text is certainly different from what I’m used to, and since I don’t have a three-button mouse, but only my Thinkpad trackpad, it was extremely awkward to do those chords. I’m guessing that it’s a little better, but still awkward with a 2-button mouse with a scroll wheel that you can click. It really looks like you need a 3-button mouse if you want to be able to manipulate text easily and without pain.
Speaking of the mouse, the three different buttons have different functions. The left button selects text and positions the cursor (as we’re all used to). The middle button is used to execute commands; you either select some text and middle click on it, or you middle click on a word, and it’ll be executed. If the word/selection is not recognized as an Acme command, Acme will try to execute an external program. The right button is used mainly to open files (if the selected text/word under the cursor looks like a file name) and will search otherwise. In his tour of Acme, Russ showed that it can be extended to do other things, but I was not able to configure my own Acme installation in this way.
Acme separates its workspace into columns, and you can split those columns into windows which will contain actual files. The management of these windows is done with the mouse, of course, and I found it to be pretty efficient and easy. Acme also tries to be somewhat intelligent when it opens new windows, acting as a mini window manager in that respect. This management is efficient and minimal enough that I would really like to see it ported to Emacs.
Executing commands
In Acme, all text can be executed. If you look at the screenshot above, you can see in the lower-left corner the command I used to create the screenshot. I simply typed the command into an empty window, selected the text and middle clicked. Any text, anywhere can be executed that way. If you are going to be using a command often, it may be a good idea to put it in the tag of a window so that it is readily accessible.
You can also use the usual redirection operators from Unix as well as the pipe. For example, if you had a list of names, and you wanted to sort them, you would write |sort somewhere, select the lines you wanted to sort and middle click the command and the lines would then be ordered. If you wanted to insert the current date, you’d write <date and middle-click and the command would be replaced by the date. Finally, if you selected some text and clicked on a command that looked like >cmd, it would run the command with the selected text as input, and the output of the command would be displayed in a new window.
The ease of running commands on text is one of the reason that Acme can be kept so minimal. Why write an editor command to reformat C code when you can simply call indent on the content of the file? I find this strategy to add functionality to an editor extremely interesting (and correct me if I’m wrong, but doesn’t Textmate do something similar?) and other editors could certainly learn from it.
Things I didn’t get to try
If you watch the Acme screencast, you’ll see that Acme can have its own mount point and that all the information about the state of the editor is contained in that directory and can be manipulated to directly affect the editor. Russ showed how his “Slide+” command uses this facility. Unfortunately, I was not able to get Acme to mount properly, so I was not able to explore this feature, but certainly this is very cool. By exposing its internals through a file system and not an internal API, it is possible for external programs to modify the editor; using this ability, it is possible to write Acme “plugins” in pretty much any language we want. I feel this goes a really long way towards making the editor extremely extensible while keeping it very simple.
Another thing I was not able to play with is the right button capabilities of Acme. I was able to search, open files, open files at certain line numbers (if the file has the format file.c:16, Acme will open file.c at line 16), but I was not able to track my UPS orders or open man pages this way. I think this functionality depends on Plumber, a Plan 9 facility, but I’m not sure.
Closing thoughts
Acme is certainly very interesting, it has some great ideas and is really snappy. I don’t think it’ll replace Emacs as my main editor any time soon, but I’m hoping that maybe during Christmas break I can try to use it for actual programming for a while, and see how I like it. I’m guessing that it won’t be a success as I have some very deeply ingrained habits, but nobody ever died from trying to do things in a different way.
I’m also hoping that some Emacs über-hackers look at Acme and find some things to steal!