Thursday, September 27, 2007
SLIME is a great Emacs/CL utility and many people prefer it for developing CL
code. However, it has grown quite substantially over the years and
some people have discussed the idea of breaking it up into more
"manageable" chunks. Also, there has been an ongoing "tension" between
those SLIME users who want to add new functionality to SLIME and those
who want to keep it slim and trim. Helmut Eller recently
made a proposal to split up SLIME into "core" and "contrib"
components and, over the past month, he and others have been working
to split up the code.
Today, I downloaded the CVS code and had a look at what they've been doing. It works quite well and I feel comfortable with ditching the previous monolithic version of SLIME and using the new CVS code base. However, there are a few changes that one needs to make to their SLIME setup code and the documentation doesn't appear to have been updated yet. So, here's what I had to put in my .emacs file to get it working:
- Core SLIME functionality: Added the following lines to
use SLIME in Emacs with the CL implementations that I use (I normally use the OpenMCL, SBCL,
and ACL CL implementations with SLIME but use the LispWorks IDE with
STARTER-PACK. OpenMCL is my default implementation, so it's listed first.):
(add-to-list 'load-path "/path/to/slime") (setq slime-lisp-implementations `((openmcl ("dppccl")) (sbcl ("sbcl")) (acl ("alisp")))) (require 'slime-autoloads) (add-hook 'lisp-mode-hook (lambda () (cond ((not (featurep 'slime)) (require 'slime) (normal-mode)))))
- Contrib functionality: Added the following lines so that
certain contrib functionality is loaded after SLIME has been loaded:
(eval-after-load "slime" '(progn (add-to-list 'load-path "/path/to/slime/contrib") (require 'slime-fancy) (require 'slime-banner) (require 'slime-asdf) (slime-banner-init) (slime-asdf-init) (setq slime-complete-symbol*-fancy t) (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol) (slime-setup)))A note about the SLIME contribs that I load: Many "standard" contribs that people use are automatically loaded by the "slime-fancy" contrib (fuzzy-complete is one of them and I use that as my default completer). I'm fond of the SLIME startup animation (slime-banner) and the REPL ASDF load support (slime-asdf) and they aren't included in "slime-fancy", so I load them as well. If you don't want to load any contribs, the only thing you need to have here is:
(eval-after-load "slime" '(progn (slime-setup)))
- Miscellaneous functionality: Added the following lines so
that I have a couple of
shortcut keys for starting a SLIME CL connection and switching SLIME buffers:
;; Shortcut key for starting a SLIME CL connection (global-set-key [f5] 'slime)
;; Shortcut key for selecting SLIME buffers (global-set-key [(control f11)] 'slime-selector)
- It is much easier to read/understand the code behind specific SLIME functionality now (~2,000 lines of code have been removed from slime.el alone!), making it much more "hackable".
- It is easier to enable only the specific functionality that you want to use and you can ignore or delete contribs that you don't use.
- It is easier to add to contribs as there is a standard approach for adding a contrib and maintainers no longer have to fear "polluting" the core SLIME code base.
- Potentially, this could also mean that it will be easier to add maintainers to the SLIME project. By restricting specific maintainers to "contrib" code, there would no longer be the fear that they might inadvertently break core SLIME functionality.
Update-2007-09-28: Tobias Rittweiler mentioned on #lisp that (instead of using the "require" and "init" statements for the contribs as I showed in the example above) it is possible to use "slime-setup" to load and initialize all the contribs. So, for example, to replicate what I had above, one could do:
(eval-after-load "slime" '(progn (add-to-list 'load-path "/path/to/slime/contrib") (slime-setup '(slime-fancy slime-asdf slime-banner)) (setq slime-complete-symbol*-fancy t) (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))Much tidier! :-)