Monthly Archives: March 2011

Emacs on Mac OS X

During the weekend I spent a few hours setting up a new hacking environment for my latest curiosity, Lisp. Evidently all the cool kids use Emacs for hacking in Lisp so I invested the time to revisit my Emacs setup.

Previously I would SSH into each server on which I had files to edit and run Emacs in each shell. This forced me to maintain .emacs files everywhere and exposed me to network breaks. (I tried screen but OSX+screen+Emacs is the deadly triad of configuration hell.)

Now I use GNU Emacs for Mac OS X, a universal binary compiled just days ago from the GNU source. Instead of running Emacs on a remote server, I use TRAMP to connect and edit remote files. When I want to open a remote file, I prefix the path with /ssh:hostname: or /scp:hostname:. TRAMP can browse and autocomplete in remote directories just as well as in local directories.

I already keep my most used servers in my .ssh/ssh_config file and I use shell scripts to start master connections with logs tailing in terminal windows. Master connections cut down on TRAMP connection times. TRAMP reads ssh_config for hostname autocompletion, so I can open remote files in fewer keystrokes than ever before.

There so many benefits to using Cocoa Emacs instead of Terminal+SSH+Emacs. I don’t have to mess with Terminal’s key maps and then fix them in every remote .emacs file. I don’t even need to install Emacs on remote servers. The kill ring integrates with the clipboard and works across all remote hosts. The network can’t lag my keystrokes or kill my editing session. Frames. Menus. Scroll bars.

I must stop blogging and get back to work. But first I must thank David Caldwell for setting up Of all the major hacking environment shifts I’ve made, this was the easiest and most powerful.