(defmacro pprint-logical-block
"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."
{:arglists '[[options* body]]}
[& args]
(let [[options body] (parse-lb-options #{:prefix :per-line-prefix :suffix} args)]
`(do (if (level-exceeded)
(.write ^java.io.Writer *out* "#")
(binding [*current-level* (inc *current-level*)
*current-length* 0]
(start-block *out*
~(:prefix options) ~(:per-line-prefix options) ~(:suffix options))
~@body
(end-block *out*)))
nil)))
Comments top
No comments for pprint-logical-block. Log in to add a comment.