commit 57308d82417e4433b693dad4d289473f00a5b2c3
parent da5b77c600258357da709482ee40ceeb3932d9f5
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Mon, 8 Aug 2011 17:07:43 -0600
scribble/manual: add `current-display-width' parameter
original commit: f34c0329bfb614f5ad8545eafb93b5abbbc5e197
Diffstat:
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/collects/scribble/manual.rkt b/collects/scribble/manual.rkt
@@ -11,11 +11,13 @@
"private/manual-class.rkt"
"private/manual-unit.rkt"
"private/manual-vars.rkt"
- "private/manual-bind.rkt")
+ "private/manual-bind.rkt"
+ "private/manual-utils.rkt")
(provide unsyntax
make-binding-redirect-elements
defidentifier
+ current-display-width
(all-from-out "base.rkt"
"private/manual-style.rkt"
"private/manual-scheme.rkt"
diff --git a/collects/scribble/private/manual-proc.rkt b/collects/scribble/private/manual-proc.rkt
@@ -140,6 +140,7 @@
(define (*defproc mode within-id
stx-ids prototypes arg-contractss arg-valss result-contracts
content-thunk)
+ (define max-proto-width (current-display-width))
(define ((arg->elem show-opt-start?) arg)
(let* ([e (cond [(not (arg-special? arg))
(if (arg-kw arg)
@@ -561,6 +562,7 @@
(define (*defstruct stx-id name alt-cname-id extra-cname?
fields field-contracts immutable? transparent? prefab?
content-thunk)
+ (define max-proto-width (current-display-width))
(define (field-name f) ((if (pair? (car f)) caar car) f))
(define (field-view f)
(if (pair? (car f)) (make-shaped-parens (car f) #\[) (car f)))
diff --git a/collects/scribble/private/manual-utils.rkt b/collects/scribble/private/manual-utils.rkt
@@ -14,7 +14,7 @@
[flow-spacer flow?]
[flow-empty-line flow?]
[make-table-if-necessary (content? list? . -> . (list/c (or/c omitable-paragraph? table?)))]
- [max-proto-width exact-nonnegative-integer?])
+ [current-display-width (parameter/c exact-nonnegative-integer?)])
(define spacer (hspace 1))
@@ -31,4 +31,4 @@
(list (make-table style content))))
(list (make-table style content))))
-(define max-proto-width 65)
+(define current-display-width (make-parameter 65))
diff --git a/collects/scribblings/scribble/manual.scrbl b/collects/scribblings/scribble/manual.scrbl
@@ -620,7 +620,9 @@ description, references to @svar[arg-id]s using @racket[racket],
The typesetting of all information before the @racket[pre-flow]s
ignores the source layout, except that the local formatting is
-preserved for contracts and default-values expressions.}
+preserved for contracts and default-values expressions. The information
+is formatted to fit (if possible) in the number of characters specified
+by the @racket[current-display-width] parameter.}
@defform[(defproc* ([prototype
@@ -881,6 +883,11 @@ the mouse hovers over the identifier).}
Compatibility aliases for @racket[racketgrammar] and @racket[racketgrammar*].}
+@defparam[current-display-width w exact-nonnegative-integer?]{
+
+Specifies the target maximum width in characters for the output of
+@racket[defproc] and @racket[defstruct].}
+
@; ------------------------------------------------------------------------
@section[#:tag "doc-classes"]{Documenting Classes and Interfaces}