Archive for the ‘Programming’ Category

Setting up slime (emacs and sbcl)

February 7, 2009 6 comments

I decided to have a go at slime again. After having tried to learn lisp for a couple of weeks last year, I decided its time I learned something job oriented and hence spent a lot more time in python and java. However, not that I am getting bored, I am back to slime :).

I never got used to emacs really, but since slime looks like the best thing for lisp, and the cusp repl somehow doesnt work for me, I took the plunge again.

Installed the emacs-cvs and slime-cvs from the arch repositories,

pacman -S emacs-cvs slime-cvs

Now, after slime is installed it prints some lines, telling you to put certain things in your ~/.emacs . Strangely though, after I started slime from emacs, the REPL didn’t look familiar!! It was different last time, only I forgot what the difference is.

And then the “comma” didn’t work. It’s supposed to bring up a command prompt but instead it just printed a literal comma! Wonders wonders…

After almost a couple of hours of googling, and trying a bunch of things, I went in to #emacs @freenode, and learnt from there that slime now doesnt even load the REPL by default, and it was only then that I noticed that I wasn’t typing at the REPL but at the *inferior-lisp* buffer. No wonder the “comma” didnt work as well as a lot of other stuffs.

So, here is how the new slime works, you got to load up the repl and other stuffs manually. Here’s the slime part of my ~/.emacs

(eval-after-load “slime”
(setq slime-lisp-implementations
‘((sbcl (“/usr/bin/sbcl”))
(clisp (“/usr/bin/clisp”)))
common-lisp-hyperspec-root “/home/sujoy/documents/hyperspec/”)
(slime-setup ‘(slime-asdf
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function ‘slime-fuzzy-complete-symbol)
(add-hook ‘lisp-mode-hook (lambda () (slime-mode t)))))

(require ‘slime)

I am using SBCL, and put in these lines in my sbcl config to start the swank server automagically when sbcl starts 🙂

(require ‘asdf)
(push “/usr/share/emacs/site-lisp/slime/” asdf:*central-registry*)
(asdf: oos ‘asdf:load-op ‘swank)

; start swank
(setf swank:*use-dedicated-output-stream* nil)
(setf swank:*communication-style* :fd-handler)
(swank:create-server :dont-close t)

Well, I wrote none of this stuffs myself, mixed and matched from various configs to give me something that actually worked. Hopefully, this will save someone an hour of looking through old configs.

Categories: Programming Tags: ,