Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLIME setup for both Common Lisp and Clojure development

I've been having trouble with setting up SLIME to work with both Clojure and Common Lisp. Most Clojure devs tend to use the stripped down SLIME available via ELPA that is frozen for Clojure compatibility. I, however, do a lot of Common Lisp hacking as well and I generally use the SLIME CVS version (obtained via QuickLisp).

There are some well known problems with the swank implementation for Clojure - it doesn't work with autodoc (if it's enabled SLIME freezes), it doesn't support some things like fuzzy-completion, etc. This question discusses the same subject the the answer suggested there is a no go for me.

(add-hook 'slime-connected-hook
          (lambda ()
            (if (string= (slime-lisp-implementation-type) "Clojure")
                (setq slime-use-autodoc-mode nil)
              (setq slime-use-autodoc-mode t))
            ))

(add-hook 'slime-mode-hook
          (lambda ()
            (if (eq major-mode 'clojure-mode)
                  (slime-autodoc-mode 0)
                (slime-autodoc-mode 1))))

(add-hook 'slime-repl-mode-hook
          (lambda ()
            (if (string= (slime-lisp-implementation-type) "Clojure")
                (progn (setq slime-use-autodoc-mode nil)
                       (slime-autodoc-mode 0))
              (progn (setq slime-use-autodoc-mode t)
                     (slime-autodoc-mode 1)))))

The solution looks great on paper, but for me slime-lisp-implementation-type is always nil. (same for slime-lisp-implementation-type:connlocal with local connections).

What I basically need is just a way to know I running SLIME with Clojure's swank to be able to modify the problematic settings.

like image 978
Bozhidar Batsov Avatar asked May 13 '11 13:05

Bozhidar Batsov


1 Answers

It seems that the solution to this problem was just created. It's called jack-in. Basically you just need to do three things:

  1. Install clojure-mode via git or Marmalade
  2. lein plugin install swank-clojure 1.3.1
  3. Invoke M-x clojure-jack-in from a project

This will bootstrap the supported SLIME automatically. You no longer need to install it via ELPA. I've wrapped my Common Lisp init in an interactive function that I can call when I need it, because loading the Clojure SLIME naturally messes up a few settings. It's not as ideal a solution as upstream Clojure support in SLIME, but it's much better than most alternative...

Update:

SLIME is no longer needed for Clojure development. I recommend you to use CIDER instead.

like image 65
Bozhidar Batsov Avatar answered Nov 06 '22 08:11

Bozhidar Batsov