Closed
Description
This error occurs when there's some buffer in clojure-mode
with an invalid ns declaration (such as (ns )
.
It seems that the culprit is clojure-find-ns
(see the stacktrace below), which does not fail gracefully if it can't identify the ns in a buffer. It's not clear from its docstring if throwing an error is its expected behaviour when the ns form is invalid. That's why I'm opening the bug in this repo - I'm not sure if this situation should be handled by cider
or clojure-mode
, but it does affect cider.
I use Spacemacs, if that's relevant.
Expected behavior
Cider would jack in without errors.
Actual behavior
I got this error (I'm using toggle-debug-on-error
):
Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 5 6)
scan-sexps(5 1)
forward-sexp(1)
clojure-forward-logical-sexp()
clojure--find-ns-in-direction(backward)
clojure-find-ns()
cider-current-ns()
cider-refresh-dynamic-font-lock()
cider-mode(1)
cider-enable-on-existing-clojure-buffers()
#f(compiled-function () #<bytecode 0x477bb459>)()
#f(compiled-function (buffer) #<bytecode 0x4770c08d>)(#<buffer *cider-repl nu/timeline:localhost:63972(pending-cljs)*>)
#f(compiled-function (response) #<bytecode 0x4770c109>)((dict "id" "4" "session" "f0733cfc-31b2-4759-bb10-2416c787fa6f" "status" ("done")))
#f(compiled-function (response) #<bytecode 0x4770c151>)((dict "id" "4" "session" "f0733cfc-31b2-4759-bb10-2416c787fa6f" "status" ("done")))
nrepl--dispatch-response((dict "id" "4" "session" "f0733cfc-31b2-4759-bb10-2416c787fa6f" "status" ("done")))
nrepl-client-filter(#<process nrepl-connection> "d2:id1:47:session36:f0733cfc-31b2-4759-bb10-2416c787fa6f5:value3:niled2:id1:42:ns11:shadow.user7:session36:f0733cfc-31b2-4759-bb10-2416c787fa6fed2:id1:47:session36:f0733cfc-31b2-4759-bb10-2416c787fa6f6:statusl4:doneee")
Steps to reproduce the problem
- Create a clojure buffer with the following content:
(ns
). - Use
cider-jack-in-cljs
in a shadow project (I don't know ifshadow
is relevant for the issue) - Select
shadow
and the app profile
Environment & Version information
CIDER version information
Include here the version string displayed when
CIDER's REPL is launched. Here's an example:
;; CIDER 0.25.0snapshot (package: 20200521.627), nREPL 0.7.0
;; Clojure 1.10.0, Java 13.0.1
Emacs version
GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.5.0, NS appkit-1671.40 Version 10.14.4 (Build 18E226)) of 2019-08-30
Operating system
Mac OS 10.15.4