views:

246

answers:

4

My superficial understanding is that 'swank-clojure' makes 'M-x slime-connect' possible. I mean, it gives a connection to a clojure server something like 'lein swank'. Is my understanding correct? If not, what's the purpose of swank?

Then, is there any 'swank-SOMETHING_ELSE' for other lisp like implementations? For example, swank-clisp?

Do I need 'swank-clojure' for using SLIME/Clojure with 'M-x slime'?

ADDED

I found this link pretty useful.

+1  A: 

My understanding is that slime is the emacs part(the client), swank is the common lisp part(the server), swank-clojure is the clojure implementation of the swank server, not the original.

pavelludiq
+4  A: 

swank-clojure.el is deprecated. Don't use it.

You need slime.el and you need to have swank-clojure "1.2.1" in your dev-dependcies in your project.clj file.

Swank is basically a server that you use slime to connect to from emacs. It it passed, from emacs, what you want run by the Lisp process that it's running.

You should use M-x slime-connect to connect to a swank server after starting with with lein swank.

Isaac Hodes
@Issac : I'm a little bit confused: swank-clojure is only for 'M-x slime', not 'M-x slime-connect', is that correct? Or swank-clojure "1.2.1" for 'M-x slime-connect' is a different something?
prosseek
swank-clojure is both a .el file (you don't want that: swank-clojure-1.1.0/ = bad) and a .clj file (which you want version 1.2.1 of. The clj file is used to start up the swank server, with lein. You use `M-x slime-connect` to connect to the swank server you started with `lein swank`, which used swank-clojure (the clojure file) to start up.
Isaac Hodes
It's a little confusing…
Isaac Hodes
slime-connect is in slime.el, not swank-clojure.el
Isaac Hodes
+12  A: 

SLIME and swank form a client server architecture to run and debug lisp programs. SLIME is the emacs frontend and swank is the backend. In between they create a network socket and communicate by sending across messages (S-expressions). In short it is just an RPC mechanism between emacs and the actual lisp backend.

The fact that the slime and swank are separate, are connected over a network and communicate via rpc messages means that they can be anywhere. So, slime can connect to a remote host/port to swank. All other forms you see (lein swank etc etc) do the same. They start swank on a port allowing for a remote conection of slime.

swank-clojure is the clojure port of swank. originally swank-clojure came with a helper elisp file called swank-clojure.el. The job of this file was to enable manual setup of swank parameters like the classpaths, jvm parameters etc. Since other tools like lein came along later, swank-clojure.el was deprecated. But it still lives on at: http://github.com/vu3rdd/swank-clojure-extra and provides the M-x swank-clojure-project which enables starting swank on a lein project.

It should be noted that SLIME originated (and is still being actively developed for) Common Lisp. Infact, the clojure port of swank only has a subset of the features enjoyed by the original SLIME/swank versions. SLIME exists for all major variants of Common Lisp. There is a partial port of it for Scheme48. There are some partial implementations available under the contrib directory.

If you know that swank is already running on a port, use slime-connect. If you just want to use slime on a project, swank-clojure-project and lein swank seem to be the way to go.

Ramakrishnan Muthukrishnan
@rkrishnan : I asked about the swank of other Lisp implementation <a href="http://stackoverflow.com/questions/3548169/equivalent-of-lein-swank-to-other-lisp-scheme-implementations-with-emacs-slime">here</a>. Can I use clisp with swank? If so, how?
prosseek
Nice answer, +1. Note that the Clojure version of Swank is also being actively developed, though I don't know that many people are working on it. Clojure's growing, but the environment that CL has developed over the ages is pretty awesome.
Isaac Hodes
prosseek: I added a comment to the other post you referenced. Please have a look. I will be glad to help you.Isaac: Thanks. Yes, it will be nice if more slime/swank features from upstream is ported over here. CL is absolutely awesome. There may be things which could be difficult to do in swank-clojure like the stack trace and ways to abort/continue, examine locals across the stack. Perhaps integration with JDI can help?
Ramakrishnan Muthukrishnan
+2  A: 

Swank is the server counterpart to swank clients like emacs SLIME and the MCLIDE lisp development environment for Macintosh. Swank servers exist for many Common Lisp implementations and Lisp dialects such as Clojure and Gambit/scheme.

Terje Norderhaug