Understanding SLIME (Using Emacs and Lisp Cooperatively)
Tuesday, December 9, 2008
If you're using Emacs to write Lisp code (either Common Lisp, Clojure,
or some dialects of Scheme), you're probably also using
SLIME (an
Emacs major mode that provides enhanced support for Lisp
development). With the recent surge of enthusiasm for
Clojure, even more people are starting to use it. However, newcomers (and some experienced Lispers)
frequently get confused with how to install and/or use SLIME. So, I've
gathered together a bunch of links that (hopefully) will make SLIME
easier to come to grips with.
First of all, it should be noted that SLIME has a client-server
architecture; the Emacs client portion of SLIME connects to an external Lisp
process, which is running a SLIME server. So, SLIME actually consists of two
separate components that communicate with one another via an sexp-based
communications protocol over a socket:
- An Emacs Lisp "front end" that provides certain functionality within the Emacs editor. It is implemented as an Emacs major mode. This is the "SLIME" component.
- A "back end" that communicates to the underlying Lisp implementation. This is made up of a standard set of defined interfaces (SWANK) and implementation-specific code (written in the Lisp implementation itself) that implements those interfaces and communicates with the SLIME "front-end". These two (combined) are the "SWANK" component.
- Common Lisp backends: Support for all of the following CL implementations is included in the standard SLIME distribution - ABCL, ACL, CLISP, CMUCL, Corman, ECL, LispWorks, OpenMCL/CCL, SBCL, SCL
- Scheme backends: Sheme48, and MIT Scheme, and Kawa (MIT Scheme and Kawa are included in the standard SLIME distribution)
- Others: Clojure, and Goo (Goo is included in the standard SLIME distribution)

In addition to the Emacs Lisp "front-end" of SLIME, there are a number of alternative (but not widely used) front-ends developed by people who didn't want to use Emacs. CUSP is built on the Eclipse platform and runs against the SBCL SWANK back-end. Climacs is a Common Lisp CLIM front-end.
If you are not someone who likes to read documentation, you can avoid 99% of the problems that people have with SLIME by following one simple rule:
Always use the latest CVS version of SLIME with the latest development version of the Lisp implementation.Dut to the "symbiotic" relationship between SLIME and SWANK, it is not uncommon for changes (in either SLIME or the underlying Lisp) to "break" things. Since the people who develop SLIME are also usually using the latest development versions of CL/Scheme/Clojure, these "breakages" normally get fixed within a day or two. Therefore, if you always upgrade both SLIME and your Lisp implementation simultaneously, you will rarely have any problems.
If you're interested in learning about SLIME, here are some links to documentation that I've found useful:
SLIME Overviews:
- SLIME home page with links to documentation, mailing list, screencasts, etc (Note: the documentation for SLIME is very good; however, the manual on the SLIME home page is frequently out-of-date. It is best to build the SLIME documentation that comes with the CVS checkout.)
- Tobias Rittweiler's Technical SLIME presentation (excellent overview of the SLIME/SWANK architecture and communications protocol)
- Andy Wingo's review of SLIME (personal review of what it is that makes SLIME so great and the integration possibilities between editors and dynamic languages)
- Marco Baringer's definitive SLIME movie is terrific. Peter Christensen wrote a review and a transcript of the movie that makes it easy to home in on particular topics in the movie.
- Yusuke Shinyama's SLIME on Linux
- paredit (see command summary)
- redshank
- SLIME Tips and Techniques - Part 1 (Documentation Functions and Redirecting IO)
- SLIME Tips and Techniques - Part 2 (Closing Parens)
- SLIME Tips and Techniques - Part 3 (Balanced Comments)
- SLIME Tips and Techniques - Part 4 (Library Documentation)
- SLIME Tips and Techniques - Part 5 (Alternative Browsers in Emacs)
- SLIME Tips and Techniques - Part 6 (Send SEXPs to REPL)
- SLIME Tips and Techniques - Part 7 (Multiple REPLs)
- Reconnecting to a running Lisp with SLIME
- Some more SLIME features
- CL, Music and SLIME Tutorials
- Dynamically Edit/Debug Lisp Web Apps with SLIME
- SLIME Web Development Workflow
- Remote Lisp Development with SLIME/Emacs
- Using SLIME to Front-end your App
- Emacs Keymaps and the SLIME scratch buffer
- Clojure SLIME Mods for Java Documentation
- My Clojure Emacs Setup

