August 29, 2006

I've come close to throwing my MacBook Pro out the window trying to use the latest iTerm with Emacs. iTerm is often cited as the "best" terminal program for OS X because of its font anti-aliasing and tabbed session features, and of course its free cost and GPL license. But a little thing like "no Emacs" can really ruin a good deal.

Problems drawing Emacs sent me scrambling for other terminal emulation programs, and there are surprisingly few good ones for the Mac. The Terminal program that comes with OS X works well, but its preferences interface is all over the place, and I like an anti-aliased font in my terminal (which I realize applies only to a subset of the terminal-loving population). There are a handful of others, but they're old, or simply not much better than Terminal. Some are expensive, though I'd note that I'd pay real money for the perfect terminal.

The lack of a selection really isn't that surprising when you look into the history of terminal protocols. The compatibility requirements for a basic terminal emulator is very high, and the protocols are huge, myriad, and poorly documented. I'd beg Panic for a terminal emulator, but I suspect the Mac world would be better served putting their limited resources toward more straightforward problems. (I still want them to rev Unison with better filtering features, and they're not getting around to it.)

Anyway, I'm back to iTerm now that I've bothered to check their bug log and notice a bug describing exactly the Emacs rendering issues I was noticing. iTerm sets the TERM environment variable—which indicates to terminal apps both local and remote how to draw stuff—to "ansi" by default, but something (probably iTerm) doesn't handle something properly in that mode. If you force the TERM variable to "xterm-color" or "xterm", the problem goes away. I'd rather iTerm's TERM be selectable as a preference somewhere (as it is in Terminal), but I'm happy with a workaround for now.

comments...

Is there a particular reason you're wedded to running Emacs in the terminal window? If you don't mind it running as a Mac application, fetch the latest sources from CVS, configure it with the '--enable-carbon-app' flag, and 'make' away. I've been using it for over a year and it works great.

Oh, totally! I use Emacs 22 from CVS for all local uses. It even builds native on Intel Macs. The iTerm troubles are when I run Emacs on a remote host, usually for quick projects on cheap web hosting. I might be better off using Emacs local and WebDAV (or AngeFTP) in that case, but I haven't bothered to try it, mostly because I'm too used to local behaviors for interacting with the shell.

Terminal.app -> "Terminal" menu, "Window Settings..." - > Display. Right below the font selector is the anti-aliasing checkbox. I've tried iTerm, and I realize that a ton of people love it (mainly for the tabs, it seems) but for monitoring and switching between several shells (especially on a dozen or more systems), having separate windows per shell, combined with Expose is a huge bonus.

And what sold me on Terminal is that its windows are less "bulky" than iTerms, so it's a bit easier to fit dozens of little terms on Expose at once.

Thanks, Nathan! Now I'm limited to simply complaining about Terminal's bizzare preferences interface.