Wednesday, May 14, 2008
No Joy of Xi
The idea, you see, was to start a GNU Screen session on your workstation. Screen is a terminal based program which lets you "attach" to a running command line prompt, so you can start Screen at work, go home and pick up right where you left off. I used to run the editor XEmacs inside Screen, so I could go to a talk and resume my editing session on my laptop. However, this means running XEmacs in no-window mode, where it loses many features.
The first brainflash was to use XEmacs' gnuclient utility, which also lets you "attach" to another program from the command line, this time to a running (x)Emacs. Normally this pops up a new window, but I found a version of gnuclient for XEmacs which lets me run in no-window mode. So I now start XEmacs, start Screen, run gnuclient, and now I can connect to the same editor anywhere.
The next step was to set up scripts that run these with the configurations I want - myscreen, myxemacs, mygnuclient; not strictly necessary but I can wrap the programs with a little sugar so they always run the right way, do the right thing, and fail with graceful error messages. I'd done this first with myx11vnc, which has odd and weird options I can never remember.
But I digress ... and I'm still short of my real goal. You see, other than losing features in XEmacs in command mode, one thing that was really bugging me was that I continually switch back and forth between vi and Emacs at the command line. I prefer Emacs, but vi is faster to load and type, so I use it for quick jobs ... but it has an almost entirely different set of control keys, which can get confusing. The problem has gotten worse since I've temporarily retired the use of Eclipse at work until some bugs are worked out in a new loader system ... so now I just use XEmacs and vi, without the palate cleaner of a CUA-compatible editor ... and thus end up really confusing myself.
What I really want is an Emacs as easy and convenient as vi, so I can run it anywhere. Gnuclient is about that fast since you don't need to open an Emacs, but typing mygnuclient is painful and can't even be done with tab completion with half a dozen my* programs sitting around in my bin directory.
But wait ... why not call mygnuclient ... 'xi'?
Well, I can, and do. And the result is now I have a fullfeatured Emacs-compatible editor at the command line, fast to type and fast to load as vi, with the added bonus of all my Emacs macros, all my open files, and the history of whatever I was working on. Calloo, callay, he chortled in his joy.
But a lot of the particular details of this depend on my work setup. And I don't blog about the details of my work. (Note no code samples.) So I started to replicate this behavior on my new Mac OS X laptop with Aquamacs so I could show you how this is done without giving away any proprietary trade-secrety things.
But Mac OS X is not Ubuntu, and Aquamacs is not XEmacs. Aquamacs is a version of Emacs, as it turns out; and Steve Yegge's delusions aside, Emacs is perennially just a bit behind of Emacs in all the features that matter to me. No, Steve, I don't care what your experience is; all I know is that in my experience Emacs keeps on leaving me twisting in the wind so I've learned NOT to rely on it, not when I've got XEmacs - but Aquamacs' slick Mac OS X changed that equation.
I really like Aquamacs; it uses the Mac-only command key for all the typical Mac keyboard shortcuts, and the remaining option keys for Emacs. It really is the best of both worlds, and I wouldn't want to give that up ... but Aquamacs isn't compatible with gnuserv. It's version, emacsclient, does not have a no-window mode because Emacs's multiple TTY support is less well developed than XEmacs. There's a patch, but it isn't here yet, and I'm pretty sure it's only compatible with vanilla Emacs, not the Aquamacsy goodness I want. So no 'xi,' not on my laptop yet.
None of this is unsolvable. I'm convinced I could make it work. But not the easy hour or so of hacking it took to make this work on the Ubuntu version, and not in the time available to me to make my "every day in May" blog posts. So you'll have to wait a while to hear the Joy of Xi told properly, in all its grody, replicable detail.