From b69db24297714573422b0d7debe6ca2bb3160600 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 18 Sep 2009 05:56:41 +0000 Subject: [PATCH] add with-writer-change (all of this is still uncertain and undocumented) svn: r16061 original commit: 182f89d5806f7c1f648a3a85ff2b589b93cb2212 --- collects/scribble/text/output.ss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/collects/scribble/text/output.ss b/collects/scribble/text/output.ss index adddb6b5..5616eb3b 100644 --- a/collects/scribble/text/output.ss +++ b/collects/scribble/text/output.ss @@ -153,6 +153,13 @@ (set! write (or (car c) write-string)) (for-each loop (cdr c)) (set! write old))] + [(with-writer-change) + ;; the function gets the old writer and return a new one + ;; (useful to sabe the current writer then restore it inside) + (let ([old write]) + (set! write ((car c) write)) + (for-each loop (cdr c)) + (set! write old))] [else (error 'output "unknown special value flag: ~e" (special-flag x))]))] [else @@ -202,6 +209,7 @@ (define/provide-special (add-prefix pfx)) (define/provide-special (set-prefix pfx)) (define/provide-special (with-writer writer)) +(define/provide-special (with-writer-change writer)) (define make-spaces ; (efficiently) (let ([t (make-hasheq)] [v (make-vector 80 #f)])