Mark Needham

Thoughts on Software Development

Racket: Wiring it up to a REPL ala SLIME/Swank

without comments

One of the awesome things about working with clojure is that it’s possible to wire up clojure files in emacs to a REPL by making use of Slime/Swank.

I’ve started using Racket to work through the examples in The Little Schemer and wanted to achieve a similar thing there.

Racket is a modern programming language in the Lisp/Scheme family, suitable for a wide range of applications

I don’t know much about configuring emacs so I made use of Phil Halgelberg’s emacs-starter-kit which is available on github.

On my travels I came across this video describing how to do exactly what I wanted.

The first step was to download a library called ‘geiser‘:

Geiser is a generic Emacs/Scheme interaction mode, featuring an enhanced REPL and a set of minor modes improving Emacs’ basic scheme major mode.

The easiest way seemed to be to clone the git repository:

git clone git://gitorious.org/geiser/mainline.git geiser

I then added the following line to my /Users/mneedham.emacs.d/init.el file:

(load "/Users/mneedham/github/geiser/elisp/geiser.el")

From emacs you then need to run the following command:

M-x geiser

It then asks you which scheme implementation you want to use, so in our case we need to make sure that racket is available on the path.

For some reason when I downloaded racket it seemed to prefer mounting itself as a volume rather than installing itself to /Applications so I ended up copy/pasting the folder to my home directory and adding it to the PATH in my .bashrc:

export PATH=$PATH:"/Users/mneedham/Documents/Racket v5.2.1/bin"

Now we can just type ‘racket’ when we’re asked which scheme implementation we want and then we’re done!

Emacs geiser

Written by Mark Needham

July 11th, 2012 at 7:34 pm

Posted in Software Development

Tagged with