From f2b25bc20f7a7a7eca7913c7b125a0fbfa65c7e1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 25 Feb 2009 16:05:10 +0000 Subject: [PATCH] fix scribble/lp chunk linking svn: r13835 original commit: f799ade23831875dc16b40eec6040470b6209739 --- collects/scribble/private/lp.ss | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/collects/scribble/private/lp.ss b/collects/scribble/private/lp.ss index 229afa89..092d59aa 100644 --- a/collects/scribble/private/lp.ss +++ b/collects/scribble/private/lp.ss @@ -7,18 +7,21 @@ ;; maps chunk identifiers to a counter, so we can distinguish multiple uses ;; of the same name (define chunk-numbers (make-free-identifier-mapping)) - (define (get-chunk-number id) + (define (get-chunk-number id install?) (let ([n (add1 (free-identifier-mapping-get chunk-numbers id (lambda () 0)))]) - (free-identifier-mapping-put! chunk-numbers id n) - n))) + (when install? + (free-identifier-mapping-put! chunk-numbers id n)) + n)) + (define (register-chunk-name name) + (get-chunk-number name #t))) (define-syntax (chunk stx) (syntax-case stx () [(_ name expr ...) ;; no need for more error checking, using chunk for the code will do that (identifier? #'name) - (let ([n (get-chunk-number #'name)] + (let ([n (get-chunk-number (syntax-local-introduce #'name) #f)] [str (symbol->string (syntax-e #'name))]) (syntax-local-lift-expression #'(quote-syntax (a-chunk name expr ...))) @@ -43,9 +46,9 @@ #`(begin (require (for-label for-label-mod ... ...)) ;; why does this happen twice? - #; (define-syntax name (make-element-id-transformer (lambda (stx) #'(chunkref name)))) + (begin-for-syntax (register-chunk-name #'name)) (make-splice (list (make-toc-element #f