udit
udit

Reputation: 2783

Executing >1 line of Clojure code in the REPL from Emacs

I'm following the clojure tutorial here and it shows me how to execute one line of clojure code in the repl by invoking C-x C-e at the end of the line. Now how would I execute more than 1 line of clojure code...for example...if I was in a clojure file with lots of code but I only wanted to execute a subset in the REPL....any way to do that?

eg.

...
...
(defn hello-world
 []
 (printf "Hello World")
)
(hello-world)
;; I'd like to execute the previous 5 lines with a key combination
...
...

```

Upvotes: 1

Views: 195

Answers (2)

Dave Liepmann
Dave Liepmann

Reputation: 1369

  1. Select all the sexps you want to evaluate.
  2. M-x cider-eval-regionto evaluate all those statements in order.

Upvotes: 1

Shlomi
Shlomi

Reputation: 4748

The shortcut C-c C-c executes the entire sexp your on, the top-level form. see all shortcuts for cider here

Upvotes: 1

Related Questions