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.


Join the 80/20 DevOps Newsletter

If you're an engineering leader or developer, you should subscribe to my 80/20 DevOps Newsletter. Give me 1 minute of your day, and I'll teach you essential DevOps skills. I cover topics like Kubernetes, AWS, Infrastructure as Code, and more.

Not sure yet? Check out the archive.

Unsubscribe at any time.