2

I am working in emacs, swank-clojure. I start my repl using clojure-jack-in. However when I add a new dependency to my project.clj, the dependency is not available in the repl.

1) Is there a way to load new dependencies automatically in swank, when project.clj changes ?

2) Also what is a clean way to terminate the swank server ? Currently I just kill the buffer.

Thanks, Murtaza

murtaza52
  • 46,887
  • 28
  • 84
  • 120

1 Answers1

1

When Java VM starts it reads all the included jars there is straight-forward way to include jars later. If you really don't want to restart application you could try something like this. But it may get very tricky as if you don't use same class loader as Clojure does then when loading another Clojure library you may end up with 2 instances of Clojure core.

To disconnect from swank server use M-x slime-disconnect. To stop publishing on the server you can issue:

(swank.swank/stop-server)
Community
  • 1
  • 1
Ivan Koblik
  • 4,285
  • 1
  • 30
  • 33
  • 1
    Thanks for the answer. When should slime-disconnect be used ? What is its utility? – murtaza52 Sep 11 '12 at 07:00
  • 1
    It simply disconnects emacs from your application, you can always reconnect with slime-connect (depends on your emacs configuration). – Ivan Koblik Sep 11 '12 at 07:09
  • 1
    So stop-server, and then clojure-jack-in will reload the deps in the JVM ? – murtaza52 Sep 11 '12 at 08:33
  • 1
    Why yes, this should do it :) – Ivan Koblik Sep 11 '12 at 10:17
  • Thanks again. stop-server is not a function that is avalaible by M-x stop-server, do I need to define the above form (swank.swank/stop-server) as a function in my .emacs file ? – murtaza52 Sep 11 '12 at 10:20
  • Let me correct myself, as far as I understand clojure-jack-in launches new instance of the application. To get rid of the old instance you're better off executing (System/exit 0). Just switch to slime-repl buffer and execute this expression. – Ivan Koblik Sep 11 '12 at 10:21
  • 1
    let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/16536/discussion-between-ivan-and-murtaza52) – Ivan Koblik Sep 11 '12 at 10:24
  • The answer provided in chat is that write (System/exit 0) in the slime repl, this will send a shutdown message to the JVM. This will shutdown both the JVM and swank (which is connection to the JVM). Now doing clojure-jack-in will again load a new JVM. – murtaza52 Sep 11 '12 at 10:52