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.

Iqbal Ansari
  • 7,468
  • 1
  • 28
  • 31
Mallory-Erik
  • 265
  • 1
  • 7
  • If you press `,` and then `clear` doesn't it do what you want? Alternatively, maybe `,` and then `ns`? – wvxvw Sep 03 '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 04 '15 at 04:09

1 Answers1

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).

abo-abo
  • 13,943
  • 1
  • 29
  • 43