Fork me on GitHub
#cider
<
2016-04-25
>
jonpither10:04:56

Is there a good way to integrate difform or something similar into cider test so I can easily see how data structures differ on test failures?

jonpither10:04:04

A plug in of sorts?

jonpither10:04:52

tries humane test output

jonpither10:04:58

Hmm, crashes my CIDER

jonpither10:04:39

Thanks. On windoze but may try

malabarba12:04:16

@jonpither PRs welcome. simple_smile

malabarba12:04:36

It would be great if humane test output played nicer with CIDER.

malabarba12:04:10

We already support the whole Clojure.test API, which is extendable.

malabarba12:04:26

So it's probably just a small patch on their side.

dpsutton12:04:59

just tracing through all of the dependencies. didn't automate the graph building yet but that's what it looks like right now.

malabarba12:04:10

What a beautiful mess. simple_smile

malabarba12:04:45

The graph might be more readable if you exclude compat, util, and common. These files are supposed to be required by everybody anyway, so they don't really add information.

dpsutton13:04:00

i wonder why some things talk to nrepl client and some talk to cider client

dpsutton13:04:21

wonder if there should be a standard dependency on cider client which can translate to and from nrepl client?

dpsutton13:04:28

or should they all just go straight to the nrepl client

surreal.analysis13:04:49

Is there a way to have project-based REPL history saved? Currently I use

(setq cider-repl-history-file "~/.cider_history”)
but that combines history from all projects. I’d like REPL history to be stored on a per-project basis, such that I can start up a repl, press C-<up>, and be at the last command I executed for that project.

surreal.analysis13:04:05

As I’m bouncing around between more Clojure projects now, it’s harder to keep things straight

nicola13:04:02

How cider recognizes ClojureScript repl? I'm starting repl and then figwheel/cljs-repl - but cider think he in Clojure repl (not clojurescript).

plexus13:04:30

@nicola: you'll have to use cider-jack-in-clojurescript

nicola13:04:14

@plexus: what magic happens in jack-in-clojurescript?

nicola13:04:22

Could i do it by hands?

plexus13:04:36

it opens both a clojure and a clojurescript repl

plexus13:04:51

you can set this to make it play nice with figwheel

plexus13:04:58

(setq cider-cljs-lein-repl
      "(do (require 'figwheel-sidecar.repl-api)
 (figwheel-sidecar.repl-api/start-figwheel!)
 (figwheel-sidecar.repl-api/cljs-repl))")

plexus13:04:29

otherwise by default it starts a Rhino based cljs repl, which is probably not what you want

nicola13:04:28

@plexus: thx, that's my problem simple_smile - let me try

plexus13:04:27

you can thank @malabarba for that snippet, I'm just spreading the word simple_smile

nicola13:04:09

It's interesting what is the difference between cljs and clj repl for emacs internally ?

nicola13:04:25

Some flag variable simple_smile?

plexus14:04:29

there's a buffer local variable cider-repl-type which is either "clj" or "cljs"

plexus14:04:17

and a function cider-current-connection which finds the right REPL for the currrent buffer

rmuslimov14:04:16

I’m experiencing problem with finding proper REPL sometimes, however still can’t reproduce that bug 😞

rmuslimov14:04:55

I mean, sometimes cider use clj repl instead of existing cljs repl

plexus14:04:40

how are you starting your repls?

plexus14:04:00

right, that should work. Sorry I'm not that well versed in the internals of CIDER

rmuslimov14:04:39

no worries, I were reading that thread, and just sharing experience I have with cider

plexus14:04:05

when you say it "uses clj repl", is that when eval'ing code from a file? or when going to the repl (C-c C-z)? or ...?

rmuslimov14:04:43

since cljs buffer mapped to clj repl

rmuslimov14:04:52

all operation goes to incorrect REPL

rmuslimov14:04:03

it has happened with my cider few times, in different circumstances, I actually can’t stable reproduce that, that’s the problem

nicola14:04:40

And for me inverse sometimes cider recognized cljs repl started in clj repl, but rarely ;)

xcthulhu14:04:28

Hey, I added some stuff to the figwheel wiki based on the wisdom I've learned from this chat room: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl#integration-with-emacscider

xcthulhu14:04:13

TBH I can't get this to work very reliably ; do I need :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]} in my profiles.clj?

xcthulhu14:04:47

Incidentally CIDER has a variable cider-jack-in-nrepl-middlewares, but it's apparently only boot injects it, not leiningen: https://github.com/clojure-emacs/cider/blob/master/cider.el#L339

malabarba14:04:24

@dpsutton the files that call nrepl-client directly are those that use the nrepl-dict object. We should probably move the dict functions to util or common.

malabarba15:04:24

@xcthulhu: lein has plugins which are capable of injecting tyheir own middleware, so we inject plugins instead of middlewares for lein]

bhauman16:04:39

@xcthulhu: I think you got way ahead of your self here.

bhauman16:04:24

The injection is not needed if this requirements are already in the project.clj

bhauman16:04:09

which is arguably the better way to do it

bhauman16:04:03

in fact the emacs injections don't work at all for me

xcthulhu16:04:12

Oh yeah but it doesn't hurt anything. Moreover I try to keep dependency requirements in project.clj to a minimum because it makes travis testing take longer the more stuff you burden it with

xcthulhu16:04:23

What version of CIDER are you on?

bhauman16:04:57

oh yeah, haven't upgraded to 12 yet

xcthulhu16:04:03

I'm using this in my init.el

xcthulhu16:04:08

(add-to-list 'cider-jack-in-dependencies '("com.cemerick/piggieback" "0.2.1"))
(defun figwheel-repl (buffer)
  "Start a figwheel repl (for clojurescript development).  Takes BUFFER as an argument."
  (interactive "P")
  ;; TODO: this can't be temporarily bound in the let below for some reason
  (setq cider-cljs-lein-repl
        "(do (require 'figwheel-sidecar.repl-api)
             (figwheel-sidecar.repl-api/start-figwheel!)
             (figwheel-sidecar.repl-api/cljs-repl))")
  (let ((cider-jack-in-lein-plugins
         (cons '("lein-figwheel" "0.5.2") cider-jack-in-lein-plugins))
        (cider-jack-in-dependencies
         (cons '("figwheel-sidecar" "0.5.2") cider-jack-in-dependencies)))
    (cider-jack-in-clojurescript)))

xcthulhu16:04:16

Yeah, you need CIDER 0.12.0

bhauman16:04:21

you said it wasn't reliable above

xcthulhu16:04:34

Ah... yes I figured out what was going wrong

xcthulhu16:04:03

I had all of my :figwheel and :cljsbuild stuff in my :dev profile

bhauman16:04:16

oh that will do it

xcthulhu16:04:27

Crazy gotcha

bhauman16:04:19

yeah man, it really is, but otherwise I have to pull in leiningen.core into the running process which is not something you really want

bhauman16:04:56

that could really screw with folks dependency trees

xcthulhu16:04:47

Understood. Anyway, I do prefer keeping as many dependencies as possible in CIDER injections but if you really think having it in project.clj is better I'll go change it back

xcthulhu16:04:55

On the wiki

bhauman16:04:54

I guess I was worried because the injections hadn't worked for me, and it prevents lein repl from working outside of emacs

bhauman16:04:25

when its in the project.clj you can run lein repl and get a working figwheel and cljs-repl

bhauman16:04:47

which is good for testing

bhauman17:04:03

and verifying that the stack is working

bhauman17:04:11

and other things

xcthulhu17:04:12

Okay, I'll go change it back then...

tomfaulhaber17:04:24

how does projectile map between implementation and test? It's complaining "No matching test found" when my test for src/dcp30/netcdf_out.clj is in test/dcp30/netcdf_out_test.clj.

bhauman17:04:04

@xcthulhu: thanks! we don't need to include [org.clojure/tools.nrepl "0.2.11"] anymore?

xcthulhu17:04:14

Ah... because I forgot ...

richiardiandrea17:04:50

@bhauman: that's right, they are automatically injected when you jack-in

richiardiandrea17:04:36

so now you can jack-in and start-figwheel (the classic three calls actually)

richiardiandrea17:04:57

or just jack-in-with-clojurescript

tomfaulhaber18:04:50

https://clojurians.slack.com/archives/cider/p1461603804000840 Ahh, because my clojure project is a level below my git project, projectile seems to think I'm in a generic project and isn't doing the mapping.

malabarba18:04:05

@xcthulhu: Care to open a PR for that? simple_smile

xcthulhu18:04:36

I'm not sure what to do for a PR

xcthulhu18:04:25

I suppose I could make (add-to-list 'cider-jack-in-dependencies '("com.cemerick/piggieback" "0.2.1")) permanent

xcthulhu18:04:31

I have no idea how to fix the fact that (let ((cider-cljs-lein-repl ...)) (cider-jack-in-clojurescript)) doesn't work...

plexus19:04:15

@bhauman: has anyone already brought up the idea of extracting the profile merging logic out of leiningen? Would be useful for other tools as well, as leiningen is quite a hefty dependency

roberto19:04:09

anyone knows why I would be getting the following error: error in process sentinel: Symbol’s function definition is void: cider-turn-on-eldoc-mode ? I started getting this after upgrading cider.

plexus19:04:49

it seems cider-turn-on-eldoc no longer exists. Can it be that you're loading old and new versions? or do you call it yourself in some hook?

roberto19:04:03

no, I’m not calling it myself

plexus19:04:06

you could try M-x toggle-debug-on-error, then reproduce the error and you should get a stack trace

roberto19:04:28

this is the stack trace:

roberto19:04:32

Debugger entered--Lisp error: (void-function cider-turn-on-eldoc-mode)
  cider-turn-on-eldoc-mode()
  run-hooks(cider-mode-hook cider-mode-on-hook)
  cider-mode(1)
  cider-enable-on-existing-clojure-buffers()
  cider--connected-handler()
  run-hooks(nrepl-connected-hook)
  nrepl-start-client-process(nil 60585 #<process nrepl-server>)
  nrepl-server-filter(#<process nrepl-server> "nREPL server started on port 60585 on host 127.0.0.1 - )

roberto19:04:18

do we still need refactor-nrepl in profiles.clj for the latest cider?

plexus19:04:16

and you don't have a cider-mode-hook in your config calling cider-turn-on-eldoc-mode

roberto19:04:51

ah, I found it

roberto19:04:13

yeah, I have a script that gets called on startup that does some setup for me

roberto19:04:21

completely forgot about it, wrote it once and never touched it again

roberto19:04:56

did that function get renamed or completely removed?

plexus19:04:18

that's how it goes with these things. I thought I saw somewhere the regular eldoc-mode works with CIDER now

roberto19:04:20

I was using it to provide minibuffer documentation

plexus19:04:40

or it might just be on by default, I don't have anything in my clojure setup to enable it and I'm still seeing function signatures in the minibuffer