Common Lisp programmers are blessed with the awesome SLIME development environment for Emacs; but sadly Schemers have nothing comparable. There are a few SLIME backends for various Schemes around, in varying states of completeness, but as far as I can tell none for my Scheme implementation of choice: Chicken Scheme.
Therefore I present swank-chicken: a SWANK server written in Chicken Scheme. (SWANK is the protocol SLIME uses to talk to the inferior Lisp process.) I’ve been hacking it together over the past week or two and it’s now reached the point where it is more or less usable. Click on the screenshot below for an example:
Supported features so far:
- REPL support with input/output (i.e.
writework as expected)
- Complile region and load file commands (e.g. C-c C-l, C-c C-c)
- Basic SLDB support with back trace
- Parameter argument hints in the minibuffer
Huge swathes of SLIME features are obviously missing at the moment, but the most useful ones are there. In particular, I think it’s at least as functional as the normal inferior-scheme mode. The most significant omission at the moment is support for interrupting Scheme evaluation from Emacs – C-c C-c at the REPL will currently kill the backend process completely. Naïvely this should be implemented in the same way as the debugger-abort command: by calling the top-level continuation. However, perhaps unsurprisingly, calling a continuation from a Scheme SIGINT handler turns out to be a bad idea. So if you have a runaway process you must kill and restart it with
C-c C-c M-x slime-restart-inferior-lisp.
UPDATE: some of these issues have been fixed.
To get started clone the git repository using:
git clone git://github.com/nickg/swank-chicken.git
First we need to install a few Chicken extensions:
chicken-install format symbol-utils
Obviously you also need to install SLIME: I’ve been using the latest code from CVS but older versions should work too.
Next, place chicken-slime.el somewhere in your Emacs load-path and add the following to your .emacs:
(autoload 'chicken-slime "chicken-slime" "SWANK backend for Chicken" t) (setq swank-chicken-path "/path/to/swank-chicken.scm") (add-hook 'scheme-mode-hook (lambda () (slime-mode t)))
Now you should be able to use SLIME commands in a Scheme buffer. To start a Scheme REPL do
That’s it! Let me know if you have any problems/suggestions. I intend to do some more work on this and package it up as an Egg. The code is available under the MIT license.