2

The way that I'm reloading the nrepl in Clojure seems too bulky.

When I load a Clojure project and nrepl, I:

  • Create a keyboard macro to input and return something like (use 'my-namespace.core :reload).
  • Next I bind the keyboard macro to something else, usually C-tab.
  • Finally, every time I switch into the nrepl, I execute C-tab, and the repl reloads.

This seems like a lot of unnecessary work. I've looked around at getting the namespace programmatically, or with C-c C-e, but nothing seems to fit quite right.

Isn't there an easier way?

Thanks.

  • If you press , and then clear doesn't it do what you want? Alternatively, maybe , and then ns? – wvxvw Sep 3 '15 at 21:30
  • Those are nice, thanks, but they don't reload the repl, by which I mean load the saved s-expressions into the repl. So that if one newly wrote (def life-means? 42) in their file they would be able to save that file, write life-means? in the repl, and get back 42. – Mallory-Erik Sep 4 '15 at 4:09
1

An easier way is to just load your current file:

(define-key clojure-mode-map
    (kbd "C-c C-l") 'cider-load-file)

It's also possible to keep (use 'my-namespace.core :reload) in your file, navigate there with isearch and C-c C-e.

Personally, I almost never use a REPL and evaluate either the whole buffer with C-c C-l or single expressions with e (via lispy).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.