Fork me on GitHub

Q: is there a way to make pprint in the repl output window use colors? Since Aviso supports this, it seems like it might be possible


some background: I am a frequent user of the scope-capture lib which allows me to send forms to the REPL and there I get colors. Sometimes I want to just check a value using pprint and then I lose colors. It would be less keystrokes and easier on the eyes if pprint could do this too


@steveb8n It's because you're not sending raw values


instead your asking the *out* buffer to dump a string


Not sure if you can directly ship a value to the repl without returning it


Thanks. I thought as much

Lennart Buit21:01:15

I have a macro that vaguely resembles defrecord, can I somehow tell cursive that it does so that it stops throwing “cannot resolve” erorrs?

Lennart Buit21:01:01

I tried changing it via the light bubble menu thing to defn, but no success and to defrecord but also not happening

Lennart Buit21:01:06

Its “syntax” looks like (defmyrecordish [arg1 arg2 arg3] (fn [x] ... including refs to arg1 arg2 arg3 ...))

Lennart Buit21:01:43

or .. otherwise, can I tell Cursive to give up on trying to find errors in particular codeblocks. Bit of a nuclear solution but eh.

Lennart Buit22:01:09

It seems that many of the Fulcro macros are correctly interpreted, is there custom code for those?


@steveb8n Yes, the problem is that pprint works on the server, and Cursive just sees a bunch of output text. If rather than pprint’ing the result you just evaluate it, then Cursive will pretty-print and colour it for you.


i.e. instead of (pprint x) you just do x, then the value of x will be the result of the evaluation, and Cursive will do its usual pprint and colorise.


understood. I didn’t explain clearly. My use-case is that I add a pprint into some fn in the code path and then invoke that path via a test or repl etc. it’s that pprint output that is tough to read


but I understand the difficulty since those pprints are just strings into stdout, not in the result of the eval


I’m not wedded to pprint for this. if there was another util that would support colors, I would gladly use that


I suppose the question is: how many others would want this, if it was possible

Gavin Sinclair00:01:46

@steveb8n I would want it. But here's how I work around it: I use a function tag> to "tag" a value to stdout. Of course, there's no colour there. But tag> also conjes the value to a global list atom, which means I can pick and choose at the REPL which values I want to inspect in more detail.


that’s a cool workaround. I’ll try it


although my goal here is too minimise keystrokes and in this case you will have to eval one more form to send the data from the global to the repl right? (I know I’m being pedantic)


@UF277CJ5P I tend to use the “scope-capture” lib for this. you should check it out, it’s so good!

Gavin Sinclair01:01:02

Thanks, I certainly will.

Gavin Sinclair01:01:06

Regarding your point above, I type (tv) at the REPL to see the most recent tagged value, rather than sending anything to the REPL.


that is pretty sweet. You could even record an IDE macro to invoke the (tv) I suppose. thanks for chiming in 🙂

Gavin Sinclair08:01:33

Welcome 🙂 I'm enjoying learning about scope-capture too.


@lennart.buit There isn’t a good way to do this, no, unless the grammar of the form exactly matches some built-in one that Cursive already understands. Suppressing unresolved errors inside particular forms would work for local bindings but not for any global vars a form creates.


Fulcro has specific support in Cursive, because a lot of people use it, and also it was very easy to add because it looked like om-next, which Cursive already supported.

Lennart Buit23:01:33

And its not possible to abuse Fulcro’s support? Because by sheer luck I can make my macro look like the ones from Fulcro :’).


Yes, in that case you can just use Resolve as… (see here: to do that. The doc is out of date there, there’s now a Specify… option which will allow you to select the Fulcro macro to resolve as.

Lennart Buit23:01:17

haha, fantastic. Not sure whether (future) coworkers will appreciate that tho, I’ll stick with a less-fancy-more-traditional bunch-of-functions approach for now.


Well, it’s only likely to be a problem for future coworkers using Cursive, and if you register that customisation with your project they will see that too.

Lennart Buit23:01:59

oh are they stored somewhere in config? May be worth versioning that file then. My companies clojure developers mainly use cursive


@lennart.buit Yes, go to Settings-&gt;Langs &amp; Frameworks-&gt;Clojure-&gt;Symbol Resolution and set the Scheme to “Project”. Then those customisations will be stored in project files that can be versioned.

Lennart Buit23:01:05

Cool, thanks! Given the - I can only assume - challenging Clojure language, you make a great tool.


Thanks for the kind words! Yes, Clojure is indeed challenging.