Search code examples
emacsclojureslimeswank

What does the 'swank-clojure' do exactly, and do we have 'swank-SOMETHING_ELSE'?


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.


Solution

  • 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 connection 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 in (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.