Good workflow with emacs+swank+slime+clojure?
Asked Answered
K

1

11

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?

Knp answered 13/6, 2010 at 21:12 Comment(2)
This question has been asked many times - here's the most recent duplicate - https://mcmap.net/q/494062/-efficient-clojure-workflowAgro
Thanks, found a couple of interesting tips there.Knp
B
12

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

Baskin answered 13/6, 2010 at 21:28 Comment(3)
Thanks Peter. I will give that one a try.Knp
Managed to get it up and running and this was definitive a step forward. Once again thanks!Knp
For me this is C-c C-t.Preuss

© 2022 - 2024 — McMap. All rights reserved.