Home > Programming > Setting up slime (emacs and sbcl)

Setting up slime (emacs and sbcl)

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”
‘(progn
(setq slime-lisp-implementations
‘((sbcl (“/usr/bin/sbcl”))
(clisp (“/usr/bin/clisp”)))
common-lisp-hyperspec-root “/home/sujoy/documents/hyperspec/”)
(slime-setup ‘(slime-asdf
slime-autodoc
slime-editing-commands
slime-fancy-inspector
slime-fontifying-fu
slime-fuzzy
slime-indentation
slime-mdot-fu
slime-package-fu
slime-references
slime-repl
slime-sbcl-exts
slime-scratch
slime-xref-browser))
(slime-autodoc-mode)
(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: ,
  1. ondra
    February 7, 2009 at 8:23 PM

    Great timing of this post, I stumbled across exactly the same problem today 🙂 Works, thanks!

  2. February 9, 2009 at 8:22 PM

    you are most welcome.
    glad to know it worked 🙂

  3. March 5, 2009 at 8:55 PM

    Brilliant. Thanks a lot. You definitely saved me some time.

  4. August 9, 2009 at 5:14 AM

    I had just gotten slime installed and found this article. DEFINITELY worked out excellently, thanks so much!

  5. nullpointer
    October 31, 2009 at 8:56 AM

    Psychic! This is my exact situation. Thank you thank you thank you.

  6. Hepres Outbreak
    June 17, 2015 at 4:25 AM

    incorrect:

    > (asdf: oos ‘asdf:load-op ‘swank)

    correct:

    (asdf:oos ‘asdf:load-op ‘swank)

  1. No trackbacks yet.

Leave a comment