From: John Cowan <xxxxxx@ccil.org>
Date: Wednesday, August 14, 2019 4:48 PM

On Wed, Aug 14, 2019 at 12:53 PM <xxxxxx@ancell-ent.com> wrote:

Providing that behavior is part of the with-raw-mode etc. spec, so
only a crash, (emergency-exit) or the like will potentially leave your
terminal in a messed up state.

Exactly.  The thunk passed to with-raw-mode is wrapped in a dynamic-wind that enables raw mode in the before-thunk and disables it in the after-thunk.

The SRFI says:

The following procedures use dynamic-wind magic when executing their thunk arguments; if the thunk's dynamic extent is escaped, the action of the procedure is undone, but if the thunk's dynamic extent is re-entered, the action of the procedure is re-enabled.

Although is there anything "magic" about this, vs. it being standard usage and behavior of dynamic-wind?

- Harold