Slightly odd behavior when using cljx in ns declaration
samedhi opened this issue · comments
In terms of generated output files, cljx works perfectly.
However, in terms of the repl, I am getting some errors when putting cljx readers into the (ns ) declaration.
Reproduce by
git clone git@github.com:samedhi/cljx-ns-trouble.git
cd cljx-ns-trouble
lein repl-headless
open emacs
start up nrepl
and connect to your repl-headless session
Then visit the file at cljx/trouble.cljx
Within emacs try
Ctrl-c Meta-n
=> RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:219)
Ctrl-c-k
works fine but then if you Ctrl-x-e
on expression at line 4 you get => Namespace not found
You can circumvent the errors by evaluating the expressions (including the ns declaration) one at a time, or by removing the cljx code from the ns declaration.
Neither of these are REPL problems per se; emacs (cider, really) doesn't know anything about cljx, so C-c M-n
(and anything else that requires any tool to statically determine the namespace of a given file/buffer) is likely to not work if there are cljx annotations around the initial (ns ns-name ...
portion of the ns
form.
I don't really expect this to change, as tools have no idea what e.g. #+clj
means, outside of it looking just like any other reader tag.
Do you have a driving use case for rewriting the namespace name?
Actually, clojure-mode and such should really support things like reader literals, e.g. recognizing that #+foo (some-fn)
is a single expression, not two.
If this is still causing a headache, I'd suggest opening an issue with the appropriate clojure-emacs project.