How to increase max line length when printing Clojure data -
i writing content edn file , maximum width of lines greater current default value:
(use 'clojure.pprint) nil user=> *print-right-margin* 72 this seems accord output getting. how increase default value?
this function i'm using write out edn file:
(defn pp-str [x] (-> x clojure.pprint/pprint with-out-str)) example use:
(spit "foo.edn" (u/pp-str foo)) where foo might hiccup, or other clojure data.
try rebinding *print-right-margin* either outside pp-str function:
(binding [*print-right-margin* 1000] (spit "foo.edn" (u/pp-str foo))) or inside:
(defn pp-str [x] (binding [*print-right-margin* 1000] (-> x clojure.pprint/pprint with-out-str)))) this temporarily redefine value scope of enclosed block. should help
Comments
Post a Comment