Equivalent of 'lein swank' to other Lisp/Scheme implementations with emacs/slime
Asked Answered
W

4

4

I've been using emacs/slime for coding lisp, but with Clojure I found 'lein swank'. I must say that it's pretty useful, as I can connect to a server that runs clojure.

How about the other Lisp implementations? What Lisp implementations provide the equivalent of 'lein swank' in Clojure? I mean, is there any other Lisp implementations that provide server connectivity so that I use 'M-x slime-connect', not just 'M-x slime'?

Warship answered 23/8, 2010 at 13:47 Comment(0)
I
4

Non-clojure swank backends don't need a lein swank equivalent since they can just launch a lisp instance and change its load-path at runtime to make it work for a given project. That approach doesn't work with Clojure since the JVM's classpath can't be modified at runtime.

Imperturbation answered 23/8, 2010 at 16:59 Comment(1)
Note, you can now change the classpath at runtime using github.com/cemerick/pomegranate pomegranate or dj github.com/bmillare/dj. With dj you can even change the sys_paths at runtime with a small hack for hotspot jvms. The only thing you cannot change at runtime is the ld_library_path.Erasure
P
2

I don't know about clisp, but this is what I have for SBCL. This co-exists with my clojure swank setup as well. I don't use ELPA and instead have a completely manual setup.

(add-to-list 'load-path "~/src/slime")
(require 'slime)
(add-to-list 'slime-lisp-implementations '(sbcl ("/usr/local/bin/sbcl")))
(setq slime-default-lisp 'sbcl)

I have a hand compiled SBCL. I see a swank backend for CLISP in the SLIME CVS codebase, so I guess, changing slime-default-lisp and slime-lisp-implementations to clisp probably will just work.

lein swank mainly exists for starting swank port on a particular project. This is needed because JVM classpaths cannot be modified at runtime. So, we start java with classpaths set to our project directories and dependencies using lein swank or swank-clojure-project. With CL, this is not necessary, as pathnames can be modified during runtime.

I have posted the complete config file at: http://github.com/vu3rdd/dotfiles

I will be glad to help setting up a fully manual emacs/slime/swank setup.

Pledge answered 23/8, 2010 at 20:51 Comment(1)
@rkrishnan : I got the point, actually what I wanted to know was how to run swank remotely something like 'lein swank'. But, I guess it's just OK to run swank locally, not remotely. Thanks for the help.Warship
W
1

You can load swank manually in CL and start the server (slime/swank were created for CL after all).

Wilkey answered 23/8, 2010 at 15:42 Comment(0)
S
0

Fire up the Lisp implementation, load Swank (via Quicklisp, for example), and run swank:create-server:

CL-USER(1): (ql:quickload "swank")
;; ...
CL-USER(2): (swank:create-server)
;; Swank started at port: 4005.
4005

If you want to specify a different port, you can do so by using the :port keyword argument:

CL-USER(3): (swank:create-server :port 4123)
;; Swank started at port: 4123.
4123

Note that since the protocol tends to change between versions, you need to make sure that you are not using wildly different versions of SLIME and Swank. For Common Lisp, I tend to use the versions from Quicklisp by putting something like the following into my .emacs, depending on the version of SLIME currently available in Quicklisp:

(add-to-list 'load-path "~/quicklisp/dists/quicklisp/software/slime-20111105-cvs")
(add-to-list 'load-path "~/quicklisp/dists/quicklisp/software/slime-20111105-cvs/contrib")
Sharronsharyl answered 17/2, 2012 at 8:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.