Fork me on GitHub
#emacs
<
2019-12-18
>
Lu09:12:56

Cider question! Is there a way to pprint to buffer with nice formatting? This is what I am trying to see in a readable manner:

(["2020-01-02T12:00:00Z" {:total-precipitation 0.08385746509713285, :temperature 287.9938916973039}] ["2020-01-07T00:00:00Z" {:total-precipitation 0.09868490622908462, :temperature 289.68302887561276}] ["2020-01-25T18:00:00Z" {:total-precipitation 0.16854437338370903, :temperature 295.7740885416667}] ["2020-01-15T06:00:00Z" {:total-precipitation 0.12877143130582921, :temperature 288.2908193550858}] ["2020-01-12T00:00:00Z" {:total-precipitation 0.11650203847709824, :temperature 289.78164253982845}] ["2020-01-26T06:00:00Z" {:total-precipitation 0.17125286424861236, :temperature 288.5767415364583}] ["2019-12-31T06:00:00Z" {:total-precipitation 0.07543482708142084, :temperature 288.6598259420956}] ["2020-01-29T00:00:00Z" {:total-precipitation 0.18237000879119425, :temperature 290.36369293811276}] ["2019-12-19T18:00:00Z" {:total-precipitation 0.012206793018598474, :temperature 295.0340408624387}] ["2019-12-20T18:00:00Z" {:total-precipitation 0.01632653268547181, :temperature 295.13471296721815}] ["2020-01-27T18:00:00Z" {:total-precipitation 0.17602475075160756, :temperature 295.6355842141544}] ["2020-01-28T18:00:00Z" {:total-precipitation 0.18001714509491826, :temperature 295.7472091375613}])

Lu09:12:28

I am using C-c C-p

solf10:12:45

You can always use C-u C-c C-p (`C-u` means invoke the next command with a flag), it pprints to the same buffer

✔️ 4
solf10:12:10

although the result is commented, but then you can just uncomment it

Lu10:12:25

I just did a couple of tests and realized that when invoked from a .clj file the formatting works, while from a .cljs file no chance 😄

solf10:12:08

I haven't done enough clojurescript to help for that, but you should ask in the #cider channel

✔️ 4
sogaiu13:12:44

not tied to cider, but zprint-mode can be handy sometimes

lilactown18:12:49

@lucio you need to be connected to a CLJS REPL in order to invoke from a .cljs file

Lu18:12:28

I have a cljs repl on :) .. it’s just that I get the whole result in one line, when from a clj repl I get it nicely formatted @lilactown

Lu18:12:08

I ended up writing the logic in a .clj file and moving it over once I was done not the most ideal thing, but better than freezing emacs with those endless one line results