Fork me on GitHub
#cider
<
2016-12-29
>
qqq02:12:16

in cider, when I get an error, it shows "Show: Clojure Java Repl Tooling Duplicates All" -- with Clojure/Java/Repl selected by default. I want only Clojure to be selected by default. Is there a way to configure this in Emacs?

dpsutton03:12:01

(defcustom cider-stacktrace-default-filters '(tooling dup)
      "Frame types to omit from initial stacktrace display."
      :type 'list
      :group 'cider-stacktrace
      :package-version '(cider . "0.6.0"))

dpsutton03:12:20

I think you can edit this var to filter out what you don't want

dpsutton03:12:13

and these look like your options

dpsutton03:12:14

5 matches for "cider-stacktrace-toggle '" in buffer: cider-stacktrace.el 439: (cider-stacktrace-toggle 'java)) 444: (cider-stacktrace-toggle 'clj)) 449: (cider-stacktrace-toggle 'repl)) 454: (cider-stacktrace-toggle 'tooling)) 459: (cider-stacktrace-toggle 'dup))

dpsutton03:12:10

so if you did (setq cider-stacktrace-default-filters (append cider-stacktrace-default-filters '(java repl tooling))) you should be good to go

dpsutton03:12:16

but i can look into it further later

qqq03:12:30

@dpsutton : trying this now

qqq03:12:43

if it works; I'll also have to ask how you figired this out

dpsutton03:12:44

i'm not sure if filters filter things out or filter down to those though

qqq03:12:45

but for now, let me try it first

qqq03:12:41

@dpsutton: okay, this worked! how did you figure this out? I know enough elisp to write my own defuns and hydras, but I couldn't figure out this cider issue

dpsutton04:12:27

so i know that there's a cider stacktrace.el

dpsutton04:12:33

so i went there and i knew there was filtering stuff

dpsutton04:12:39

so i found the first thing that looked like filtering

dpsutton04:12:43

jumped around a few definitions

dpsutton04:12:46

and the defcustoms

dpsutton04:12:58

bbatsov (the maintainer) is super super good at making CIDER customizable

dpsutton04:12:03

so i knew it was just finding the right var

dpsutton04:12:09

and I found the toggle functions

dpsutton04:12:16

so i found the fdefault list

dpsutton04:12:29

and then found all the toggle functions to see what the valid options were

qqq04:12:36

interseting, let me take a look at customize-group cider-stakctrace

dpsutton04:12:48

and now i know to update the validation on that defcustom to make sure its easy to know what values it can take

qqq04:12:54

ha, first option is "cider-stacktrace-default-filters"

dpsutton04:12:04

but you have to know what to put there

qqq04:12:04

okay, thanks for explaiing all thisto me, alot less magical now 🙂

dpsutton04:12:08

that should be easier to figure out

dpsutton04:12:15

always glad to help

qqq04:12:15

yeah, it's easy to figure uot once you know he magic password

dpsutton04:12:17

i don't know that much

dpsutton04:12:25

but i find that as time goes on its easier to dig around

dpsutton04:12:27

and find out answers

nikki08:12:06

anyone get a cider repl working with compojure?

nikki08:12:23

i'm working through the 'living clojure' book atm and it does a lein ring server

nikki08:12:41

i guess i should google for 'cider ring' rather than 'cider compojure' which i've done till now, will come back here if still stuck...

nikki08:12:45

fwiw: got it working by adding :nrepl {:start? true} in :ring in project.clj, but autocompletion with company mode doesn't work 😕

nikki08:12:00

would appreciate advice from someone that is using cider with ring

dpsutton13:12:36

I'm not sure I understand your question @nikki

dpsutton13:12:45

Did you do lein ring server from the command line?

dpsutton13:12:03

And that worked?

nikki13:12:05

i want to be able to see autocompletions from cider tho

nikki13:12:13

ya it works as in it runs the website

dpsutton13:12:32

and no completions work or just things in the ring and compojure namespaces?

dpsutton13:12:46

why did you add :nrepl {start? true} then

nikki13:12:06

because cider needs a repl instance to connect to for autocompletions to happen right?

nikki13:12:33

i could cider-jack-in but that makes a repl separate from the server process

nikki13:12:48

so i did 'connect' to the nrepl running from ring server instead

dpsutton13:12:55

I don't use that workflow

nikki13:12:59

and that gives me an ok repl in emacs but doesn't autocomplete

dpsutton13:12:08

I usually just lein ring server in a temrinal

dpsutton13:12:12

and then jack in in emacs

nikki13:12:23

so you jack in and use a separate process?

dpsutton13:12:25

and the ring server automatically updates with things except for handler changes

dpsutton13:12:41

but my site was largely static so it really didn't matter to me

nikki13:12:57

(i don't plan on but) you can't run things interactively to muck with server's state from the repl in emacs then i guess right?

dpsutton13:12:00

i'm not sure if you are dealing with session stuff where inspecting the running instance may be more important

dpsutton13:12:06

I bet you can

nikki13:12:08

i can deal with this for now

dpsutton13:12:12

I'm not sure of the best way to do that though

nikki13:12:18

i'm just going through the "living clojure" book

nikki13:12:27

well one way is to launch ring from a repl that you create with jack-in

nikki13:12:30

by running jetty or whatever

nikki13:12:35

(based on googling)

dpsutton13:12:35

yeah i would just run them in parallel right now

dpsutton13:12:50

no problem.

dpsutton13:12:52

enjoy the book

benedek14:12:51

@nikki just guessing but if you connect instead of jacking in you need to add the middlewares yourself

benedek14:12:14

via your profiles.clj or in the project file

qqq15:12:56

I'm using cider for my clojure development. I need to pick a unit testing framework. The main criterion is "works well with cider". Which one should I use?

dpsutton15:12:31

CIDER plays nice with this. I think sean might be working on some integration with another testing framework but I haven't heard about it in a little while

qqq15:12:25

@dpsutton: you helped me with the cider error reoprt hide java/repl issue last night; I trust your advice; clojure.test it is 🙂

dpsutton15:12:48

don't do it like that. definitely look into it but look at other options as well

dpsutton15:12:08

I've never worked inside of the testing side of CIDER so I don't have any knowledge other than commonly repeated advice here

qqq15:12:11

the one thing I feel haskell has over clojure is that I'm much more willing to refactor in haskell, but with a decent testing framework, I may be able to refactor in clojure too

qqq15:12:22

in C, there is an "other-file" which jumps between .h and .c; in cider, is there an "other file" for jumping between src/... and test/... ?

dpsutton15:12:53

pretty sure

dpsutton15:12:57

can't think of it offhand

dpsutton15:12:59

but i'm looking now

qqq16:12:42

and it seems like it'll be easier if I just setup it up as foo/bar.clj vs foo/bar_test.clj

qqq16:12:49

since it appears cider is just adding a -test to the nanemsapce

qqq17:12:59

it was removed from cider 😞

dpsutton17:12:36

well did you understand why it was removed from cider?

dpsutton17:12:41

it was integrated into projectile

dpsutton17:12:54

if you have this installed, > C-c p t Toggle between an implementation file and its test file.

dpsutton17:12:10

if you don't have it installed, it is highly recommended

qqq17:12:55

Yes, C-c p t is not working unfortuately ( I do have helm proj3ctile installed)

norman17:12:36

It should work. What is tour test code namespace and test namespace?

qqq17:12:51

c/f/mm.cljc and c/f/mm_test.cljc

qqq17:12:58

I'm wondering now if it's the cljc that's throwing it off

qqq17:12:59

c/f/foo.clj and c/f/foo_test.clj don't work either

dpsutton17:12:10

do you not have it in the test/ subdirectory? is it in src/?

qqq17:12:28

this is currently src/c/f/foo.clj and src/c/f/foo_test.clj

dpsutton17:12:50

i'll bet it has the assumption baked in to look in test/samepath/namespace_test.clj

qqq17:12:00

ah; it works now;

qqq17:12:09

all in /src/... I think it was a projectile issue

qqq17:12:12

thanks for all your help!

jfntn17:12:18

Anyone else experiencing major completion slowdowns with the melpa version over the last few days?

dpsutton17:12:49

no significant changes in the last few weeks I dont' think

neurogoo18:12:11

When I start program with Cider what is the default lein profile it uses? I assumed that it would use dev profile, but it doesn't seem so

neurogoo18:12:15

I have web server project and I put some ssl middleware to the ring setup in the prod side, but now sometimes but not always it seems that those setups are used when starting process with Cider.

bhagany19:12:47

Can anyone enlighten me - I do not understand where printer comes from here: https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/out.clj#L57

dpsutton19:12:01

i looked at this last night @bhagany

dpsutton19:12:09

it doesn't have to be resolved, but is resolved in the macro

dpsutton19:12:32

notice that parameter in the macro is v, which gets overwritten

dpsutton19:12:46

so i believe that its not resolved, but then gets bound in the macro

dpsutton19:12:52

so its a little bit of an anaphor in that sense

dpsutton19:12:07

(defmacro with-out-binding
  "Run body with v bound to the output stream of each msg in msg-seq.
  Also run body with v bound to `original-out`.
  type is either :out or :err."
  [[v msg-seq type] & body]
  `(do (let [~(with-meta v {:tag Writer}) (case ~type
                                            :out original-out
                                            :err original-err)]
         ~@body)
       (doseq [{:keys [~'session] :as ~'msg} ~msg-seq]
         (let [~(with-meta v {:tag Writer}) (get @~'session
                                                 (case ~type
                                                   :out #'*out*
                                                   :err #'*err*))]
           (try (binding [ie/*msg* ~'msg]
                  ~@body)
                ;; If a channel is faulty, dissoc it.
                (catch Exception ~'e
                  (unsubscribe-session ~'session)))))))

dpsutton19:12:17

see that's the v parameter

dpsutton19:12:22

and it binds that in the first let

dpsutton19:12:39

by casing on type to either original-out or original err

dpsutton19:12:45

but it caught me off guard last night as well

dpsutton19:12:02

That's untested of mine but what i gathered from reading the code last night

dpsutton19:12:51

so v in the macro will be printer which is called in @body

dpsutton19:12:57

so i think its just unhygenic and weird looking

bhagany19:12:01

hrm… perhaps my mental macro expansion is not up to snuff… I’m going to play with that in a repl

dpsutton19:12:39

are you working on the bug where java.lang.System/out doesn't print to the repl?

bhagany19:12:42

oh wait… I get it. ~(with-meta v {:tag Writer}) expands to a binding with the meta already attached

dpsutton19:12:00

it binds printer to (case ~type ...)

bhagany19:12:21

yes, basically, though I’m personally interested in System/err

dpsutton19:12:21

''' (with-out-binding [printer messages type] (.write printer x)) '''

bhagany19:12:42

and I think it’s the same bug as the one you referenced

bhagany19:12:36

@dpsutton thanks for explaining that, it was driving me crazy

dpsutton19:12:53

funny that I was reading that code literally last night

dpsutton19:12:58

and had the same question

bhagany23:12:12

well, this is interesting. I have a proof-of-concept fix for this bug: https://github.com/clojure-emacs/cider/issues/1588

bhagany23:12:21

The only snag is that I’m getting the stderr output in the repl buffer before the prompt that triggers writing to stderr

dpsutton23:12:36

got a link to a branch?

bhagany23:12:38

that seems really weird, and I don’t know where to begin looking for how to fix that

dpsutton23:12:41

I'd like to look over it

bhagany23:12:43

let me put it on github

bhagany23:12:52

it’s hacky right now, fyi

dpsutton23:12:56

that's fine

dpsutton23:12:02

i've been looking for a gist of what's going on

dpsutton23:12:12

i think the thing you're working on is similar to a recently lodged issue

dpsutton23:12:22

so i'd like to see what you're thinking and how you're getting at it

dpsutton23:12:01

so it just was ignoring the PrintStream

dpsutton23:12:34

i think java.lang.System/out is also a Printstream so I'll see if I can't use this idea to fix the bug https://github.com/clojure-emacs/cider/issues/1896

bhagany23:12:41

basically, yes

dpsutton23:12:44

I'm heading out of the office now but thanks for showing

bhagany23:12:50

yes, System/out is a PrintStream

dpsutton23:12:54

I don't know much java so I need to read up on those classes

bhagany23:12:58

sure, glad to 🙂

dpsutton23:12:06

i'm a .NET guy at work so this is a very foreign world to me

bhagany23:12:15

I’m a Python guy at work, so, same 🙂

bhagany23:12:53

I would call #1896 almost a dupe of #1588. The only difference is stdout vs stderr. My branch should “work” for #1896 as well.

bhagany23:12:12

heh, I suppose I can just try it

dpsutton23:12:12

well, if as you refine it you can test it against that, I'm sure they'd love a pull request

dpsutton23:12:29

and to run tests with cider-nrepl you have to use profiles

bhagany23:12:41

yes, I get the output in the repl, but again, inserted before the prompt

dpsutton23:12:41

I was surprised the first time when like 10 assertions pass

dpsutton23:12:53

that's a much smaller issue than disappearing text 🙂

bhagany23:12:12

heh, hopefully

bhagany23:12:38

here’s what I end up with, just to be as clear as possible

something
user> (.println (java.lang.System/out) "something")
nil

dpsutton23:12:26

well if you opened the pull request with that I'm sure someone there could point out what's happening

dpsutton23:12:38

it may just be a resequencing of something

dpsutton23:12:55

wait, how does that even happen

dpsutton23:12:03

how does it get inserted in the line above?

dpsutton23:12:10

it shifts the prompt down?

bhagany23:12:14

yep, the prompt moves

dpsutton23:12:48

whatever emacs

bhagany23:12:05

I’ll start commenting on the relevant issues, and see if anyone responds

dpsutton23:12:06

well its still closer