Skip to content
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

Eval into self-started clojure CLI REPL fails #183

Open
seancorfield opened this issue Aug 28, 2020 · 8 comments
Open

Eval into self-started clojure CLI REPL fails #183

seancorfield opened this issue Aug 28, 2020 · 8 comments

Comments

@seancorfield
Copy link

Expected behavior

Open a Clojure file, do M-x inf-clojure and provide clojure as the startup command. You get a plain CLI REPL (and you can type into it just fine and it evaluates correctly). Switch back to the Clojure file, put the cursor after a form and eval it C-c C-e. I expect the REPL to display the result of evaluating that form, and I expect to be able to type into the REPL as well, to evaluate new forms.

Actual behavior

C-c C-e causes the REPL to display a very long line of control g characters ^G^G^G^G^G^G^G... and the REPL then becomes unresponsive (you can still type into it, but nothing evaluates).

Note: using a Socket REPL and inf-clojure-connect works correctly -- the problem only seems to happen for a self-start CLI REPL.

Steps to reproduce the problem

See above.

Environment & Version information

inf-clojure version information

3.0.0

Lein/Boot version

n/a; using Clojure CLI 1.10.1.645 (installed via brew)

Emacs version

27.1 (from emacsforosx.com)

Operating system

macOS 10.12

@dpsutton
Copy link
Contributor

@seancorfield i'm unable to reproduce this. can you say what OS this is? I know you're a user of WSL and i'm wondering if its related to something funky here?

can you also try (setq inf-clojure-log-activity t) and then try this again? this should create a log file called .inf-clojure.log in the root directory with contents similar to

----CMD->
"(+ 1 1)\n"
<-RES----
"2\nbug=> "

i suspect that the mechanism to separate out the new repl prompt from the result might be messing up.

@seancorfield
Copy link
Author

Per template:

Operating system
macOS 10.12

It looks like some very simple forms will eval into a fresh REPL but it always fails eval'ing the ns form. I'm using next.jdbc as my test case. I open src/next/jdbc.clj, start inf-clojure with just a basic clojure command, then C-M-f to the end of the ns form and C-c C-e.

.inf-clojure.log attached:

inf-clojure.txt

@seancorfield
Copy link
Author

I tried a few more evals after that, plus one in the REPL window itself:

----CMD->
"(set! *warn-on-reflection* true)\n"
<-RES----
""
----CMD->
"(try\n                             (:arglists\n                              (clojure.core/meta\n                               (clojure.core/resolve\n                                (clojure.core/read-string \"set!\"))))\n                            (catch #?(:clj Throwable :cljr Exception) e nil))"
----CMD->
"tr\n"
----CMD->
"(try\n                             (:arglists\n                              (clojure.core/meta\n                               (clojure.core/resolve\n                                (clojure.core/read-string \"Clojure\"))))\n                            (catch #?(:clj Throwable :cljr Exception) e nil))"
----CMD->
"1\n"

That last one (1) didn't even produce anything.

@dpsutton
Copy link
Contributor

ok i can reproduce. i'll start tracking down. In the meantime a workaround is to load the file inf-clojure-load-file C-c C-l and then inf-clojure-set-ns C-c M-n. I'll look into what's happening with the parsing. thanks @seancorfield

@seancorfield
Copy link
Author

That workaround did not work for me. It successfully loads the file and successfully switches to the next.jdbc namespace, but if I try to eval that ns form with C-c C-e, I get into the bad state again.

Some experimentation suggests it is something to do with the docstrings. I can eval some forms, such as defn's with smaller/simpler docstrings, but not anything that has a larger (formatted) docstring containing markdown or possibly quoted quotes, e.g., (defn foo "some \"thing\" like this" [])

I can keep trying to narrow it down a bit on my side if you want?

@seancorfield
Copy link
Author

I worked my way up from the bottom of next/jdbc.clj eval'ing each form and plan fails to eval but the functions below it all work.

@dpsutton
Copy link
Contributor

so to recap from discussions on slack, this seems to be a problem with process-send-string on osx. bug report here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43099

@RobertARandolph
Copy link
Contributor

Is there any sort of workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants