Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make request-prompt work in nREPL mode
  • Loading branch information
trptcolin committed Jun 17, 2012
1 parent 2d51c0c commit bd13c89
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/clj/reply/eval_modes/nrepl.clj
@@ -1,6 +1,7 @@
(ns reply.eval-modes.nrepl
(:import [java.util.concurrent ConcurrentLinkedQueue])
(:require [clojure.tools.nrepl.cmdline :as nrepl.cmdline]
(:require [clojure.main]
[clojure.tools.nrepl.cmdline :as nrepl.cmdline]
[clojure.tools.nrepl :as nrepl]
[clojure.tools.nrepl.misc :as nrepl.misc]
[clojure.tools.nrepl.server :as nrepl.server]
Expand Down Expand Up @@ -67,20 +68,24 @@
(prompt ns)
(flush)
(let [eof (Object.)
request-prompt (Object.)
read-result (try
(binding [*ns* (eval-state/get-ns)]
(read))
(clojure.main/repl-read request-prompt eof))
(catch Exception e
(if (= (.getMessage e) "EOF while reading")
eof
(prn e))))]
(if (reply.exit/done? eof read-result)
nil
(recur (execute-with-client
connection
options
(binding [*print-meta* true]
(pr-str read-result))))))))))
(do (print "ohai") (prn e)))))]
(cond (reply.exit/done? eof read-result)
nil
(= request-prompt read-result)
(recur ns)
:else
(recur (execute-with-client
connection
options
(binding [*print-meta* true]
(pr-str read-result))))))))))

;; TODO: this could be less convoluted if we could break backwards-compat
(defn- url-for [attach host port]
Expand Down

0 comments on commit bd13c89

Please sign in to comment.