Fork me on GitHub
#dirac
<
2017-03-01
>
deas11:03:02

fwiw, I had a file "out" lying around. Hence, directory could not be created. All fine now. Yay!

qqq12:03:21

@darwin: I have an on topic dirac question for once

qqq12:03:32

the dirac browser repl running inside the chrome devtools

qqq12:03:37

is there a way for emacs to somehow connect to it?

qqq12:03:53

in other words, does dirac expose a nrepl?

darwin12:03:58

nrepl has server and client(s), dirac implements nrepl client in chrome devtools

qqq12:03:16

I'm looking at (dirac! :help)

qqq12:03:21

how do I get the nrepl port number to connect to?

darwin12:03:59

but it is more complicated, because nrepl talks over TCP/IP and devtools has only web sockets, that is why we have dirac agent which does a proxy/tunnel between those two

darwin12:03:23

"how do I get the nrepl port number to connect to?” who is asking and where?

darwin12:03:00

in general you created nrepl server and configured dirac to use it

darwin12:03:04

so you should know its port

qqq12:03:17

is my "nrepl server" started by 1) build.boot line (dirac :ids #{"main"}) or 2) when I fire up chrome canary ?

darwin12:03:57

I don’t use boot, but it should be responsible for launching your nrepl server, at least my leiningen does

qqq12:03:30

let me ponder more on this

darwin12:03:33

also note that dirac has nrepl middleware which is a kinda nrepl server plugin, that has to be configured near that place

qqq12:03:55

clearly I'm misunderstanding something, as truth = dirac devtools = nrepl client my previous thought: dirac devtools was a Nrepl SERVER that the web browser gui somehow connected to

darwin12:03:28

also note that devtools is a web app, it cannot simply launch a server process on your machine

darwin12:03:45

dirac devtools === nrepl-like client

qqq12:03:49

I thought installing latest canary + running it with that long command ilne gave it special powers

qqq12:03:57

thanks for pointing out mental errors

qqq12:03:08

so if dirac devtools = nrepl like client

qqq12:03:43

then it's 100% hopeless for me to go from emacs to send command to "dirac webtools ui" to ahve it 1) appear in the browser console and 2) execute in the browser console right? so even if I connected to the nrepl, it'd be two diffeerent client sessions

qqq12:03:15

the ascii art in that readme is amazing

qqq12:03:18

the diagrams are amazing; I'm going to underad that first, then I'll bother you at a later day

darwin12:03:17

what you are trying to achieve is 100% possible, note that we have our code in nREPL server, in nREPL client (agent) and in devtools UI and all parts can communicate with each other

darwin12:03:21

you are 95% there if you could reuse the same building blocks

darwin12:03:01

I believe there is a chance it would work out-the-box with emacs, just nobody tried it before

qqq12:03:25

Those diagrams are amazing. I think I get it now.

qqq12:03:38

nrepl Server is at localhost::8230 dirac agent is at localhost::8231

darwin12:03:15

and weasel connections are at localhost:8232 and up

qqq12:03:47

so what I'm confused at is as follows -- do I just cider jack in 8230 ?

darwin12:03:09

sorry, I don’t use cider

qqq12:03:17

my confusion being I had to rip out all my other middleware in order to install dirac

qqq12:03:32

besides using cursive, is there any other way for me to test connecting another repl and sending cmds over?

darwin12:03:07

easily, leiningen and boot support running nrepl clients from command-line

darwin12:03:34

at least leiningen for sure

qqq13:03:06

I can run "boot repl -c" fine, but when I run (start-repl), I get all types of weird stack traces if all goes right, I should be able ot connect to a browser repl, and not just a clj repl right?

darwin13:03:34

why do you run start-repl?

darwin13:03:02

dirac has nothing to do with start-repl which tries to do the same job but differently

qqq13:03:28

https://github.com/adzerk-oss/boot-cljs-repl <-- standard way I used to get browser repls

qqq13:03:34

let me figure out what I am doing wrong

darwin13:03:34

when you connect to an nrepl server, you get a session, at that session is normal clojure

qqq13:03:12

how do I go from "normal clojure" to "browser repl" ?

qqq13:03:15

I can get normal clojure repl

darwin13:03:16

again, I cannot help you with boot stuff, not sure what boot-cljs-repl is trying to do

darwin13:03:39

but I assume it is trying to do their own weasel/browser-repl stuff

darwin13:03:47

which has absolutely nothing to do with dirac

darwin13:03:54

and you cannot expect it to work with dirac

qqq13:03:33

this is fasicnating

darwin13:03:44

type (dirac! :status) and then (dirac! :ls) and post it here

darwin13:03:18

in your clojure repl which you entered via boot repl -c

darwin13:03:41

this repl connection should have access to dirac commands, because your nrepl server should have dirac middleware installed in it

qqq13:03:43

amazing, did not know this repl had dirac! on it

darwin13:03:25

you should understand it, if you fully understand this: https://github.com/binaryage/dirac/blob/master/docs/about-repls.md

qqq13:03:33

I'm going ot try (dirac! :join)

darwin13:03:48

right! that should be your next step

darwin13:03:12

this is your “replacement” for (start-repl)

qqq13:03:21

but the alert hello does not appear

qqq13:03:40

it's j/swindow

darwin13:03:58

see the last paragraphs

darwin13:03:22

console output is a side-effect not a REPL command result

darwin13:03:44

(+ 1 2) should work as expected

qqq13:03:41

(+ 1 2) ==> 3 did work, both in my terminal & in the browser devtool

qqq13:03:42

this is insane

darwin13:03:47

now try to connect to the same nrepl server from your emacs using normal nrepl client

darwin13:03:16

not sure if it is called cider, but I think cider is much more than just an nrepl client implemented inside emacs

qqq13:03:38

this is insane; I'm still in awe

darwin13:03:54

if you want fullblown cider and dirac working together, cider will have to use another nrepl server, because cider and dirac middleware don’t like each other

qqq13:03:30

there is one weird bug:

cljs.user=>
at this place, if I type in (+ 2 3) we're good, if I just hit <enter> then my terminal freezes and I can't enter antything more at the terminal; not sure if this is a boot problem or what (perhaps it's sending NIL as input, and then waiting forever for something to print)

darwin13:03:02

try it in lein repl :connect 8230

qqq13:03:22

same issue

qqq13:03:28

I suspect it is with powerlaces.boot-cljs-devtools

qqq13:03:33

is that your package or someone else's ?

darwin13:03:47

feel free to file a bug, I will look into that

darwin13:03:02

have to go, now

qqq13:03:13

thanks again for all your time

qqq13:03:14

take care

deas13:03:28

While we are at it ... dirac middleware "complains" when it detects other middleware - i.e. cider. Is that serious or more like "there is something else - you may get away with it"?

qqq13:03:56

in my experience, it's "choose me or choose cider"

qqq13:03:14

and in my experience, it's worth giing up cider for

qqq13:03:22

the debugging suppot for stack frames / printing locals is amazing

deas13:03:32

Ok, so I guess if one really needs other middleware, you should just spin up another nrepl service on another port.

qqq13:03:52

the 'joined dirac session' is amazing

qqq13:03:00

which unfortunately, probably doesn't like other middleware either

darwin13:03:34

@deas it was explained here: https://github.com/binaryage/dirac/releases/tag/v1.1.4, if you don’t want to see that warning, I could add a config flag to disable it (in the next version)

deas13:03:02

@darwin A flag to disable it might be nice. In fact, I was wondering what to expect - especially wrt "popular" middleware like cider or clj-refactor.

darwin13:03:24

I could also make this configurable: https://github.com/binaryage/dirac/blob/master/src/lib/dirac/lib/nrepl_tunnel.clj#L97 (this is how I detect expceted middleware, I ask for all supported operations, ciders adds bunch of new ones)

deas13:03:18

@darwin I think the solution should depend on what is to be expected. If 99% of the people see issues with cider, it may be best to simply spin up another nrepl service on another port.

qqq13:03:03

@darwin: is there a debug option to tell dirac agent / nrepl server to be very very verbose? I want to see all msgs that are flying back and forth to see why it's hanging

deas13:03:33

Speaking of debugging: dirac.logging does not ship with the default jar. Might make sense to add it.

deas14:03:40

@darwin Doh! I hate being pointed to the faq. 🙂

darwin14:03:16

🙂 np, there is a wall of text

qqq20:03:34

@darwin: reporting that emacs / dirac repl works nicely with the following: 1. run inf-lisp process, with "boot repl -c" "(dirac! :join)" 2. define this function

(defun my-send-last ()
  (interactive)
  (comint-send-string
    (inferior-lisp-proc)
    (format "%s\r" (elisp--preceding-sexp))))
3. enjoy!

darwin20:03:26

@qqq nice! I’m glad to hear

qqq21:03:04

@darwin: so I still haven't figured out the "(dirac :join) hangs if I hit enter twice in a repl" -- but if I only use the above, it (1) reads a sexp, and (2) sends precisely one \r, making it not hang

darwin21:03:36

this info will be lost on slack, willing to update https://github.com/binaryage/dirac/blob/master/docs/integration.md? I would accept a PR with emacs-tips

darwin21:03:54

@qqq I can confirm hang when hitting enter in nrepl client prompt, also dirac commands without parens are broken

qqq21:03:41

I was reading about "debugging dirac" and it basically said "dirac is :optimizations :advanced; impossible to debug unless you ahve custom build"

qqq21:03:00

@darwin: does this mean a 1.1.7 later today? 🙂

darwin21:03:33

probably not, I’m going to release a next one on sunday as usual

darwin21:03:48

this is not urgent, I think

qqq21:03:19

fair enough; if I may ask, do you get paid to dev dirac, or is this all just personal project ?

qqq21:03:12

sunday sounds more than fair 🙂

darwin21:03:39

sank too many hours into it, but it was fun 🙂

darwin22:03:47

you should put :skip-paranoid-middleware-setup-check true into dirac agent options

darwin22:03:43

a map with config options overrides can be passed into boot! as a parameter: https://github.com/binaryage/dirac-sample/blob/master/project.clj#L147 or you can use env var to override config: https://github.com/binaryage/dirac/blob/master/src/agent/dirac/agent/config.clj export DIRAC_AGENT__SKIP_PARANOID_MIDDLEWARE_SETUP_CHECK=true should work