I have been thinking of writing this up for sometime. Do we really need another post about how to get started with Clojure in Emacs? There are so many articles on plethora of ways of doing this on the inter web. Honestly speaking, I have tried them all. I am not gonna list them here to save myself and you the trouble of being distracted. Finally, I have settled with following and I hope you do the same.
1. Install leiningen:
a. wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
b. chmod +x lein
c. lein self-install
Note: If you are lucky user of Ubuntu 11.10, do: sudo apt-get install leiningen
2. Intall Emacs 24
Ubuntu: sudo apt-add-repository ppa:cassou/emacs; apt-get install emacs-snapshot
Mac OS: get it here: <a href="http://emacsformacosx.com/"></a>
3. Put following lines in your .emacs file and restart your emacs
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(add-hook 'clojure-mode-hook
(lambda ()
(setq inferior-lisp-program "lein repl")))
Once your Emacs starts up fine, issues following command to get clojure mode:
Alt-x package-install clojure-mode
Then you can just open a clj file and run: alt-x inferior-lisp. You will get yourself a nice repl within Emacs and start hacking. Following is a quick summary of what you can do:
1. Move around defn and def forms with Ctrl-Alt-p and Ctr-Alt-n for up and down
2. Evaluate defn and def with Ctrl-Alt-x while the curser is anywhere within the form
3. Use Alt-p and Alt-n to navigate repl history
Plus, enjoy all of the rest of Emacs' superb editing powers while you are at it. I am also thinking of starting conversational style Clojure programming guide and let me know if you are interested in proof reading or contributing.
1. Install leiningen:
a. wget https://raw.github.com/technomancy/leiningen/stable/bin/lein
b. chmod +x lein
c. lein self-install
Note: If you are lucky user of Ubuntu 11.10, do: sudo apt-get install leiningen
2. Intall Emacs 24
Ubuntu: sudo apt-add-repository ppa:cassou/emacs; apt-get install emacs-snapshot
Mac OS: get it here: <a href="http://emacsformacosx.com/"></a>
3. Put following lines in your .emacs file and restart your emacs
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(add-hook 'clojure-mode-hook
(lambda ()
(setq inferior-lisp-program "lein repl")))
Once your Emacs starts up fine, issues following command to get clojure mode:
Alt-x package-install clojure-mode
Then you can just open a clj file and run: alt-x inferior-lisp. You will get yourself a nice repl within Emacs and start hacking. Following is a quick summary of what you can do:
1. Move around defn and def forms with Ctrl-Alt-p and Ctr-Alt-n for up and down
2. Evaluate defn and def with Ctrl-Alt-x while the curser is anywhere within the form
3. Use Alt-p and Alt-n to navigate repl history
Plus, enjoy all of the rest of Emacs' superb editing powers while you are at it. I am also thinking of starting conversational style Clojure programming guide and let me know if you are interested in proof reading or contributing.