sábado, 20 de febrero de 2010

Emacs + clojure = WIN

Let me give you a little background of what I wanted to do. I wanted to be able to use clojure inside emacs in Fedora. Simple right? Wrong! Well not that wrong either as I discovered today. After many weeks trying to install clojure, compiling the source code many times, pulling out my hair and getting angry at this thing I finally got it working.

It was so simple, so here I want to show you how its done son none of you have to suffer like I did.

Go here:

cd .emacs.d/

Get the clojure mode

git clone git://github.com/jochu/clojure-mode.git

Now open the .emacs file with whatever you want (emacs, gedit, etc) and add these lines at the end:


;; clojure-mode
(add-to-list 'load-path "/home/aniki/.emacs.d/clojure-mode")
(require 'clojure-mode)


Save the file. Enter emacs and press M-x (alt x) and write 

clojure-install

Press enter and accept the default option. (For your sanity's sake don't touch this setting!!!)

Now wait until its done. Emacs will download everything it needs and set it up correctly.

Once you get to the success screen press M-x (alt x) again and write:

slime

Then press enter, you will get a prompt to install clojure. Press y

Now you can use clojure inside emacs.

Now its time for some emacs shorcuts:

C-c C-k                 Compiles the current clj file.
C-x C-e                 Runs the current line in clojure.

2 comentarios:

elmany dijo...

Hola Gianfranco,

Soy un usuario nuevo de Fedora-Emacs-Clojure-Lisp, apenas me he topado con Lisp y me encanta programar en él, de allí mi interés en Emacs y Clojure.
Encuentro tu tutorial sorprendentemente sencillo, pero antes de probarlo quisiera preguntarte si aún funciona, dado que clojure ha cambiado mucho desde hace un año y si sabes de alguna forma de configurar Emacs para trabajar simultáneamente con Common Lisp y Clojure.
Mi versión de Fedora es 15 y mi versión de Emacs es GNU Emacs 23.3.1.
Gracias por adelantado y mucha suerte por México, es un país fabuloso.

Saludos,
Manuel

elmany dijo...
Este comentario ha sido eliminado por el autor.