clagccs
clagccs

Reputation: 2324

Is there a fast way for connect clojure swank and slime for a fast repl in emacs?

I've a question:

When I use emacs with clojure and elein (leiningen extension) I write my code inside a file, then I need connect to swang, I type "elein swank" and open the conexion...2 step) I open a repl...3) I type slime-connect (and press y two times) 4) this step is really annoying: I need use my file or change the namespace...

so far so good..the problem is if inside my file there is a little mistake (maybe a parentheses) now I insult my code and I've repeat all steps...again!!

for me this is really annoying, I really like emacs, I've used this for long time and is the best editor, but comparing this to netbeans (I try this today..It's nice but its repl suck...) with netbeans I only need ONE click for do all these steps...

I can press "load file" and this load my file inside repl....seriously!! and if I press refer alias/file in NS it open the repl and change the namespace...so good

now..my question is if is possible create a command inside emacs than make everything..maybe and it would be really nice..a command than open a repl and load my file or my ns...would be great...is it possible?...has someone do it??..thanks

thanks a lot a have a good day!!

Upvotes: 4

Views: 351

Answers (3)

redcartel
redcartel

Reputation: 402

You might want to try out swank-clojure if you aren't already.

With swank-clojure you just M-x clojure-jack-in and it loads the REPL. If you call it from within a project.clj file, it makes all the namespaces of your project available. It takes a few seconds to start, but after that it's very easy and you don't have to reload.

Upvotes: 2

sanityinc
sanityinc

Reputation: 15212

elein-swank should automatically connect to the swank backend after starting it for you. There was a recently-fixed bug which prevented this for some swank-clojure versions, so you might want to update your elein.el to the latest version.

You can use elein-reswank to restart the backend and reconnect to it if necessary.

Once it's running, C-c C-k will compile and load a .clj file in the backend. C-c C-z will flip you to the REPL from any clojure source buffer.

Hopefully those tips will help to streamline your emacs/slime experience -- it's really a nice working environment, so stick with it if you can! :-)

Upvotes: 5

Alex Ott
Alex Ott

Reputation: 87069

Why you need to reload everything if you made one typo? You just need to run lein swank once and connect to swank using slime-connect... And then you can load and evaluate your code as you want. To (re-)load your file you can use slime-load-file command, that is bound to C-c C-l...

You can also to look to M-x clojure-jack-in command from fresh clojure-mode...

P.S. I personally run swank sessions for a whole day (and sometime several days), without leaving it, writing new code, evaluating it, etc.

Upvotes: 1

Related Questions