Fork me on GitHub
#cider
<
2017-12-10
>
bozhidar00:12:13

@dominicm Fair enough. It’s good to know things like these. Often my perspective is shaped primarily by my own usage of certain things.

grzm00:12:31

Is there a roadmap for Cider using the socket repl?

grzm00:12:39

I see that it's a goal, but I'm looking for details as to what would be required to do so, where to get started. The FAQ is (understandably) pretty brief.

bozhidar00:12:49

@grzm There’s just a plan at this point, as I have almost no time to work on CIDER these days and we really need someone else to tackle this if it’s to happen any time soon. The steps are relatively clear: * implement some elisp client library for the socket repl * abstract away the nREPL specifics from CIDER’s main API * extract from cider-nrepl the core functionality as some standalone library that can be used directly via evaluation (as that’s the approach the socket repl takes for tooling stuff)

bozhidar00:12:12

None of this is particularly complex, but it’s certainly a lot of work, especially the second point.

bozhidar00:12:14

I can go into more details regarding this if needed. I guess the most simple way to explain things would be the following - we need an equivalent of nrepl-client.el for the socket repl and all commands in CIDER should take the connection type into account (nREPL or socket repl) when they determine what exactly to invoke - some nREPL middleware op or just eval something over the socket repl connection.

grzm01:12:33

thanks for taking the time for typing this out. Would it make sense to start a wiki page or something on this?

dominicm08:12:34

@grzm I think the best way to do this is with unrepl. Classes can be hotloaded, and unrepl injects a structured api on top of socket repl. The missing part is cider as a client library rather than as nrepl middleware. But I don't think it would be impossible to use without right now anyway.

dominicm09:12:30

@grzm fwiw, I have interest in using cider with unrepl, so would be interested in helping with a cider nrepl standalone client.

bozhidar09:12:06

@dominicm That’s the dream. 🙂

bozhidar09:12:52

Obviously after things are decoupled from nREPL adding support for new clients would become significantly easier. Whether the first is the socket repl or unrepl doesn’t make much of a difference.

bozhidar09:12:20

> thanks for taking the time for typing this out. Would it make sense to start a wiki page or something on this? @grzm I’d start a GitHub issue. 🙂

bozhidar10:12:13

> The missing part is cider as a client library rather than as nrepl middleware. But I don’t think it would be impossible to use without right now anyway. Yep, eventually there should a be a CIDER library that’s completely independent from any communication protocol. It’d be wrapped by middleware for nREPL, and by whatever’s appropriate by other “adapters”.

dominicm10:12:55

@bozhidar just to be clear, unrepl is quite unlike nrepl in that it's not expected that you will be running any more than a socket repl. Unrepl bootstraps itself into a socket repl, using a "blob" that would be provided by CIDER.el. So if CIDER wants to support socket repl, using unrepl would be a convenient route.

bozhidar10:12:54

Yeah, I’m aware of this.

bozhidar10:12:32

I was mostly alluding to the fact that supporting socket REPL connections by itself doesn’t solve the problem of how to leverage them directly. In particular: * You can just do eval on one socket connection for all “tooling” operations (e.g. completion, var resolution whatever) or two can have two connections (one for user eval, the other for tooling eval) * How do you do session management - in nREPL this is built-in and you can have many sessions per one connection. Do you even what to do session management for socket repl connections? * How do you determine the repl’s tooling capabilities? In nREPL you can query the connection for the ops that it supports, what do they return etc. For the socket repl I guess you can check whether certain namespaces are present and eval stuff or we can add some simple abstraction on top of this.

bozhidar10:12:14

Nothing particularly complex, but those are decisions that have to be made. 🙂

naomarik10:12:49

hi! I used to be able to connect to my servers with ssh fallback using cider-known-endpoints. I’ve recently completely updated everything and I’m now getting this error for my remote machines Bad local forwarding specification 'nil:localhost:nil' emacs version 27.0.50 cider version 0.16.0snapshot

bozhidar13:12:40

@naomarik Some backtrace and more details would be useful. 🙂

naomarik13:12:14

@bozhidar apologies i have no experience with elisp, so not too sure what to provide. I did attempt to evaluate format-spec independently using the commands passed in when I use cider-connect and I get this backtrace

Debugger entered--Lisp error: (void-variable host)
  (cons 104 host)
  (list (cons 115 ssh) (cons 112 port) (cons 104 host) (cons 117 (if user (format "-l '%s' " user) "")))
  (format-spec "%s -v -N -L %p:localhost:%p %u'%h'" (list (cons 115 ssh) (cons 112 port) (cons 104 host) (cons 117 (if user (format "-l '%s' " user) ""))))
  nrepl--ssh-tunnel-command("/usr/bin/ssh" "/ssh:[email protected]:" "7888")
  eval((nrepl--ssh-tunnel-command "/usr/bin/ssh" "/ssh:[email protected]:" "7888") nil)
  elisp--eval-last-sexp(nil)
  #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d3665>)(nil)
  ad-Advice-eval-last-sexp(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d3665>) nil)
  apply(ad-Advice-eval-last-sexp #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d3665>) nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

naomarik13:12:57

didn’t realize it was that big, line wrap was off

naomarik13:12:55

but it seems to me format-spec is no longer producing the intended string

naomarik14:12:29

removing the undefined variables, (nrepl--ssh-tunnel-command "/usr/bin/ssh" "/ssh:[email protected]:" "7888") evaluates to this "/usr/bin/ssh -v -N -L nil:localhost:nil''"

naomarik14:12:31

and so that’s the error i’m getting in the nrepl-tunnel buffer — Bad local forwarding specification 'nil:localhost:nil'

naomarik14:12:44

ignore what i said about format-spec… the function (nrepl--ssh-tunnel-command) as it appears on master evaluates to this "/usr/bin/ssh -v -N -L nil:localhost:nil -l 'root' ''"

naomarik14:12:19

so it’s just the port that’s missing

naomarik14:12:16

i reckon because of format-spec though 🙂 i’ll open up my other laptop and test what it evaluates to in awhile

naomarik14:12:29

didn’t update that one

bozhidar14:12:09

it seems right now you evaluated some piece of code with a missing variable in in - Debugger entered--Lisp error: (void-variable host)

New To Clojure15:12:27

"it can’t find namespaces whenever I evaluate some piece of code"

bozhidar15:12:32

Unfortunately that’s all too vague for me to be able to help.

bozhidar15:12:28

@dominicm I’ve noticed that someone recently started a project similar to CIDER in nature, but targeting unrepl - https://github.com/Unrepl/unrepl.el While I would have loved it if this person worked instead on adding this support to CIDER directly, it seems that now the client library for the socket repl is a solved problem. 😉

dominicm15:12:55

@bozhidar It is indeed 😉

dominicm15:12:53

I'm hoping that it will lay a good groundwork, the following step is entirely to get CIDER into a good shape for use as a library

bozhidar15:12:11

Time will tell. I’m cautiously optimistic about the future of Clojure dev tools. As usual. 🙂

Bravi16:12:35

Hi everyone. I’m having trouble getting cider to work with cljs app (re-frame template app specifically) to work properly. I do a fresh lein new re-frame someapp and then I do jack-in-clojurescript. Then, in any cljs file I type (+ 1 2) and hit C-c C-c to evaluate the line. It usually takes about 10 seconds to ‘think’ and then comes back with a time out message. After a few retries, it works but then as soon as it evaluates, cljs loses ‘connection’ to nREPL it seems. Because next time I try to evaluate something, even though cider buffer is till open, it says that I need to connect to nREPL for it to work..

dominicm16:12:56

@bozhidar understandable. I often find myself nodding along to your rants talks.

dominicm16:12:35

I personally am interested in using unrepl with cider-nrepl. So I will likely solve that part, even if someone else doesn't.

naomarik16:12:08

@bozhidar i looked up the docs on tramp filename and fixed it by adding a #(port-num) after the domain, so my cider-known-endpoints has an entry that looks like this: ("staging" "#7888" "7888")

bozhidar16:12:11

@naomarikInteresting. I guess they changed this recently, as this is the first time I hear of this.

bozhidar16:12:13

> I do a fresh lein new re-frame someapp and then I do jack-in-clojurescript. Then, in any cljs file I type (+ 1 2) and hit C-c C-c to evaluate the line. It usually takes about 10 seconds to ‘think’ and then comes back with a time out message.

bozhidar16:12:31

@bravilogy http://cider.readthedocs.io/en/latest/troubleshooting/ take a look here at the part about nREPL message logging and see what happens there.

bozhidar16:12:26

> @bozhidar understandable. I often find myself nodding along to your rants talks. 😄 That remark made my laugh. I guess I’m a pretty negative person when it comes to this. 😄 > I personally am interested in using unrepl with cider-nrepl. So I will likely solve that part, even if someone else doesn’t. (edited) Happy to hear this.

bozhidar16:12:05

Today was the first day in a long time I actually sat down to do some CIDER work. ClojureX put me in the right frame of mind for this. 🙂

bozhidar16:12:27

Actually I think yesterday was the first day, but anyways - close enough.

dominicm16:12:07

@bozhidar As you're about today, I'm working on the new resources list op, and I'm considering what to call it. I've called it "resources-list2" for now. I see 2 options: resources-list-XXX where someone has a good idea for XXX resources-list gains an option flag like more which sends you back a dictionary.

dominicm16:12:35

Although, appealing to authority. Halloway has mentioned that sometimes the best name is foo2 😄

dominicm16:12:11

@bozhidar I appreciate having you around more today 🙂 It would be nice to see you more often!

kommen16:12:17

hi all! I’m looking into a gofmt in go-mode and refmt in reason-mode like cider-format experience. go-mode suggests to reformat the buffer in the on-before-save hook. the problem I have with cider-format-buffer is that the point position is lost after reformatting, which make it not really fitting to use in that hook, which is kinda annoying. wondering how gofmt solved this, was a bit surprising but also interesting: they make a diff between the orig and the reformatted buffer, then apply the diff line by line, making emacs not loose the cursor position: https://github.com/dominikh/go-mode.el/blob/7eb5b3dd0ac31d176e9d56da4172f66aef8fae47/go-mode.el#L1064

kommen16:12:14

any thoughts on this? is this the way to go to make cider-format-buffer not lose the point position?

bozhidar17:12:54

@kommen Just file a ticket and I’ll fixed this. All it needs is one save-excursion call to the current command which anyone can basically add.

bozhidar17:12:42

@dominicm Why not simply replace the existing op? I doubt anyone would complain if they got something better. 🙂

bozhidar17:12:56

> @bozhidar I appreciate having you around more today 🙂 It would be nice to see you more often!

bozhidar17:12:33

That’s a lot of fun! 🙂 Hopefully it will happen a bit more often down the road.

dominicm17:12:33

@bozhidar then I will break cider.el

kommen17:12:34

@bozhidar ok, will file an issue. I tried wrapping cider-format-buffer in a save-excursion though and had no luck though

kommen17:12:11

@bozhidar thanks for all your work, really appreciate it!

bozhidar17:12:22

@dominicm Don’t worry about this. I can update the Emacs side. 🙂

dominicm17:12:04

@bozhidar are there any other nrepl clients to be aware of? I just scanned fireplace & saw no use of this particular op (it looks like fireplace scans based on the path returned from the classpath op, ew)

bozhidar17:12:00

Not to my knowledge. It’s definitely not some fundamental feature, so I’m fine with breaking it. There’s a reason why I’m avoiding that magic version 1.0. 😉

dominicm17:12:40

Okay, great. Hopefully this will let you reduce the resource list down to a single op as well.

richiardiandrea17:12:40

Unrepl is cool, still a long road ahead for it to be adopted though. For example it is Clojure only for now. Including unrepl.el in cider would also mean change the way the middleware add-ons + nRepl protocol, adopting the new unrepl protocol...for sure doable, which is a good thing...

dominicm18:12:55

@bozhidar I have a PR coming your way this evening I'm afraid.

bozhidar18:12:25

It’s a good thing I’m going to a bar with some friends then. 😄

dominicm18:12:51

The alcohol will certainly help

dominicm22:12:27

@bozhidar I've left a steaming pile of PR on your doorstep. Enjoy 😄 I think things are nominally better after the changes than they were before.

grzm22:12:06

thanks for improving the class path splitting, by the way. I picked that up from code in refactor-nrepl without looking up the appropriate way to do it.

dominicm22:12:50

@grzm that's okay. It was mostly the test that was broken, it was expecting two items in the path, but only adding one.

dominicm22:12:07

I only realised the path separator is defined somewhere when I started reading the documentation.

grzm22:12:48

Yeah, though whenever I put a literal somewhere like that I tend to think it's a code smell.

grzm22:12:05

Even if it's not defined somewhere in Java, it should be defined in the project.

dominicm23:12:53

Apparently it's actually platform dependent!

grzm23:12:41

Right. And it's nice that Java does the feature detection for us 🙂

dominicm23:12:36

@grzm btw, thanks to your patch, I was able to implement automatic ns insertion for my own plugin! I would have given up without your path I'm sure. We primarily use boot, so lacking boot support is a problem for me.