davidb dives in   Archives

switching to cocoa emacs

… from Carbon Emacs, That is. I pretty much assume that if you aren’t already a dedicated Emacs user you will just stick with TextMate Or TextWrangler, or whatever.

Anyway, did you even know that Cocoa Emacs existed? You may have heard Of Carbon Emacs or Aquamacs, but WTH is Cocoa Emacs? It turns out that with the final stable release of Emacs 23.1, it came with a Cocoa native build option. Thus, Cocoa Emacs is Now the standard, no-nonsense build of Emacs for OS X. So, how does Cocoa Emacs compare to Carbon Emacs? It acts and feels mostly the Same, although I think it looks a bit crisper and feels a bit faster (which is probably an illusion). It is smaller on disk (95 MB vs 157 MB), and, of course, it is based on a newer version of Emacs Itself. It is The Future!

There are two things that irritated me with Cocoa Emacs when I Switched:

  1. Meta is, by default, mapped to the option key. However, this is easily fixed.
  2. Carbon Emacs came with a built-in version of aspell. With Cocoa Emacs you need to get aspell separately. This is less easily fixed, but it isn’t too bad.

You can get a pre-built stable version of Cocoa Emacs from Here, or nightly builds from here.

Step 1: Switch the meta key back to the command key, where it is meant to be. This can either be done via Customize, or you can do it manually with elisp. Manually, add: (setq ns-command-modifier 'meta) to .Emacs. This same thing can be done simply via Customize:

  1. M-x customize,
  2. go to Environment->NS,
  3. and change the “Ns Command Modifier” option to “meta”.

You can map option to something else, keep it is “meta”, or unset it altogether (which is how it behaves in Carbon Emacs, and probably what You want).

Step 2: Getting aspell. If you never ask Emacs to spell check anything, you can ignore this. There are three Ways that I’ve thought of to get aspell:

  1. Copy it from Carbon Emacs. I haven’t actually tried this, but it should be possible to copy it from the Carbon Emacs bundle into the Cocoa Emacs bundle. You will probably need Contents/Mac OS/bin/aspell and aspell-import, and Contents/Resources/lib, and Contents/Resources/site-lisp/site-start.d/builtin-aspell.el. Good Luck.
  2. Install aspell via macports. If you already have macports, this is probably the way to go. To do it this way:
    • % sudo port install aspell
    • % sudo port install apsell-dict-en (or some other language dictionaries)
    • In Emacs: M-x customize-option, ispell-program-name, and set the value to /opt/local/bin/aspell.
  3. Get it by installing cocoaAspell. This is what I’ve done currently.

CocoaAspell both delivers a version of aspell (to /usr/local/bin) and also delivers a preference pane for getting it configured. Nifty, but I had to manually fix the aspell configuration to point it to the dictionaries, and you also need to modify the ispell-program-name variable (which can be done via Configure, as well). To fix the aspell configuration, I edited /usr/local/etc/aspell.conf, changing: dict-dir /usr/local/lib/aspell-0.60 to dict-dir /Library/Application\ Support/cocoAspell/aspell6-en-6.0-0 Or, I suppose, you could copy the dictionaries back to /usr/local/lib/aspell-0.6.0.

Written on Jan 17, 2010.

comments powered by Disqus