Oh, well....... it seems the problem is harder than I thought.
When Chlorine connects to a socket, it sends the UNREPL string to upgrade the REPL. This binds *out*
to unrepl.core/write
When any command (like load-file
) runs, if it uses *test-out*
(because, for some reason, it is different from *out*
and so it is not sent over the socket) Chlorine will try to bind it to *out*
(so we'll see the results in Atom).
Then things get weird: this *out*
does not exist on other REPL connections.... so it raises the error. Even if I try to bind *test-out*
locally, load-file
will make it leak for the outside world (because it uses def
, that changes environments globally, for all threads)
Here's the solution I came up with for using #reveal with #chlorine (hat tip to @seancorfield for getting me unstuck): Add this alias:
:reveal {:extra-deps {vlaaad/reveal {:mvn/version "0.1.0-ea4"}}
:extra-paths ["/Users/dave.dixon/.clojure"]
:jvm-opts ["-Dclojure.server.repl={:port,50505,:accept,my.repl/start}"]}
pointing to your .clojure
folder (or wherever you want to run startup scripts). In that folder add this clj file in the appropriate hierarchy:
(ns my.repl
(:require [vlaaad.reveal.ui :as ui]))
(def reveal (ui/make))
(defn start
[]
(clojure.core.server/repl))
Then modify the wrap_in_rebl_submit
from @seancorfield's init.coffee
as:
wrap_in_rebl_submit = (code) ->
"(let [value " + code + "] " +
" (try" +
" ((requiring-resolve 'cognitect.rebl/submit) '" + code + " value)" +
" (catch Throwable _))" +
" (try" +
" ((requiring-resolve 'my.repl/reveal) value)" +
" (catch Throwable _))" +
" value)"
@mauricio.szabo I added normal repl to Reveal (in addition to prepls) and tried it with Chlorine, you might be interested: https://github.com/vlaaad/reveal/issues/2#issuecomment-591068889
I'm not sure if Chlorine and Reveal can easily compose, Chlorine seems to need structured output provided by unrepl, and Reveal is supposed to be used as a repl directly...
So far I haven't seen any issues...so far.
Iām glad that you gave it a try! By the way, you can try doing this on repl start:
(add-tap (ui/make))
While the JVM remains running, there will be a window with tap>
resultsIād be happy if you shared your thoughts about using Reveal
I'll post them to #reveal as I get some more time with it.
So (ui/make)
returns a function that can be invoked on values @vlaaad? That's an interesting model...
yep
ASAP (as simple as possible)
Great, I'll look at is ASAP (as soon as possible š)
On a side note, just published 0.4.12, which will (hopefully!) fix the @aviflax's bug, and also probably fix the errors on unrepl.core/write
being unbound š
@mauricio.szabo Is there any way to control how tall (or wide) the console/repl pane is when it opens?
By default it opens half height (or half width) and it would be nice (for me, at least š ) to be able to specify a smaller height (or width).
(what made me think of that is that the linter UI package lets you set a maximum height as a config option)
There's no such option for now, but I also am thinking on adding it. Will check the Atom API and see how to control it