pprint-logical-block(clojure.contrib.pprint)

Macro

Execute the body as a pretty printing logical block with output to *out* which must be a pretty printing writer. When used from pprint or cl-format, this can be assumed. Before the body, the caller can optionally specify options: :prefix, :per-line-prefix, and :suffix.

; clojure/contrib/pprint/pprint_base.clj:251
(defmacro pprint-logical-block 
  [& args]
  (let [[options body] (parse-lb-options #{:prefix :per-line-prefix :suffix} args)]
    `(do (if (and *print-level* (>= *current-level* *print-level*)) 
           (.write #^PrettyWriter *out* "#")
           (binding [*current-level* (inc *current-level*)
                     *current-length* 0] 
             (.startBlock #^PrettyWriter *out*
                          ~(:prefix options) ~(:per-line-prefix options) ~(:suffix options))
             ~@body
             (.endBlock #^PrettyWriter *out*)))
         nil)))

Copyright (c) Rich Hickey. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse Public License 1.0, which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.