9
votes

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.

2
What OS are you on? I got this working in Mac OS X (although it probably works in Linux too) and blogged about it here spacemanaki.posterous.com/… and answered this question stackoverflow.com/questions/4551283/… The only way I could get it to work was to have both the latest CVS SLIME and the ELPA SLIME and load the appropriate one depending on whether I was working on Common Lisp or Clojure.michiakig
I'm using Linux. I'm aware of the solution that you propose, but I don't like it - I just want to use CVS SLIME all the time. I could have a simple function that toggles what I need before I make clojure connections, but I'd prefer to find a way to hook such settings automatically into slime's startup.Bozhidar Batsov
I don't like it either, but it works. I'll be keeping an eye on this thread to see if someone suggests something better, for now I've given up shaving this particular yak.michiakig

2 Answers

4
votes

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.

0
votes

This is a step by step guide to setting up SLIME for Clojure in Emacs (gathered from http://technomancy.us/126 and other sources). It does not interfere with your existing CommonLisp or Scheme setup:

http://languageagnostic.blogspot.com/2011/05/clojure-in-emacs.html