GNU Emacs 24.3.50.1

Install using:

$ brew install --cocoa --srgb --HEAD --use-git-head emacs

--use-git-head just makes sure that you use a git mirror of the source, but if you omit it, it'll just get it from bzr, so it'll be slower, but it should be the same source.

--HEAD because emacs 24.3 regular has a nasty bug on OS X. The bug was that emacs leaks memory like a pro, and causes a distnoted process in OS X to also leak memory like a pro, so you get terrible performance and it can start to screw up even OS X. Eventually it was found that something was calling a run process 20x per second, so they patched that, but that's why you have to install from HEAD.

Overview

Use fn-as-Meta

(setq mac-option-modifier 'none)
(setq ns-function-modifier 'meta)

That alone probably made emacs like 5x less annoying to me because it means you can still use Alt to input stuff like #, and it's more ergonomic, because fn is where Meta was originally on the Symbolics keyboards. Feels sweet too.

This goes in your ~/.emacs.d/init.el. Don't use a ~/.emacs, that's outmoded. You don't use .emacs because you need lots of stuff in the config directory. So you have a .emacs.d directory, and you use init.el inside .emacs.d. Saves some clutter and so on. Centralises all the files.

Turn off GUI crap

GUI crap is a combination of elements, and that's pretty optional.

(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(custom-set-variables
  '(tool-bar-mode nil)
  '(menu-bar-mode nil))

Set a nicer font and theme

Font and theme is quite optional too. I use Monaco-16, highly recommended. Here's the function I use to set it:

(defun set-default-font (font)
  (interactive "sFont Name-Size: ")
  (set-face-attribute 'default nil :font font))

So then you can do M-x set-default-font <ENTER> Monaco-16 (or whatever) <ENTER>. Obviously you'll want to set it in your init.el when you're satisfied with a particular font, but that allows for easy testing and switching.

I use a custom theme that I call "mun".

Use MELPA for packages

The MELPA bit is easy, just make sure you only ever use MELPA to download packages from. All your packages, such as markdown-mode and so on, are going to come from there! Don't use anything else. MELPA is the Homebrew of Emacs. Don't ask how I learned this.

I use a package called use-package to install stuff in my init.el, which I setup using:

(unless (package-installed-p 'use-package)
  (package-install 'use-package))
  (require 'use-package)

But I also install things using M-x package-install. You'll have to do a package-update-list or something first, I forget what it's called. smex brings it up.

Install some good packages, especially smart-mode-line and smex

And smex bringing it up leads me to "especially smart-mode-line and smex". I've got quite a few packages installed, but smart-mode-line and smex are really, really essential. "Iught to be shipped with emacs" level essential.

Get some handy utilities that you will use a lot

For handy, I have quite a few snazzy keybindings that I'm proud of. I use things like C-c k (kill entire line) and C-c d (duplicate line or region) a lot.

Set default window geometry

Oh, and the last one is set default window geometry. But this comes with a sort of extra, EXTREMELY important thing. If you use lots of packages in emacs, it will start insanely slowly. You don't want emacs to start insanely slowly. So, what you do is run emacs daemon, and then actually use emacsclient instead of emacs. The proper way to do this took me ages to figure out. I ended up with these aliases:

export ALTERNATE_EDITOR=""
alias emacs=/usr/local/bin/emacs
alias emacsclient=/usr/local/bin/emacsclient
alias emq="emacs -Q"
alias e="emacsclient -n"
alias ec="emacsclient -n -c"
alias et="emacsclient -t"
alias ew="emacsclient"

I very much recommend them.

To start the emacs daemon and open a frame, you do ec. Then to edit a file from the term, you do e. To quit emacs entirely you do Command-Q. You won't want to do that very often; mostly when you're futzing with your init.el. To close a frame, you do Command-W. To close a buffer, you do C-x k. I bound that to something that makes it a bit more compatible with emacsclient.

There are many more tips, but those are the key ones.

Other tips

There's a git package for emacs called magit which people love, but I haven't used it.

The trackpad can be fixed with:

(setq mouse-wheel-scroll-amount '(2)
      mouse-wheel-progressive-speed nil
      ring-bell-function 'ignore)