Skip to content

Commit 2e679f4

Browse files
committed
repeair search warnings when a lcoal definition shadows external
When using `scribble +m` to render an installed document separately, the entries loaded by `+m` get replaced by the new rendering. The precence of the `+m` entries, however, could make Scribble think that searched-for bindings were not found, because they're seen both as external and as internal.
1 parent 04f4fcd commit 2e679f4

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

scribble-lib/scribble/base-render.rkt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,18 +403,22 @@
403403
(hash-map ht (lambda (k v) k))))
404404

405405
(define/public (get-external ri)
406-
(hash-map (resolve-info-undef ri) (lambda (k v) k)))
406+
(for/list ([(k v) (in-hash (resolve-info-undef ri))]
407+
#:unless (eq? v 'local))
408+
k))
407409

408410
(define/public (get-undefined ri)
409411
(for/list ([(k v) (in-hash (resolve-info-undef ri))]
410412
#:unless (or (eq? v 'found)
413+
(eq? v 'local)
411414
(and v
412415
;; v is a search key; see if any key in the set was resolved:
413416
(or
414417
(not (car v)) ; search key where failure was an option
415418
(let ([ht (hash-ref (resolve-info-searches ri) v)])
416419
(for/or ([k2 (in-hash-keys ht)])
417-
(eq? 'found (hash-ref (resolve-info-undef ri) k2 #f))))))))
420+
(memq (hash-ref (resolve-info-undef ri) k2 #f)
421+
'(found local))))))))
418422
k))
419423

420424
(define/public (transfer-info ci src-ci)

scribble-lib/scribble/core.rkt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,17 @@
5252

5353
(define (resolve-get/ext-id* part ri key search-key)
5454
(define-values (v ext-id) (resolve-get/where part ri key))
55-
(when ext-id
56-
(hash-set! (resolve-info-undef ri) (tag-key key ri) (if v 'found search-key)))
55+
(when (or ext-id
56+
;; if `v`, make sure it's counted as found; this can happen if external saved
57+
;; information has the key originally, but then it's defined locally, such
58+
;; as when rendering an installed document with `scribble +m ...`
59+
(and search-key
60+
v))
61+
(hash-set! (resolve-info-undef ri) (tag-key key ri) (if v
62+
(if ext-id
63+
'found
64+
'local)
65+
search-key)))
5766
(values v ext-id))
5867

5968
(define (resolve-get part ri key)

0 commit comments

Comments
 (0)