Self Wright

Tag: slime

Fixing a SLIME/Swank version problem

Installing a bunch of packages willy-nilly resulted in this configuration problem for me: starting slime resulted in this frustrating error message: Versions differ (2014…) slime vs (2009…) swank

It asks you whether to continue. If you say ‘n’, sorry, no slime for you ! If you say ‘y’, no fancy slime for you; you have to be content with the Comint buffer mode

If you want to fix this, you’re going to have to fix a possible mismatch somewhere.

In my case, I ran locate swank-loader.lisp and found two instances: one under /usr/share/common-lisp/... and the other under /usr/share/emacs24/site-lisp/..., you will probably have different paths but similarly conflicting.

Running dpkg -S on the first, I found it came from the cl-swank package, so I uninstalled it.

Now, slime refused to start because it was trying to load the missing swank-loader.lisp file.

Luckily, this was simply a matter of running M-x customize-variable swank-backend and set it to the remaining path (e.g. in my case, "/usr/share/emacs24/site-lisp/google/slime/swank-loader.lisp")

After this, M-x slime worked as usual!

Using AllegroCL with Emacs

One way is the SLIME way — similar to any other lisp/scheme implementation, install it, set inferior-lisp-program, add (slime-setup '(slime-fancy)) to your .emacs, and run M-x slime. Boom! Done.

There is another way, using an Emacs Lisp connection suggested by Franz (the guys who sell AllegroCL).

You’ll need to add this to your Emacs file (depending on when and what you download, your path may be slightly different):

(load-file "/Applications/")

This done (and loaded), run fi:common-lisp. The first time you do this, it’ll ask you which buffer name to use (use the suggested default), the host (leave it set to the default, localhost — though this should illustrate how easy a remote session would be!), a process directory (pick some local directory, say ~/lisp/ ?) and paths to the image name and image file, which will correspond to alisp and alisp.dxl respectively, in the app’s directory.

At this point, you should see something like this:

Allegro CL  Emacs

Allegro CL Emacs

Now at this point, it’s a matter of getting comfortable in the environment. Obvious similarities to Slime include the appearance of the function’s argument list once you press space after the name of the function. It might help to think of this as a sort of combination of Slime and Paredit. So for example, C-c ] acts as a “super parenthesis”, adding as many closing parentheses as needed.

Here are a few other “helpers”:

  • M-D => Describe symbol
  • C-c i => Insert the argument list of the function
  • C-c f => Lookup the function reference in a browser (defaults to Safari on OSX)
  • C-c Tab => Autocomplete name under cursor
  • C-c ? => Apropos
  • C-c c => List callers

… and so on. Ultimately, the whole point is just to make writing, running and debugging code easier!

(Disclaimer: this isn’t necessary at all; AllegroCL comes with an IDE (though you’ll need to install X11 to use it). Since I’m used to using Emacs in general and haven’t used an IDE for a while now, this is something I prefer, but everything here is entirely a matter of personal preference!)

Minor changes to the setup

As a followup to my initial getting started post:

* I later replaced the Clozure App with the command-line version, obtained by

`svn co`

  • The basic slime (running in comint mode) is a bit too bare-bones, and it’s much better to add

`(setq slime-contribs ‘(slime-fancy))`

Getting Started on OSX

Here’s what I did, though perhaps a better order of steps exists:

  • Downloaded Emacs for OSX

  • Downloaded ClozureCL from the Mac App Store.

  • Downloaded Quicklisp

  • Ran ClozureCL, then “File -> Load File …”, and selected quicklisp.lisp downloaded earlier.

  • Ran (quicklisp-quickstart:install)

  • Ran (ql:add-to-init-file) to make sure I don’t have to repeat this step again

  • Ran (ql:quickload :quicklisp-slime-helper). This downloaded SLIME and told me what to add to my .emacs:

`(load (expand-file-name “~/quicklisp/slime-helper.el”))`

  • Made a useful symlink:

  `ln -s /Applications/Clozure ~/bin/ccl`

  • Added a reference to this in my .emacs:

`(setq inferior-lisp-program “~/bin/ccl”)`

  • Ran emacs, M-x slime works !

(or as the prompt says, “Happy hacking!”)


Powered by WordPress & Theme by Anders Norén