New draft (#3) of SRFI 272: Pretty Printing Arthur A. Gleckler (21 Sep 2026 18:44 UTC)
Re: New draft (#3) of SRFI 272: Pretty Printing Sergei Egorov (21 Sep 2026 19:01 UTC)
dynamic pretty-printing Per Bothner (21 Sep 2026 21:26 UTC)
Re: dynamic pretty-printing Sergei Egorov (22 Sep 2026 04:42 UTC)

Re: dynamic pretty-printing Sergei Egorov 22 Sep 2026 04:42 UTC

What a wonderful idea, html-style dynamic reflowing of S-expressions with
information provided by the printer, but not rendered directly, so the
terminal itself can finish the job!

 > It would be nice if SRFI-272 could make use of these facilities.

Strictly speaking, nothing in SRFI-272 needs to be changed for that:
it does not specify where line breaks should happen, and it has all
the parameters needed to collect and pass information to the port
doing the rendering. A Kawa implementation can check if the output port
is connected to DomTerm, and the width parameter is set to, say, 'dynamic,
it could send the escapes through the pp-tint handler via (kawa pprint)'s
pprint-start-logical-block and friends while normal output goes through
the pp-emit handler as write-like single-line output. I believe it is
possible to tailor the 'advanced' printer to do all these things.

On Monday, September 21, 2026 5:26:16 PM (-04:00), Per Bothner wrote:

 > Kawa has an unique (?) feature in that it can defer line-breaking and
 > indentation to a suitable terminal (specifically DomTerm). If the
 > terminal changes line width, the output is re-formatted - even for
output
 > from previous commands - even if the kawa command has finished running.
 >
 > You can see it in action here:
https://domterm.org/saved/dt-prettynested.html
 > Try changing the window width. You can also click triangles to show/hide
sections.
 > This is a transcript of a terminal session, but with embedded control
 > sequences to mark blocks, soft line-breaks (multiple kinds, as in Common
Lisp),
 > and indentation. Some Javascript code does the actual line-breaking.
 > This line-breaking is normally in the context of an actual "live"
terminal session,
 > but can also be done (as in the demo) in a "saved" session
("transcript").
 >
 > Here is an old blog article:
https://per.bothner.com/blog/2017/dynamic-prettyprinting/
 >
 > It would be nice if SRFI-272 could make use of these facilities.