Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good workflow with emacs+swank+slime+clojure?

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?

like image 221
grm Avatar asked Jun 13 '10 21:06

grm


1 Answers

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

like image 81
Peter Tillemans Avatar answered Sep 26 '22 23:09

Peter Tillemans