1

I have slime configured for emacs and I can run many different implementations of common lisp. What about running a language like clojure?

I tested this out by modifying my .emacs file:

(add-to-list 'load-path "~/slime/")  ; your SLIME directory                                                                                                                                                              
(setq slime-lisp-implementations
     `((sbcl ("/usr/bin/sbcl"))
       (clojure ("/usr/bin/clojure"))
       (ecl ("/usr/bin/ecl"))
      (clisp ("/usr/bin/clisp" "-q -I"))))
;(setq inferior-lisp-program "/usr/bin/sbcl") ; your Lisp system                                                                                                                                                         
(require 'slime)
(slime-setup '(slime-fancy))

It seems to work however there is an exception:

(progn (load "/home/d2b2/slime/swank-loader.lisp" :verbose t) (funcall (read-from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "/tmp/slime.19396"))

Also I get a strange message in the mini-buffer:

polling "/tmp/slime2.4708" .. ddd (Abort with M-x 'slime-abort-connection'.) where ddd is a timer increasing in seconds.

Clojure 1.1.0
user=> java.lang.Exception: Unable to resolve symbol: progn in this context (NO_SOURCE_FILE:1)
user=> user=> 

I decided to run a commonlisp interpreter and compare. This is what I get from the sbcl interpeter before I get a prompt:

(progn (load "/home/d2b2/slime/swank-loader.lisp" :verbose t) (funcall (read-from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "/tmp/slime.19396"))

This is SBCL 1.0.55.0.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
*
; loading #P"/home/d2b2/slime/swank-loader.lisp"
STYLE-WARNING: redefining EMACS-INSPECT (#<BUILT-IN-CLASS T>) in DEFMETHOD
STYLE-WARNING:
   Implicitly creating new generic function STREAM-READ-CHAR-WILL-HANG-P.
WARNING: These Swank interfaces are unimplemented:
 (DISASSEMBLE-FRAME SLDB-BREAK-AT-START SLDB-BREAK-ON-RETURN)
;; Swank started at port: 57199.
57199
* STYLE-WARNING:
   redefining THREAD-FOR-EVALUATION (#<STRUCTURE-CLASS
                                       MULTITHREADED-CONNECTION>
                                     #<SB-MOP:EQL-SPECIALIZER
                                       {1004A8CC43}>) in DEFMETHOD

Then the common lisp interpreter appears.

  1. How do I setup a clojure repl with slime or how can I fix my small issue?

2 Answers2

1

There was a swank-clojure project for using SLIME with Clojure but it's now deprecated in favor of nrepl.el. My recommendation would be to check out nrepl.el.

nrepl is the de facto repl for Clojure, and with nrepl.el it has similar functionality to SLIME - you run a REPL in Emacs, send code to it from your buffer(s), can jump quickly to definitions, get dynamic code completion, etc. The only place I've found it a bit lacking compared to SLIME is debugging, but swank-clojure didn't support SLIME's debugger anyway.

jbm
  • 146
1

As far as I know, clojure-swank is no longer maintained; the preferred way of interacting with Clojure from Emacs is through nrepl.

You can check our installation instructions for that approach here; they look extremely simple (though admittedly, I haven't tried them since I haven't used Clojure in a while).

Inaimathi
  • 469