Tips And Tricks

Here are some tips and tricks on setting up Emacs.app on Mac OS X. These are based on my personal experience of using Emacs.app for the past 10 years or so; there may be better ways, but these work for me.

Running Emacs.app from the command line

Call this script "emacs" and put it somewhere in your PATH (~/bin or /usr/local/bin):

Using emacsclient

  1. Make sure the latest emacsclient binary is in your path:

        ln -s /Applications/Emacs.app/Contents/MacOS/bin/emacsclient /usr/local/bin
        # or ~/bin if you prefer
        
  2. Call this script "ec" and put it somewhere in your PATH (~/bin or /usr/local/bin):

  3. Add "alias emacs=ec" or "alias emacsclient=ec" to your ".bashrc". Or just use ec directly.

Using Emacs as the mergetool for git

Add add this snippet to your .gitconfig:

If you want to use emacsclient, add this snippet instead:

Changing the Modifier Keys

Easy

The easiest way is to use the Customize interface: "M-x customize-group RET ns RET".

Hard

If you don't like Customize and want to do it manually, the following variables control the modifier keys:

Each variable can be set to 'control, 'meta, 'alt, 'super, or 'hyper.

In addition ns-alternative-modifier (and ns-option-modifier) can be set to 'none, which lets it get interpreted by the OS so it can be used to input special characters.

The ns-right-* variables are set to 'left by default which makes them the same as their left counterpart.