-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cider-jack-in fails when cider-enlighten-mode is enabled #1947
Comments
You can observe this in
You get the response from the nrepl eval:
So it is a bug in our invocation of read. Something is throwing an error in start up. I don't know if its fatal or not. But then we are calling So a short term fix is to prevent reading on nil and a long term fix is to figure out why we are in a bad state here. |
And the problem is that enlighten mode evals things with the debugger. The debugger is initialized on item 6 of CIDER startup. Evaling the current ns for the repl is item 4. So we try to eval with the debugger before the debugger has been initialized and there's where we get our error. |
We should probably make enligthen-mode do nothing in the absence of a connection. |
Its not that there's not a connection, it's that enlighten hijacks eval but we eval things before the hijack has been fully set up. There's a function called
So we could do one of a few things:
|
I think I like option 2 more as a potential solution. |
@dpsutton Try using backquote and (nconc (and ns `("ns" ,ns))
`("op" "eval"
"code" ,input)
(when cider-enlighten-mode
'("enlighten" "true"))
(let ((file (or (buffer-file-name) (buffer-name))))
(when (and line column file)
`("file" ,file
"line" ,line
"column" ,column)))) |
Sounds good. I was just quoting preexisting code in this case though. |
When initializing the repl, we ask what namespace we are in by evaling code, eg (eval "(str *ns*)"). However, enlighten mode hijacks eval messages in the middleware and uses the debugger on them which causes an error if the debugger is not yet initialized.
When initializing the repl, we ask what namespace we are in by evaling code, eg (eval "(str *ns*)"). However, enlighten mode hijacks eval messages in the middleware and uses the debugger on them which causes an error if the debugger is not yet initialized.
When initializing the repl, we ask what namespace we are in by evaling code, eg (eval "(str *ns*)"). However, enlighten mode hijacks eval messages in the middleware and uses the debugger on them which causes an error if the debugger is not yet initialized.
…ization When initializing the repl, we ask what namespace we are in by evaling code, eg (eval "(str *ns*)"). However, enlighten mode hijacks eval messages in the middleware and uses the debugger which causes an error if the debugger is not yet initialized, ie, in `cider-repl-init`. So we inhibit this feature. The reason I am doing this let binding rather than just reordering is that reordering is brittle and doesn't convey that this order is very important. While its kinda gross that we are dynamically altering this variable several call stacks up, this is a very special case right at startup and not complicated logic during the principal use of CIDER.
Expected behavior
cider-jack-in
results in a buffer with a REPL promptActual behavior
The minibuffer pops up with
Lisp expression:
. Entering anything there results inThis shows up in nrepl-messages:
The user gets an empty repl buffer, but pressing enter does bring up a prompt. Except that it shows
nil
as the namespace.Steps to reproduce the problem
Open a Clojure file,
M-x cider-enlighten-mode
,M-x cider-jack-in
.CIDER version information
Emacs version
GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9) of 2016-11-04
Operating system
Ubuntu 16.04.2 LTS
The text was updated successfully, but these errors were encountered: