bodil / cljs-noderepl

A ClojureScript REPL running on Node.JS
166 stars 21 forks source link

nREPL Emacs integration #12

Closed noprompt closed 9 years ago

noprompt commented 10 years ago

I could totally be missing something here, and forgive me if I am, but whenever I run the cljs repl from Emacs connected to nREPL it prompts me for input from Stdin:. Everything in my profile.clj looks good. Is that what you were hinting at when you said it was "a bit fiddly"?

Oh, FWIW, you might wanna bump the piggieback dependency's version too.

whilo commented 10 years ago

Same here. I have tried to put piggieback 0.1.0 in the deps before cljs-noderepl, still I get the Stdin: prompt. I am using emacs-live.

cemerick commented 10 years ago

I recently used cljs-noderepl via leiningen without a problem. Could you try that? Perhaps there's something Emacs-specific that is causing the issue.

babysnakes commented 10 years ago

I believe it is emacs specific. I also couldn't get it to work inside emacs (I tried all the methods suggested in the readme). I use emacs with node.el. Didn't try it with cider though.

noprompt commented 10 years ago

@cemerick via leiningen (ie. lein trampoline noderepl) works flawlessly. It's launching the REPL "the hard way" from a nrepl session that's the problem.

@babysnakes I have confirmed this is still the case with cider.

babysnakes commented 10 years ago

First let me fix a small error, I tried with nrepl.el and not with node.el :smile:

A small update: I did manage to work with it by using inferior lisp. It doesn't have all the functionality of nrepl.el but at least It's workable.

danskarda commented 10 years ago

I found that all other repl implementations return string (see clojure.browser.repl/evaluate-javascript), while cljs-noderepl returns json, which is parsed by cheshire. I am not able to replicate the issue with cider so I cannot confirm if the inconsistency is the rootcause of reported issue.

Anyway repls should return data in same format so I will provide a patch to fix the inconsistency (which affects also my code).

babysnakes commented 10 years ago

@danskarda are you able to use this project with cider? I can't make it run both in cider and in cursive. In cider (emacs) it puts a stdin: prompt in the minibuffer, In Cursive I get a warning: DEBUG: unknown status need-input and input is not evaluated. The only way I can make it run is via inferior-lisp which doesn't provide all of cider's goodies.

In both cases I tried to launch cider-jack-in and then used the "in project usage" for launching noderepl.

This seems to be a stdin issue. IIRC I also encountered a similar issue with debug-repl and nrepl.el.

danskarda commented 10 years ago

@babysnakes I use cljs-noderepl with repl and client-server tests.

For repl I use (latest) cider + cider-nrepl + piggieback + austin. I start repl in shellscript using lein repl and then connect from Emacs using cider command. Then I launch cljs-noderepl:

(cemerick.austin.repls/cljs-repl (cljs.repl.node/repl-env ....))

For client-server tests I run cljs-noderepl (or other environments) in separate thread and feed CLJS code to node using core.async and cljs.repl/evaluate-form.

The current status of JS environments (for headless testing) is quite sad. All of them require some kind patching and/or polyfills. Phantomjs is old and slow, rhino / nashorn are missing event loop (there are polyfills I have not tried yet). Only nodejs somehow works...

babysnakes commented 10 years ago

@danskarda Thanks! you just made my day (and probably he next as well) :)

noprompt commented 10 years ago

@danskarda Thanks for this! It works perfectly.