unrepl 2017-12-04

@nblumoe has joined the channel

Ready to take a noob question? 😄

Excellent 😄

So, I managed to communicate with a socket repl started with clj -J-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}". How do I get unrepl on that repl? Do I need to pass it via :accept? I was going to use the reference implementation from https://github.com/Unrepl/unrepl

the reference implementation has a start-aux function which seems to be the entry point…

I guess I could call that from the socket repl to get it going. But I am not so sure that I am doing the right thing here….

@nblumoe do you want to use an existing client, or write your own?

I'm trying right now

how do I install clj?

I'm asking the newb questions here @nblumoe

Mac? brew install clojure

ah I tried "brew install clj"

clj -J-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"
Exception in thread "main" java.io.FileNotFoundException: -J-Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl} (No such file or directory)

I already had a script called clojure

lein unrepl-make-blob
rlwrap cat resources/unrepl/blob.clj - | nc localhost 5555

gives you a nice prompt

unrepl is usualy loaded by "upgrading" an existing basic repl (clojure.core.server)

the advantage being no configuration on the serve side, other than opening the port

and when unrepl doesn’t do what you want, you fork , patch it and use the resulting blob

@cgrand maybe these two lines would make a nice addition to the unrepl readme?

so you are free to experiment or have to wait for me to fix a bug

Ok I see, thanks. (And actually I also remember now 😄 )

and blob.clj I am going to build via right?

right that's the lein unrepl-make-blob I mentioned

Cool thanks. Working from CLI now

baptiste-from-paris 2017-12-04T11:51:08.000089Z

hello all, does the scripts/loop is working for everyone ? e.g : rerun lumo after it has been killed

and also working from within my code now…. Thanks!

👌 1

@nblumoe may I ask what you are doing? just toying around or more?

Sure, we would like to use it for Clojure code evaluation on https://nextjournal.com/

Quite nice (except the blue ;)) !

I could even render classes and symbol differently

iterm2 supports hover???

that’s hyperlink detection, but it supports (and libvte too) true hyperlinks

pretty sweet

and I have seen in the propieraty escapes codes a thing about hints displayed on hover (and also sending a system notification)

I mean we need to tread carefully here because we don't want to venture too far into detecting terminal types etc.

but this looks potentially super useful

I used none of those because of this

ah, java.io.File is (incorrectly) detected as a URL

got it now

is that packed applying the colors?

@mikeb has left the channel

it’s the unravel ansi rendering for packed

you just interpret the [:span ...] data structures in a colored way?

decoupling: packed only cares about the length of the spans (it doesn’t even know how to retroeve their content), so it computes a layout and then an application specific renderer do the actual rendering using extra fields or methods on spans

(defn ansi [text ansi-text]
  {:length (count text)
   :text ansi-text
   :start-length (count text)
   :start-text ansi-text
   :br-after? true})

creates a span, length, start-length and br-after are for packed; text and start-text are for the renderer

so I (ab)use the text renderer by putting ansi escapes into the rendering

it’s ok as long as the declared length is the displayed length

(forgot to push)

So the telling code sample is this cond clause:

(keyword? x) (let [s (str x)] [(ansi s (str “\33[36m” s “\33[m”))]) ; cyan

@pesterhazy I havens created a PR for packed but it’s good to go.