cb codes

Cider Refresh And Undefining Vars

A neat trick I learned a few months back is that you can reset all of your Clojure namespaces in the repl you're working on if you're using Emacs + Cider. Just use M-x cider-refresh.

That command 'refreshes' your repl by undefining the vars and reloading them.

This way, if you have run-away code in your repl state, you can refresh it without doing a cider-restart.

This comes in handy especially when you're writing tests with clojure.test. Let's say you have a few tests written and delete one. If you evaluate the namespace again, the test you deleted is still defined and will run every time you run the tests in that namespace.

So you have two options. Refresh the namespace or, alternatively, cider-undef the var.