The Golden Spot

I hope this helps someone who is learning about Linux and web application programming with Python, Django, and Javascript.

Sunday, July 08, 2012

emacs-live on mac os x

One thing that you will want to do when using overtone with emacs is to use emacs-live. You will only want to load the elisp initializations for emacs-live when you plan on live coding music and such. So this post is about how to keep a separate initialization for emacs-live on Mac OS X.
You will need emacs 24.
I made a directory called `~/elisp` where I cloned emacs-live from https://github.com/overtone/emacs-live as `.emacs.d`.
~ $ mkdir elisp
~ $ cd elisp
~/elisp $ git clone git://github.com/overtone/emacs-live.git .emacs.d
Cloning into '.emacs.d'...
remote: Counting objects: 2467, done.
remote: Compressing objects: 100% (1815/1815), done.
remote: Total 2467 (delta 644), reused 2375 (delta 557)
Receiving objects: 100% (2467/2467), 2.72 MiB | 967 KiB/s, done.
Resolving deltas: 100% (644/644), done.
~/elisp $ emacs .emacs.d/init.el
Open `~/elisp/.emacs.d/init.el` and change
(setq live-root-dir user-emacs-directory)
to
(setq live-root-dir "/Users/your_username/elisp/.emacs.d/")
where `your_username` is your username.
Now edit your `.bashrc` file using this alias:
alias emacs-live='/Applications/Emacs.app/Contents/MacOS/Emacs -q --load=/Users/your_username/elisp/.emacs.d/init.el'                                                 
The `-q` tell emacs not to load the standard init file that it normally tries to load when you first start emacs. The next option tells emacs to load the init file within the emacs-live directory that you just cloned. Since we already edited the init file to tell emacs where the `live-root-dir` is, it will start how we want.

Add any customizations such as keyboard shortcuts to the bottom of the `init.el` file that you edited earlier.

To make that alias active immediately, type:
$ source ~/.bashrc
Now you can type `emacs-live` and emacs will load the emacs-live initialization file. When you run emacs normally, it will load your default initialization file, just as it did before.