Fork me on GitHub
#cider
<
2018-06-08
>
ag00:06:48

You can just kill clj repl, but why would you do that? Having 2 repls is convenient

richiardiandrea00:06:52

Because at the moment I am working on the server side only - node - in cljs

bozhidar13:06:10

@richiardiandrea There’s nothing like this in CIDER, just the tools.namespace reload. Obviously it won’t be hard to add it, though.

bozhidar13:06:23

I never needed anything else. 🙂

tsulej14:06:38

after upgrading to emacs 26.1 I've started to get following errors when trying to connect to nrepl (or doing cider-jack-in).

error in process filter: queue-enqueue: Wrong type argument: queue, [cl-struct-queue nil nil]
error in process filter: Wrong type argument: queue, [cl-struct-queue nil nil]
Packages were recompiled after upgrade, cider version: cider-20180607.2155

tsulej14:06:08

$ lein repl
nREPL server started on port 58957 on host 127.0.0.1 - 
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.9.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_66-b18

tsulej14:06:46

and from emacs (cider-jack-in)

Starting nREPL server via lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.13\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[refactor-nrepl\ \"2.4.0-SNAPSHOT\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.18.0-SNAPSHOT\"\] -- repl :headless :host ::...
nREPL server started on 57781
[nREPL] Establishing direct connection to localhost:57781 ...
[nREPL] Direct connection to localhost:57781 established
error in process filter: queue-enqueue: Wrong type argument: queue, [cl-struct-queue nil nil]
error in process filter: Wrong type argument: queue, [cl-struct-queue nil nil]
error in process filter: nrepl-send-sync-request: Sync nREPL request timed out (op clone id 1)
error in process filter: Sync nREPL request timed out (op clone id 1)

hlolli14:06:34

@tsulej ah that. It's really annoying with these cl errors, that so many emacs developers use these cl- functions but don't realize that it's already required elsewhere in their emacs environment. I bet if you add (require 'cl) at the beginning of your init.el, it will fix.

hlolli14:06:10

or maybe not, sorry, the error doesn't look like cl-struct-queue is wrong...

hlolli14:06:33

you can try

tsulej14:06:02

just tried, doesn't work 😞

hlolli14:06:04

how about (defalias queue-enqueue 'cl-struct-queue) ?

hlolli14:06:54

in the scratch buffer you can of course do M-. on the symbol queue-enqueue and see if it's there

tsulej14:06:57

checking, meanwhile debugger output

Debugger entered--Lisp error: (wrong-type-argument queue [cl-struct-queue nil nil])
  signal(wrong-type-argument (queue [cl-struct-queue nil nil]))
  queue-enqueue([cl-struct-queue nil nil] "d2:id1:111:new-session36:a4c59ff8-14e5-4341-8fdd-6f8313c718867:session36:5906ee68-0733-4842-85f4-075c6f1136b46:statusl4:doneee")
  nrepl-client-filter(#<process nrepl-connection<1>> "d2:id1:111:new-session36:a4c59ff8-14e5-4341-8fdd-6f8313c718867:session36:5906ee68-0733-4842-85f4-075c6f1136b46:statusl4:doneee")
  accept-process-output(nil 0.01)
  nrepl-send-sync-request(("op" "clone" "id" "1") #<buffer *cider-repl localhost*<2>> nil nil)
  nrepl-sync-request:clone(#<buffer *cider-repl localhost*<2>>)
  nrepl--init-client-sessions(#<process nrepl-connection<1>>)
  nrepl-start-client-process("localhost" 58957)
  cider-connect("localhost" 58957)
  funcall-interactively(cider-connect "localhost" 58957)
  #<subr call-interactively>(cider-connect nil nil)
  apply(#<subr call-interactively> cider-connect (nil nil))
  [email protected]+-record-current-command(#<subr call-interactively> cider-connect nil nil)
  apply([email protected]+-record-current-command #<subr call-interactively> (cider-connect nil nil))
  call-interactively(cider-connect nil nil)
  command-execute(cider-connect)

hlolli14:06:06

since string-q is nil in your error, you may want to resolve the symbol queue-create

(setq string-q (queue-create)))
probably also cl- function that needs to be aliased...

tsulej14:06:22

queue-enqueue is there (from queue-0.2/queue.el package)

hlolli14:06:26

way deeper than I imagined first. No idea what's happening, why would the process filter even be evaluated if there's no data. I also have newest cider and emacs 26. No take that back, I'm on 25.3... I pass the ball.

bozhidar14:06:51

I’ll test things on 26.1 when I can.

bozhidar15:06:08

Generally it’s a good idea to delete all compiled packages between Emacs updates.

bozhidar15:06:23

Can’t imagine what else can it be.

tsulej15:06:25

I forced compilation of all packages. But probably deleting is better option here. I'll let you know in a minute.

tsulej15:06:04

that was it... recompilation wasn't enough. Thank you for your time. No need to test @bozhidar

bozhidar15:06:20

I feel like I have divine Emacs powers. 😄

richiardiandrea16:06:11

Cider gurus, I am trying to implement the :reload feature and it kind of freezes the UI with cider-interactive-eval the first time. I wonder if cider contains already some sort of async eval mechanism of some sort

richiardiandrea16:06:25

(in the meantime, exploring the code base)

dpsutton16:06:24

i believe it is by default "async". check nrepl-send-request versus nrepl-send-sync-request

richiardiandrea16:06:54

well, it seems all the commands call cider-interactive-eval so will use that for now

dpsutton16:06:37

i traced it for a second and it seemed like cider-interactive-eval uses the async version

dpsutton16:06:57

however emacs is single threaded so if you're doing stuff emacs is only doing that

richiardiandrea16:06:47

(not for long because 26.1 introduced threads!)

jmckitrick16:06:36

Has anyone here gotten shadow-cljs to auto-connect to the correct repl once things are up and running? I find I have to run (shadow.cljs.devtools.api/repl :app) manually in the clojure repl.

hlolli16:06:08

shouldn't be difficult to add something like

(cider-interactive-eval
       (format "(shadow.cljs.devtools.api/nrepl-select %s)" build-id))
into the pipeline, I guess it's not there, I also have to choose the repl. But I also start a shadow-cljs server, it's probably tricky for cider to know if the nrepl is connecting to a watch or server.

richiardiandrea16:06:52

there should be a command for launching the shadow things, maybe something is missing

hlolli16:06:25

cider actually auto detects if there's shadow-cljs.edn in cider-jack-in, it's very nice!

hlolli16:06:54

so it's still that strange bug lurking around, with cider + shadow, sometimes things have to be said twice, or press enter sometimes to get the cljs connection running

dealy17:06:30

hi, I'm just getting acquainted w/cider, is there a way to make it pretty print my maps by default?

richiardiandrea19:06:21

say I am bootstrapping a CLJS manually

richiardiandrea19:06:44

do I need to set the connection type to cljs for the buffer manually as well?

dpsutton19:06:20

yes i believe so

dpsutton19:06:33

that property is used in finding a repl of suitable type for evaluation

dpsutton19:06:44

(setq cider-repl-typ "cljs") or something like that

richiardiandrea19:06:25

@dpsutton thank you! check that

richiardiandrea19:06:50

shadow REPL is a bit flaky, trying it now for the first time

richiardiandrea19:06:03

better to start a server at the terminal and connect to it

richiardiandrea19:06:24

@dpsutton actually...if you do cider-connect-clojurescript the cider-repl-type var seems to be set for you

richiardiandrea19:06:39

even if it is a clj repl not yet "upgraded"

richiardiandrea19:06:58

no ok, once you upgrade you lose it

richiardiandrea19:06:08

crap, I am lost in tooling land 😄

dpsutton19:06:54

i think there are some bugs out there that are resetting the repl back to clj. i think a state message comes back after the upgrade and says clj so it resets the repl back to clj

dpsutton19:06:09

so be careful of what is intended behavior and what is a bug in state management

richiardiandrea19:06:09

yeah it seems like it

richiardiandrea19:06:40

because:

ELISP> cider-repl-type
"cljs"
<-- sent evaluation ->
ELISP> cider-repl-type
"clj"

richiardiandrea19:06:12

maybe the repl type should not be changed at all after the fact?

richiardiandrea19:06:27

but I don't know maybe it is like this for a reason

richiardiandrea19:06:13

ELISP> (setq cider-repl-type "cljs")
"cljs"
ELISP> cider-repl-type
"cljs"
<-- sent cljs evaluation ->
ELISP> cider-repl-type
"clj"
ELISP> 

richiardiandrea20:06:37

it seems to me the behavior was there to manage when you do :repl/quit

richiardiandrea20:06:18

because it seems on :repl/quit a changed-namespaces is sent back

richiardiandrea20:06:59

@dpsutton open a PR in order to discuss the behavior https://github.com/clojure-emacs/cider/pull/2316

dpsutton20:06:19

seems more like an issue at the moment

richiardiandrea22:06:37

it would be great if the patch can be tested for a little bit in order to see what the consequences are

dpsutton22:06:22

Oh gotcha. Didn't notice there was a patch involved

richiardiandrea22:06:39

a simple one 😄

richiardiandrea22:06:41

completions in shadow does not work am I right?

richiardiandrea22:06:56

or do I need the cider-nrepl middleware with it?