Archive for June, 2011

Emacs in a terminal on OSX

My development workflow is based around a full-screen terminal running GNU screen (actually, Byobu, with the escape key mapped to j so that ctrl-a will still work…nice since is under the index finger, so very fast and gives the pinky a break), with one screen devoted to Emacs. I recently started working for a great company, and they supplied me with a new MacBook, so I needed to figure out how to get my Ubuntu workflow working on OSX.

Here is the short list of how I did that:

  • Install iTerm for true full-screen terminal loveliness
  • Disable OSX option-key madness so option keys work in the terminal:
    1. Bookmarks > Manage Profiles
    2. expand Keyboard Profiles
    3. select your keyboard profile and change “Option Key as” to “Meta”
  • Install a modern version of Emacs (the one that comes on OSX 10.6 is way out of date). Unfortunately, $ brew install emacs failed, but a blog post pointed out how to install Emacs 24 from Homebrew head:
    $ brew install emacs --use-git-head --HEAD

    (note that I removed the –cocoa option from the line used in the blog post since the goal is Emacs in a terminal)

  • Set up your Emacs configuration (or use the Emacs Starter Kit–here are my custom configurations on top of the starter kit)

The big problem remaining after taking these steps was that the kill-ring could not access the clipboard. On Ubuntu, xclip.el enabled a terminal based Emacs to access the Gnome clipboard via the xclip utility. On Mac OSX, there are a pair of utilities called pbcopy and pbpaste that do the same thing, so I modified xclip.el (written by Leo Shidai Liu) to work with those.

Here it is:

Activate via:
(require ‘pbcopy)


Read Full Post »