views:

229

answers:

1

I just wanted opinion on good workflow using the emacs environment with clojure+swank+slime. I often find myself doing very repetitive keycommands and wonder if there is an obvious better way.

I include swank with lein and start my project using lein swank from shell. Then I connect with emacs and do the correct use commands so that I can start to use (run-tests ). Then I do some coding and then want to test.

To run the test I need to change buffer in emacs to the swank-repl C-x o, then I need to go to the prompt M->, then repeat the command M-p, then enter, maybe with an exception, then back to the code buffer and continue all over again with all the emacs commands. I find it a bit repetitive.

I guess the solution would be to start hack on emacs and maybe add a shortcut for doing this repetitive task, but I would love to hear some suggestions because I can't be the only one who find this tedious?

+8  A: 

The clojure-test mode allows almost instantaneous test-edit-test :

  • C-c t : will swap between test code and the implementation code
  • C-c C-, : runs the tests and highlights the line with the failing error
  • C-c C-l : reloads the current file after an edit

For this to work, your tests must follow a convention :

src/name/space/file_under_test.clj

and the testcases in

test/name/space/test/file_under_test.clj

Peter Tillemans
Thanks Peter. I will give that one a try.
grm
Managed to get it up and running and this was definitive a step forward. Once again thanks!
grm