Fork me on GitHub
#conjure
<
2021-04-02
>
nate16:04:30

hm, does anyone have a handy solution to printing maps without namespace collapsing? for instance, if I have this map: {:player/name "Bob" :player/position :defense}, the result in Conjure prints like this:

#:player{:name "Bob", :position :defense}
most of the time it's ok with me, but sometimes I want to use that output as a literal in my code (like running ,e! to format a map in my code), and this syntax is not as nice as {:player/name "Bob" :player/position :defense}. I've taken to doing this:
#_(binding [*print-namespace-maps* false] 
    (clojure.pprint/pprint player))
and transplanting the output into my code, but I was wondering if anyone else had a better way of doing that.. Any thoughts?

adambrosio18:04:45

could you set that var to false globally in a user ns?

adambrosio18:04:16

alter-var-root maybe?

nate18:04:40

ah interesting, maybe have a function in my user ns to toggle it

nate18:04:47

in case I want that

nate18:04:56

thanks for the idea @U0CSAHDV0

👍 6
dominicm21:04:43

cider-nrepl supports settings :print-namespace-maps in the nrepl messages, so maybe that can be configured in conjure?

dominicm22:04:50

https://github.com/Olical/conjure/blob/46b766dee43a97266741087085889751b474fb56/fnl/conjure/client/clojure/nrepl/init.fnl#L30-L32 ah, here you are. If you have cider-nrepl installed, you can change this to cider.nrepl.pprint/pprint and add the print-namespace-maps option. While at it, you could also switch to zprint or something, which might not do this anyway.

dominicm22:04:13

https://github.com/Olical/conjure/blob/a2298d12aaa2065f4a395f017ee1f3d392db283c/fnl/conjure/client/clojure/nrepl/server.fnl#L67-L76 oh, looks like there's just a short hardcoded list of options supported, even though it varies from printer to printer.

dominicm22:04:23

Probably worth a pr 🙂

dominicm21:04:58

Just had a poke at conjure's docs. Am I right that there's no evaluation operator? Just mappings which run the commands on visual selections and such?

berkeleytrue02:04:11

What do you mean?

dominicm06:04:41

An operator as in a vim operator.

Olical12:04:22

Oh, that should be <prefix>E<motion>

Olical12:04:46

That can be remapped to whatever you need of course

dominicm14:04:26

What's the underlying there? Is it a <plug> mapping?

Olical14:04:47

There's no plug mappings right now, it's prefixed by local leader by default, https://github.com/Olical/conjure/issues/186 is open until I get around to reworking mappings to be plug based for those that like that

Olical14:04:07

All mapping config is done through let g:conjure#mapping#* values

dominicm14:04:33

Ah, I'll probably wait it out for that issue