diff --git a/collects/mzlib/pretty.ss b/collects/mzlib/pretty.ss index 8c750b51d3..ee8f8dbcd7 100644 --- a/collects/mzlib/pretty.ss +++ b/collects/mzlib/pretty.ss @@ -1186,7 +1186,7 @@ (define (read-macro? l pair? car cdr) (define (length1? l) (and (pair? l) (null? (cdr l)))) (and (pretty-print-abbreviate-read-macros) - (let ((head (car l)) (tail (cdr l))) + (let ((head (do-remap (car l))) (tail (cdr l))) (case head ((quote quasiquote unquote unquote-splicing syntax unsyntax unsyntax-splicing) (length1? tail)) @@ -1196,7 +1196,7 @@ (car (cdr l))) (define (read-macro-prefix l car) - (let ((head (car l))) + (let ((head (do-remap (car l)))) (case head ((quote) "'") ((quasiquote) "`") diff --git a/collects/redex/private/sexp-diffs.ss b/collects/redex/private/sexp-diffs.ss index 952aa7163b..c663e31fb5 100644 --- a/collects/redex/private/sexp-diffs.ss +++ b/collects/redex/private/sexp-diffs.ss @@ -56,6 +56,7 @@ (list->vector (map loop (vector->list s)))] [(box? s) (box (loop (unbox s)))] + [(syntax? s) (datum->syntax s (unkink (loop (syntax-e s))) s)] [(number? s) (make-wrap s)] [(symbol? s) (make-wrap s)] [else s]))) @@ -89,8 +90,7 @@ ;; render-sexp/colors : sexp ht text -> void (define (render-sexp/colors sexp to-color text columns) (let ([start '()]) - (parameterize ([pretty-print-columns columns] - [pretty-print-abbreviate-read-macros #f]) + (parameterize ([pretty-print-columns columns]) (pretty-print sexp (open-output-text-editor text))) (for-each (λ (p) (send text highlight-range (car p) (cdr p) (send the-color-database find-color "NavajoWhite"))) @@ -122,7 +122,6 @@ 1])) void)]) (parameterize ([pretty-print-columns columns] - [pretty-print-abbreviate-read-macros #f] [pretty-print-remap-stylable (λ (val) (and (wrap? val) diff --git a/collects/scribblings/reference/pretty-print.scrbl b/collects/scribblings/reference/pretty-print.scrbl index 2c8ed79e1c..f91e494657 100644 --- a/collects/scribblings/reference/pretty-print.scrbl +++ b/collects/scribblings/reference/pretty-print.scrbl @@ -117,7 +117,10 @@ printed with a leading @litchar{#i}. The initial value is @scheme[#f].} A parameter that controls whether or not @schemeidfont{quote}, @schemeidfont{unquote}, @schemeidfont{unquote-splicing}, @|etc| are abbreviated with @litchar{'}, @litchar{,}, @litchar[",@"], etc. -By default, the abbreviations are enabled.} +By default, the abbreviations are enabled. + +See also @scheme[pretty-print-remap-stylable]. +} @defproc[(pretty-print-style-table? [v any/c]) boolean?]{ @@ -179,11 +182,17 @@ so that the output follows popular code-formatting rules: proc (any/c . -> . (or/c symbol? #f))]{ -A parameter that controls remapping for styles. This procedure is +A parameter that controls remapping for styles and for the determination of +the reader shorthands. + +This procedure is called with each subexpression that appears as the first element in a sequence. If it returns a symbol, the style table is used, as if that symbol were at the head of the sequence. If it returns @scheme[#f], -the style table is treated normally.} +the style table is treated normally. +Similarly, when determining whether or not to abbreviate reader macros, +the parameter is consulted. +} @; ----------------------------------------------------------------------