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?could you set that var to false globally in a user ns?
alter-var-root maybe?
ah interesting, maybe have a function in my user ns to toggle it
in case I want that
thanks for the idea @adambros
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?
Oh, that should be <prefix>E<motion>
That can be remapped to whatever you need of course
What's the underlying there? Is it a <plug> mapping?
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
All mapping config is done through let g:conjure#mapping#*
values
Ah, I'll probably wait it out for that issue
okay np
cider-nrepl supports settings :print-namespace-maps
in the nrepl messages, so maybe that can be configured in conjure?
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.
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.
Probably worth a pr 🙂