Tuesday, October 16, 2007

Clisp in Emacs using Slime on Ubuntu

For people who want to run Common-lisp inside an Emacs buffer, there's this wonderful CVS package known as SLIME. If you have Ubuntu, you can select and install the package through Synaptic Package Manager.

Typically installing packages from repositories is a click and play experience, but you'll find that having emacs (or Emacs GTK Snapshot in my case) and SLIME installed isn't quite enough. If you don't already have one, create a ".emacs" file in your home directory. Add the following code to it, modify with paths relevant to your system and save (the current paths are default for Ubuntu clisp and slime installations):


(setq inferior-lisp-program "/usr/bin/clisp")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime")
(require 'slime)
(slime-setup)


Now you're all set. Start up emacs, type "M-x slime" (or Alt-x slime), and presto! Superior Lisp Interaction Mode is a go.

6 comments:

jasper said...

Thanks that was very useful for me, i already found this code but i still had to find the two files.
In general finding files is an anoyence, and locate only partially solves this. Perhaps "sudo aptitude show slime" should give more information on basic install.

Stever said...

What version of ubuntu are you using? I am using Ubuntu 7.04 (feisty) and it's still giving me an error:
[1]>
*** - LOAD: A file with name
/usr/share/emacs/22.1/site-lisp/slime/swank-loader.lisp does not exist

I checked and the load-path "/usr/share/emacs/site-lisp/slime" is valid on my machine.

What version of ubuntu are you using?

Alec Koumjian said...

When I posted this I was running 7.04 feisty. Does the discrepancy between "/usr/share/emacs/site-lisp" and "/usr/share/emacs/22.1/site-lisp" make a difference?

MiguelS said...

Worked a treat for me. Thanks

Simon Tite said...

Worked great for me too! Just a word of warning for the nervous - you will see a lot of scary messages before the slime/lisp prompt occurs, don't worry, they are not errors, or at least I don't think so! (you can check the messages in your other emacs buffers). You will know it's worked when you see the prompt CL-USER>. Thanks Alec.

Marco said...

Hi, thanks for the post. Now illbe able to learn Lisp! Cool! Ill follo you on twitter!