Sunday 16 March 2014

Emacs: Racket on Ubuntu

Well, I'm finally digging into Emacs as a text editor for Lisp and Erlang.  I've picked up Learning GNU Emacs which I'm enjoying.  During my study with SICP, I'm using the Racket flavor of Scheme. 

One of the issues so far, though, has been how to be install and use Emacs with Racket on Ubuntu.  So, I don't forget I'm going to record what configuration I ended up using.

Emacs (extra-super text editor):
sudo apt-get install emacs

Geiser (Racket Scheme support for Emacs):
sudo apt-get install geiser

Quack (enhanced Scheme mode for Emacs):
sudo apt-get install emacs-goodies-el


After installing the tools above.  I open terminal session and type emacs -nw to open Emacs.

Once Emacs is open, in order to enter Racket mode, I use Geiser by running the following commands:

M-x run-geiser RET racket RET*

*RET - hit enter

At this point, you can open up a Racket REPL, by running:

C-c C-z

This will open up another buffer and start a Racket REPL in the window.

I tend to like to be editing a Racket file and then, when I'm ready load the file into the REPL for testing.  To do this, save a file:

C-x C-s  (then give a file name, ex. test.cl)

Add some Scheme definitions to the file and then save using the same command.  Then, when I'm ready to test run the following:

C-c C-a

This Geiser command will open a REPL and then load the current file into the REPL session.  This allows you to switch back and forth between the REPL buffer and the file buffer.  So far, I'm finding this to be the best configuration.