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.
Great timing of this post, I stumbled across exactly the same problem today 🙂 Works, thanks!
you are most welcome.
glad to know it worked 🙂
Brilliant. Thanks a lot. You definitely saved me some time.
I had just gotten slime installed and found this article. DEFINITELY worked out excellently, thanks so much!
Psychic! This is my exact situation. Thank you thank you thank you.
incorrect:
> (asdf: oos ‘asdf:load-op ‘swank)
correct:
(asdf:oos ‘asdf:load-op ‘swank)