I am developing a pet project with Clojure, but wonder if I can speed up my workflow a bit.
My current workflow (with Compojure) is:
- Start Swank with
lein swank
. - Go to Emacs, connect with
M-x slime-connect
. - Load all existing source files one by one. This also starts a Jetty server and an application.
- Write some code in REPL.
- When satisfied with experiments, write a full version of a construct I had in mind. Eval (
C-c C-c
) it. - Switch REPL to namespace where this construct resides and test it.
- Switch to browser and reload browser tab with the affected page.
- Tweak the code, eval it, check in the browser.
- Repeat any of the above.
There are a number of annoyances with it:
- I have to switch between Emacs and the browser (or browsers if I am testing things like templating with multiple browsers) all the time. Is there a common idiom to automate this? I used to have a JavaScript bit that reloads the page continuously, but it's of limited utility, obviously, when I have to interact with the page for more than a few seconds.
- My JVM instance becomes "dirty" when I experiment and write test functions. Basically namespaces become polluted, especially if I'm refactoring and moving the functions between namespaces. This can lead to symbol collisions and I need to restart Swank. Can I undef a symbol?
- I load all source files one by one (
C-c C-k
) upon restarting Swank. I suspect I'm doing it all wrong. - Switching between the REPL and the file editor can be a bit irritating, especially when I have a lot of Emacs tabs open, alongside the browser(s).
I'm looking for ways to improve the above points and the entire workflow in general, so I'd appreciate if you'd share yours.
P. S.
I have also used Vimclojure before, so Vimclojure-based workflows are welcome too.