From e81de94470d64f5a2474cd811a60cb49c5efb400 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Sun, 20 May 2012 21:29:21 -0700 Subject: [PATCH] Fix issue #37: Add special cases to pprint-str for *print-level* and *print-length* --- src/clj_ns_browser/utils.clj | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/clj_ns_browser/utils.clj b/src/clj_ns_browser/utils.clj index f6dbedc..a12b6c8 100644 --- a/src/clj_ns_browser/utils.clj +++ b/src/clj_ns_browser/utils.clj @@ -477,7 +477,17 @@ (defn pprint-str "Return string with pprint of v, and limit output to prevent blowup." ([v & kvs] - (with-out-str (binding [*print-length* 32 *print-level* 6] (pprint v))))) + (with-out-str + ;; Special case for these Vars so that they pprint the correct + ;; values. Assume that their values do not need the + ;; *print-length* or *print-level* restrictions to be short. + ;; Since their values are almost always integers, this is + ;; usually the case. + (if (or (= v #'clojure.core/*print-length*) + (= v #'clojure.core/*print-level*)) + (pprint v) + (binding [*print-length* 32 *print-level* 6] + (pprint v)))))) (defn val-kv-filter