Closed
Description
Hi, while working on https://github.com/scicloj/clay (we have Clojure file parser tests there) I hit a problem, so
I have code like this in a file
(ns wtf)
(def foo
"
(ns bar)
"
)
Expected behavior
foo evals to #'wtf/foo
Actual behavior
#'user/foo
Steps to reproduce the problem
put the code above into a file, start repl, eval it in cider
Environment & Version information
CIDER version information
;; CIDER 1.16.0 (Kherson), babashka.nrepl 0.0.6-SNAPSHOT
;; Babashka 1.3.191
Lein / Clojure CLI version
Babashka 1.3.191
Emacs version
29.4
Operating system
Ubuntu 22.04
JDK distribution
Babashka 1.3.191
The problems is the regex used in cider-ns-form-p
- "^[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)"
treats namespace in a string as a real namespace, so cider-interactive-eval
evals it in user
namespace instead of the current one.
I tried to fix it by myself but unfortunately, Emacs regexes don't support look ahead, so probably we should discuss the way it should be fixed.