Fork me on GitHub
#cider
<
2018-05-08
>
dpsutton00:05:09

@b2berry take off the quote on figwheel

b2berry00:05:54

Whereabouts? I just removed the quote in cider-cljs-repl-types but that made no difference

dpsutton00:05:09

Right before figwheel

dpsutton00:05:55

@b2berry

((nil . ((cider-lein-global-options . "with-profile dev")
         (cider-default-cljs-repl . figwheel))))

dpsutton00:05:59

that's from mine for work

dpsutton00:05:12

make sure to save. and sometimes dir locals can be a little finicky

bozhidar05:05:06

No idea what this signature is. Have never seen such an error before.

bozhidar05:05:29

What’s your Emacs version?

bozhidar05:05:21

@b2berry I see in your second example you haven’t defined anywhere a type named figwheel+harmonium, that’s the fundamental problem.

bozhidar05:05:30

You should change “Harmonium” to figwheel-harmonium. Also - we’ve got a function called cider-register-cljs-repl-type which you can also use in your init.el or whatever.

bozhidar05:05:25

@bhauman Thanks for looking into this!

theeternalpulse05:05:12

emacs 25.2.2, I am also running the emacs command with a modified home to point to a separate directory structure for testing. Think that may be it. I just don't want to override my current emacs setup

bozhidar07:05:15

Anyways, I’m happy that after I woke up I didn’t find a ton of issues reported here or on GitHub. Seems despite the final push and last minute issues the release shaped up nicely. 🙂

benedek08:05:03

@dominicm seen your comment over the weekend. Does that mean you rejig how the vars are listed in cider /orchard?

benedek08:05:22

So i guess i eventually need to sync with master and follow up...

benedek08:05:50

Planned to work on the emacs /client side tbh next

dominicm08:05:12

@benedek I think your work will potentially become a lot easier. I created a function in orchard for listing vars generically.

benedek08:05:30

Will have a look

benedek08:05:51

Does it do filteting with custom preds? ;)

dominicm08:05:59

@benedek Nope, it's data driven, which I think is better. The idea is that it should be an interface you can send over nrepl. What predicates did you have?

benedek08:05:21

If it has a certain meta for example... i should probably check out your code before asking ;)

benedek08:05:47

Which ns or commit should i look at?

dominicm08:05:06

@benedekyou can filter by having certain metadata keys, same as how tests can be filtered now 🙂

dominicm08:05:18

@benedek orchard the orchard.query namespace

benedek08:05:35

You mean the vars fn right

benedek08:05:40

I see what you mean

benedek08:05:02

An include fn and exclude fn would be nice perhaps

benedek08:05:28

So one can filter failed tests for example

benedek08:05:34

Or really anything

benedek08:05:59

You already doing something like that with manipulate-vars

benedek08:05:30

Should have started with thanks for this btw apologies and thx for this ;)

dominicm08:05:48

@benedek it's hacked together from usages elsewhere, certainly scope for more tweaks. I'm keen to avoid functions being passed for filtering, as it restricts nrepl clients a little. The idea is that they would send this data structure directly, with some coercion in the middle.

dominicm08:05:39

What kind of filtering are you thinking of?

benedek08:05:59

Does not manipulate-vars break this a bit already?

benedek08:05:42

Filtering for failed tests which needs extra info (the value in the test result atom)

benedek08:05:31

I guess nrepl clients would not be able to use this only internal clients

dominicm08:05:48

Yeah,thats a total hack for apropos to add special symbols.

benedek08:05:32

I am just proposing an other hack then. But have not tried to code the failed tests bit yet

benedek08:05:46

So just guessing what would be nice here really

benedek08:05:56

So feel free to ignore for now

benedek08:05:34

I will nag you again to discuss if i have something more concrete

dominicm08:05:44

But it could be used for this, my goal of the interface is really that apropos should be able to list failed tests.

dominicm08:05:50

It might be that the test wrapper moves into orchard, then this function can have a flag for filtering to those vars

bozhidar09:05:01

Yeah, the test wrapper should move to orchard as well. There’s still a lot of code that has to be moved there (and improved in the process I guess).

bozhidar09:05:50

It would also be nice if we agreed on some common conventions for the nREPL middleware APIs, so there are no editor quirks leaking there.

orestis09:05:30

I just realised that CIDER will happily jack-in to a simple deps.edn project. So convenient! Thank you @bozhidar and team!

bozhidar09:05:16

You’re welcome! 🙂

dominicm09:05:51

I'm wondering if it might be an old snapshot, but I have no basis for that.

bozhidar09:05:38

Seems he’s on stable.

bozhidar09:05:51

Frankly, I didn’t test this at all yesterday - I just hoped you got the fix right.

bozhidar09:05:24

I’m way too busy at work currently, so I’ve got next to no time for testing/debugging myself.

dominicm10:05:31

Unless the namespace isn't being sent, I don't know what could be wrong. I might have to try the dark side or something.

bozhidar10:05:03

Join us. 😉

benedek10:05:07

just upgraded

benedek10:05:11

Works for me

dominicm10:05:31

Feeling annoyed with myself for getting this- plot thickens!

benedek10:05:37

I loaded the ns before C-c C-t C-t

dominicm10:05:52

Is it possible that the old version required the namespace before running the test?

bozhidar10:05:19

Don’t think so.

benedek11:05:10

Expez very likely uses cljr too

benedek11:05:34

loads nses at start up unless configured differently

benedek11:05:16

I have this disabled on my work (win) machine

benedek11:05:36

Yeah sorry so the default is not to load them unless you explicitly change the config to do so

dominicm12:05:38

I Am without internet. My local snapshot works though. Excepting maybe auto-require

dominicm12:05:49

Works with Emacs that is

jmckitrick15:05:28

Hi all, I just updated my work machine to 0.17.0. I’m running a project with shadow-cljs. I seem to recall that when I ran cider connect on my personal machine (running stable) cider was able to figure out the host, port, and app I was running. Did I imagine that? Is that included in 0.17.0, or only stable ?

bozhidar16:05:41

0.17.0 is the stable now 🙂

bozhidar16:05:00

As for the ports - this works just for lein repls, not sure if we can extend it to shadow as well. Basically we’re just running ps and parsing its output.

dominicm16:05:23

That's how it works?!

bozhidar16:05:36

If some process has the info we need we can extend this functionality, if it doesn’t - we’re out of luck. I recall boot does not have it.

bozhidar16:05:46

@dominicm Yeah. It’s as lame as it gets. 😄

bozhidar16:05:23

Ideally all nREPLs should register somewhere, but this requires changes to nREPL.

dominicm16:05:27

I suppose that saves you from opening the relevant Project.clj file?

bozhidar16:05:54

I’m still waiting on @cemerick to give us access to the repo.

bozhidar16:05:39

@dominicm How would you know which is the relevant project? 🙂

dominicm16:05:31

@bozhidar look at the opened file, and search upwards for .nrepl-port.

dominicm16:05:54

(this is what fireplace does)

bozhidar16:05:00

Normally when you’re doing cider-connect you’re not in a project.

bozhidar16:05:11

You’d be doing cider-jack-in within a project.

bozhidar16:05:03

If you do what you’d suggest you’d see just one running process, inspecting ps shows you all the servers running on localhost.

dominicm16:05:07

There's a list of running nrepl servers? I see. Interesting.

jmckitrick16:05:45

that makes sense.

jmckitrick16:05:59

Except my current project is shadow-cljs only.

jmckitrick16:05:08

But the same idea should work.

b2berry16:05:18

I’m having no luck getting cljs-repl to startup, still. My .dir-locals is

(nil
  (cider-default-cljs-repl . harmonium)
  (cider-cljs-repl-types
   ('harmonium "(do (require 'figwheel-sidecar.repl-api)\n            (figwheel-sidecar.repl-api/start-figwheel! \"login\" \"imageviewer\" \"harmonium\")\n            (figwheel-sidecar.repl-api/cljs-repl))")))
which seems totally right. I’m running in spacemacs. I’m running 0.17.0 for cider. I’ve tried the nuclear option by blowing away all my maven repo’s, reinstalling /.emacs.d, trying a brand-new .spacemacs.

b2berry16:05:51

If I eval inside a running emacs instance (cider-register-cljs-repl-type 'harmonium "do (<see string above>...)") and then cider-jackin-clojurescript it allows me to choose this repl type and it’s good-to-go.

b2berry16:05:09

Completely strangely though everyone on my project team has no issues even though they’ve upgrade to 0.17.0 (and some haven’t) I’m sort of baffled at this point, certainly seems isolated to my environment but I don’t really know where else to go from here. Any thoughts?

b2berry16:05:30

Oh, helps if I post the error I’m getting: error in process filter: cider-cljs-repl-form: Symbol's function definition is void: nil

bozhidar16:05:36

@b2berry Seems to me you’re missing a set of parens.

b2berry16:05:46

That was a yank error I think

bozhidar16:05:48

The repl-types is supposed to be a list of lists.

b2berry16:05:08

I’ll adjust that now

bozhidar16:05:45

(defvar cider-cljs-repl-types
  '((nashorn "(cider.piggieback/cljs-repl (cljs.repl.nashorn/repl-env))"
             cider-check-nashorn-requirements)
    (figwheel "(do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/start-figwheel!) (figwheel-sidecar.repl-api/cljs-repl))"
              cider-check-figwheel-requirements)
    (node "(do (require 'cljs.repl.node) (cider.piggieback/cljs-repl (cljs.repl.node/repl-env)))"
          cider-check-node-requirements)
    (weasel "(do (require 'weasel.repl.websocket) (cider.piggieback/cljs-repl (weasel.repl.websocket/repl-env :ip \"127.0.0.1\" :port 9001)))"
            cider-check-weasel-requirements)
    (boot "(do (require 'adzerk.boot-cljs-repl) (adzerk.boot-cljs-repl/start-repl))"
          cider-check-boot-requirements)
    (shadow cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements)
    (custom cider-custom-cljs-repl-init-form nil)))

bozhidar16:05:56

That’s the default list.

b2berry16:05:46

So in .dir-locals

((nil
  ((cider-default-cljs-repl . harmonium)
   (cider-cljs-repl-types
    ('harmonium "(do (require 'figwheel-sidecar.repl-api)\n            (figwheel-sidecar.repl-api/start-figwheel! \"login\" \"imageviewer\" \"harmonium\")\n            (figwheel-sidecar.repl-api/cljs-repl))")))))
Is legit?

bozhidar16:05:10

No, it’s not.

b2berry16:05:11

Ah ok based on your example I’m still slightly off

b2berry16:05:33

Like so?

((nil
  (cider-default-cljs-repl . harmonium)
   (cider-cljs-repl-types
    (('harmonium "(do (require 'figwheel-sidecar.repl-api)\n            (figwheel-sidecar.repl-api/start-figwheel! \"login\" \"imageviewer\" \"harmonium\")\n            (figwheel-sidecar.repl-api/cljs-repl))")))))

bozhidar16:05:39

'((harmonium…

b2berry16:05:52

Ah ok got it

b2berry16:05:10

I think in the last twelve hours working on this I’ve seen probably 8 variations on how this is handled

bozhidar16:05:24

You should have just asked. 😉

b2berry16:05:04

🙂 I’ve tried to learn from the previous similar questions first and try to think before begging for someone else to deal with my problems 😄

bozhidar16:05:15

But yeah - the syntax is .dir-locals.el is very confusing even for me. Often I have to google for this myself.

bozhidar16:05:40

I’d just used to the semantics of (setq ....

b2berry16:05:01

My team is having success running on a completely different set of syntax that has stopped working for me, doesn’t make sense

b2berry16:05:41

((nil
  (cider-default-cljs-repl . harmonium)
   (cider-cljs-repl-types
    '((harmonium "(do (require 'figwheel-sidecar.repl-api)\n            (figwheel-sidecar.repl-api/start-figwheel! \"login\" \"imageviewer\" \"harmonium\")\n            (figwheel-sidecar.repl-api/cljs-repl))")))))
Just rendered
error in process filter: cider-cljs-repl-form: Symbol's function definition is void: nil

bozhidar16:05:27

Probably you need that . as well - like for the first form.

b2berry16:05:22

after the nil, yeah? I’ve attempted that in previous variations of this, I’ll try that here

bozhidar16:05:54

`(cider-cljs-repl-types . ’((harmonium “(do (require ’figwheel-sidecar.repl-api)\n (figwheel-sidecar.repl-api/start-figwheel! \“login\” \“imageviewer\” \“harmonium\“)\n (figwheel-sidecar.repl-api/cljs-repl))“)`

b2berry16:05:01

Ah, ok I’ll try that

b2berry16:05:13

(I’m jumping the gun here, I’ve been at this awhile 😄 )

bozhidar16:05:28

I’m reasonably certainly it should be something like this.

bozhidar16:05:44

(cider-cljs-repl-types .
    ((harmonium "(do (require 'figwheel-sidecar.repl-api)\n            (figwheel-sidecar.repl-api/start-figwheel! \"login\" \"imageviewer\" \"harmonium\")\n            (figwheel-sidecar.repl-api/cljs-repl))")

bozhidar16:05:59

Probably this auto-quotes the list.

b2berry16:05:39

error in process filter: Wrong type argument: listp, quote [2 times]

b2berry16:05:55

^ for the first attempt, trying the second variation now

b2berry16:05:04

(without the leading ' that is )

bozhidar16:05:42

You can also use eval to just register a new type before setting it - e.g. like shown here https://emacs.stackexchange.com/questions/21955/calling-functions-in-dir-locals-in-emacs

b2berry17:05:46

Winner!

((nil
  (cider-default-cljs-repl . harmonium)
   (cider-cljs-repl-types .
    ((harmonium "(do (require 'figwheel-sidecar.repl-api)\n            (figwheel-sidecar.repl-api/start-figwheel! \"login\" \"imageviewer\" \"harmonium\")\n            (figwheel-sidecar.repl-api/cljs-repl))")))))

bozhidar17:05:08

The beers are on you 😉

b2berry17:05:20

I’ll buy all the beers!

b2berry17:05:31

Thanks a lot man, much appreciated!

bozhidar17:05:19

You’re welcome!

arrdem18:05:08

CIDER together with aggressive-indent-mode seems to be insisting on vertical alignment of let forms and maps. While normally I’m a fan of this behavior, my team isn’t. I’m seeing that the relevant customs are defined to be off - am I missing something here?

arrdem18:05:05

Argh. It looks like this is a bug in clojure-mode - it smells like there’s a shared codepath which assumes that automatic alignment is always enabled.

arrdem18:05:13

Don’t have the time to tear all this apart right now.

arrdem18:05:54

It looks like clojure-align-region is the only place that clojure-align-forms-automatically is respected, so when you hit clojure-indent-function eg via aggressive-indent-mode it never does the form alignment check and just runs the same codepath.

bozhidar19:05:54

File a ticket about this. I wonder why no one hasn’t noticed it in 3 years or something. 🙂

arrdem19:05:43

I’m probably one of very few people running aggressive-indent-mode I bet.

eggsyntax19:05:41

I reaaaally love aggressive-indent-mode, but I had to ditch it because it was completely killing my emacs perf. I should try it again one of these days in case the situation has improved.

bozhidar19:05:41

It doesn’t play well with big files in general, and it plays terribly with CIDER’s dynamic indentation.

eggsyntax19:05:02

Sounds like possibly not improved, then 😉

bozhidar19:05:12

I was using it in the past, but even for bigger Elisp files it was making everything unusable.

eggsyntax19:05:05

@arrdem you haven't had those sorts of problems, then?

richiardiandrea20:05:25

I am using it currently but I have to say not with cider and not on big files

richiardiandrea20:05:21

Now the cljfmt has been posted to Graal I am planning to use that

arrdem20:05:31

@eggsyntax I definitely see CIDER/Emacs lag on large clj files. Enforces some small ns discipline 😉

dpsutton21:05:33

it's not a bug its a feature

sashton21:05:56

I’m not an emacs user, but I noticed that there is a CIDER-nREPL command format-code which uses cljfmt. Is that not commonly used?

richiardiandrea21:05:31

@sashton aggressive-indent-mode does the reindantation at every key stroke, that's the beauty of it

sashton21:05:04

i’m curious why you mentioned trying graal-cljfmt, given there is a cider command for it. is there a disadvantage to the built-in command? with the jvm already running, I assume startup time isn’t an issue.

richiardiandrea23:05:33

@sashton there is no command in cider directly, but I think somebody posted a hook trigger

richiardiandrea23:05:39

on Twitter of something

sashton23:05:03

Sorry, I meant there is a command for formatting with cljfmt which is packaged in cider-nrepl: cider-format-code

richiardiandrea23:05:05

I don't think there is any if I remember correctly