Eval of form runs entire file unless I switch to namespace in repl

115 Views Asked by At

I am using this, and I think I have some odd behavior. I open a repl at the project root (foons), open a file (ex.clj) file with vim in the project, and then eval the following (both with <,>Eval and cpp inside the form) :

(clojure.core/in-ns 'foons.ex)

When I do this, it seems that the whole file gets evaluated, not just the form I select, which I think is incorrect.

However, if I change to foons.ex namespace in the repl I launched, and do the same in-ns command inside of Vim, I get the expected behavior, and just the form evaluates, not the whole file.

Is this a bug, or do I possibly have something configured wrong?

Specs:

Leiningen 2.9.1 on Java 13.0.1 Java HotSpot(TM) 64-Bit Server VM

Clojure: 1.10.0

nrepl: 0.6.0

I also opened bug here: https://github.com/tpope/vim-fireplace/issues/373

1

There are 1 best solutions below

0
mpettis On

This question was answered in the github issue I filed here: https://github.com/tpope/vim-fireplace/issues/373

To summarize the answer, it is behaving as designed. From the issue:

If I understand correctly it is working as intended. Fireplace's :Eval always happens inside the current file's namespace, which means we need to require it beforehand if it isn't already defined.