Evaluate Clojure namespace in *nrepl* buffer in emacs

532 views Asked by At

After creating a project with lein new, I open my core.clj in emacs and launch nrepl.

The *nrepl* buffer shows up and looks something like this:

; nREPL 0.1.6-preview
user> 

Okay, but now I want to change the namespace, so I decide to evaluate or C-c C-e the namespace expression. Assume the expression in core.clj looks something like this:

(ns my-project.core)

Yet, nothing happens in the *nrepl* buffer. If I want, I can evaluate the namespace expression by entering it directly inside the *nrepl* buffer, and everything runs smoothly.

My question is: Why wouldn't I be able to evaluate a namespace expression by using C-c C-e? And if this is the normal, and correct behavior, I would like to know its rationale as well as an elisp workaround to get my desired behavior.

1

There are 1 answers

0
Michiel Borkent On BEST ANSWER

Type C-c M-n:

https://github.com/clojure-emacs/nrepl.el

Switch the namespace of the repl buffer to the namespace of the current buffer.