Auto-Start Incanter in Emacs
This post is outdated and has been superceded by the much better work of Jake McCrary... http://jakemccrary.com/blog/2010/12/07/quickily-starting-a-powerful-clojure-repl/
I love hacking on clojure/incanter using emacs, however this requires a tedious routine of starting up swank and then connecting in emacs via slime. I am usually far too lazy to write shell or emacs scripts, but since nobody ever posted a method for doing this I decided that I finally had to figure it out myself. Its rather elementary which is why I guess nobody ever mentioned it, but....
Here's what I did:
First off, I wrote the following executable shell script:
file: /bin/bash-clj
#!/bin/bash
bash --init-file ~/incant.sh
This starts a bash terminal loading the init-file incant.sh, which is simply another shell script that changes to my incanter directory and runs the script to start a swank server:
file: ~/incant.sh
cd ~/bin/incanter
./script/swank
Finally, I put the following lines in my .emacs file to trigger the loading of the above scripts and connect through slime:
file: ~/.emacs
(ansi-term "/bin/bash-clj")
;wait while swank is loading up...you may need to tweak
(sit-for 6)
; connect to slime on local-host, port 4005
(slime-connect "127.0.0.1" 4005)
;don't ask me annoying questions about version mismatch
(setq slime-protocol-version 'ignore)
And there you have it!
Straight to incanter's clojure REPL.