Lojic Technologies

Switching from CarbonEmacs to Emacs.app

with one comment

Thanks to a tip from David Joyner, I discovered that the current version of Emacs will easily build an Emacs.app application for Mac OSX i.e. I no longer need to install the CarbonEmacs application. I’m thankful to Seiji Zenitani for creating CarbonEmacs, but I’m glad to be able to build the app directly from the latest Emacs source code.

Here’s what I did:

Get the source code and build it

git clone git://git.savannah.gnu.org/emacs.git
cd emacs
./configure --with-ns
make install

Copy Emacs.app to Applications

Drag nextstep/Emacs.app to Applications

Modify Emacs config files

I had several configuration items I needed to adjust.

carbon-emacs-package-add-to-path no longer exists

I used the above command to set the path to allow running programs via shell-command as follows:

(carbon-emacs-package-add-to-path "/Users/badkins/sync/bin")
(defun my-fun ()
  (interactive)
  (shell-command "my_ruby_script.rb"))

I found a comment by Alex Payne on Ola Bini’s blog that provided an equivalent for Emacs.app:

(setq path "/Users/badkins/sync/bin")
(setenv "PATH" path)

Use command for meta instead of alt/option

The newly built Emacs.app used the alt/option key for meta instead of the command key that I was used to with CarbonEmacs. The following (found on Hacker News) took care of that:

(setq ns-command-modifier 'meta)

Prior to the above, I had tried the following. It worked, but was more verbose:

(setq mac-option-key-is-meta nil)
(setq mac-command-key-is-meta t)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier nil)

Allow use of command-h to minimize Emacs

After the above fix for the command key, I could no longer minimize Emacs via command-h because Emacs mapped M-h to a command. The following key binding allowed using M-h to minimize again:

(global-set-key (kbd "M-h") 'ns-do-hide-emacs)

Customize exec-path variable

I was having difficulty using the built-in vc git support. It turns out that Emacs wasn’t able to find the git command because it wasn’t in the exec-path. I customized the exec-path variable to include /opt/local/bin where git resides as follows (it’s within the custom-set-variables invocation):

 '(exec-path (quote ("/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Applications/Emacs.app/Contents/MacOS/bin" "/opt/local/bin")))

Emacs is Awesome

That was all it took to get the latest Emacs up and running equivalently to CarbonEmacs for me. I’m more pleased with Emacs today than when I started using it in earnest in 2008. I’m continually learning new things to be more productive. There are just so many things that it does very well, and it’s so extensible and introspective.

Written by Brian Adkins

March 17, 2010 at 12:42 am

Posted in programming

Tagged with ,

One Response

Subscribe to comments with RSS.

  1. […] previously wrote a post about switching from Carbon Emacs to Gnu Emacs. Upgrading is pretty simple now, so I thought I’d record the procedure for installing Emacs […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: