zero to emacs in under 5 minutes

You want to write Clojure. You want to write it in Emacs. Here's how.

1. Grab Leiningen.

mkdir -p ~/bin
cd ~/bin
wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
chmod +x lein
echo 'PATH=$PATH:~/bin' >> ~/.profile
lein self-install

This will get you leiningen, Clojure's build tool.


2. Grab Clojure.


cd ~/code
lein new my-first-clojure-project
cd my-first-clojure-project
lein deps
`lein deps` will bring down a local copy of Clojure. Look in ~/code/my-first-clojure-project/lib !


3. Grab swank-clojure.


lein plugin install swank-clojure 1.4.0
This gives you the `clojure-jack-in` command in emacs. It's your samurai sword.


4. Grab a healthy .emacs config.

mv ~/.emacs ~/.emacs.bak
mv ~/.emacs.d ~/.emacs.d.bak
git clone git@github.com:c42/dotfiles.git
ln -s dotfiles/emacs.d ~/.emacs.d

5. Grab an emacs.

Ubuntu: https://launchpad.net/~cassou/+archive/emacs
OS X: http://emacsformacosx.com/emacs-builds/Emacs-pretest-24.0.94-universal-10.6.8.dmg

Running emacs for the first time will automatically install all the packages you need. Now run your first emacs repl!
M-x clojure-jack-in

TADA!

finger brains


Okay, so now I'm back on my own computerand it's a race against myself. Crap. I still seem to be making mistakes. I guess I just can't type all that well when I've had ad couple. Shit.
Well, this is all I can think of so I'm going to stop typing in 3 2 1....
My housemate Nikhil (and not my other housemate Nikhil) and I had a typing race on our two respective keyboards. It lasted only a few seconds. We were racing ourselves to test the keyboards (MacBook Air vs. ThinkPad 410-something-something). We each preferred each other's machines but I would only trade this for an X1 covered in leather. Our conversation led to a cross-comparative question "why should I care about my typing speed?" to which was returned one of my favourite stories:
Duke Huan was in his hall reading a book. The wheelwright P'ien, who was in the yard below chiseling a wheel, laid down his mallet and chisel, stepped up into the hall, and said to Duke Huan, "This book Your Grace is reading--may I venture to ask whose words are in it?"
 "The words of the sages," said the duke.
 "Are the sages still alive?"
"Dead long ago," said the duke.
"In that case, what you are reading there is nothing but the chaff and dregs of the men of old!"
"Since when does a wheelwright have permission to comment on the books I read?" said Duke Huan. "If you have some explanation, well and good. If not, it's your life!"
Wheelwright P'ien said, "I look at it from the point of view of my own work. When I chisel a wheel, if the blows of the mallet are too gentle, the chisel slides and won't take hold. But if they're too hard, it bites in and won't budge. Not too gentle, not too hard--you can get it in your hand and feel it in your mind. You can't put it into words, and yet there's a knack to it somehow. I can't teach it to my son, and he can't learn it from me. So I've gone along for seventy years and at my age I'm still chiseling wheels. When the men of old died, they took with them the things that couldn't be handed down. So what you are reading there must be nothing but the chaff and the dregs of the men of old."
Wait. Maybe I meant to read him the one about the buckle-maker who focuses so intently on his craft of making buckles that he couldn't see anything else. It wouldn't be the first time I've confused them. Anyway, if you can't type in one continuous stream (higher speeds are largely irrelevant but a 100wpm minimum wouldn't hurt), you're losing little tiny brain spasms to figuring out which keys to hit. These little tiny brain spasms could be helping you figure out what `self` is in the median of your code while trying to remember how to write a class method which generates class methods in Ruby. Because that's how brogrammers like you and me get our tickles. These little tiny brain spasms are basically the opposite of sleep. Shoot them down with your giant space laser-equipped pelican-shaped airship! And then just run under Bowser because you don't actually have to kill him. The beautiful Mavis Beacon awaits on the other side.