From 4efab4f12f5cf4702964ac1897fdcc1c7ea846a9 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sat, 27 Sep 2008 02:12:02 +0000 Subject: [PATCH] removed some unnecessary old autoloading, reformat some stuff svn: r11886 --- collects/scheme/private/help-autoload.ss | 69 ++++++++++-------------- 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/collects/scheme/private/help-autoload.ss b/collects/scheme/private/help-autoload.ss index a1b7e818be..0fb6813ab4 100644 --- a/collects/scheme/private/help-autoload.ss +++ b/collects/scheme/private/help-autoload.ss @@ -3,6 +3,7 @@ (require setup/xref scribble/xref scribble/manual-struct + help/search net/uri-codec net/sendurl scheme/path @@ -13,16 +14,13 @@ (define-namespace-anchor anchor) (define (find-help/lib sym lib) - (let ([id (parameterize ([current-namespace (namespace-anchor->empty-namespace - anchor)]) + (let ([id (parameterize ([current-namespace + (namespace-anchor->empty-namespace anchor)]) (namespace-require `(for-label ,lib)) (namespace-syntax-introduce (datum->syntax #f sym)))]) (if (identifier-label-binding id) - (find-help id) - (error 'help - "no binding for identifier: ~a from module: ~a" - sym - lib)))) + (find-help id) + (error 'help "no binding for identifier: ~a from module: ~a" sym lib)))) (define (find-help id) (let* ([lb (identifier-label-binding id)] @@ -31,35 +29,32 @@ (lambda () (printf "Loading help index...\n")))]) (if (or lb b) - (let ([tag (xref-binding->definition-tag - xref - (or lb b) - (if lb #f 0))]) - (if tag - (go-to-tag xref tag) - (error 'help - "no documentation found for: ~e provided by: ~a" - (syntax-e id) - (module-path-index-resolve (caddr (or lb b)))))) - (search-for-exports xref (syntax-e id))))) + (let ([tag (xref-binding->definition-tag xref (or lb b) (if lb #f 0))]) + (if tag + (go-to-tag xref tag) + (error 'help + "no documentation found for: ~e provided by: ~a" + (syntax-e id) + (module-path-index-resolve (caddr (or lb b)))))) + (search-for-exports xref (syntax-e id))))) (define (search-for-exports xref sym) (let ([idx (xref-index xref)] [libs null]) - (for-each (lambda (entry) - (when (exported-index-desc? (entry-desc entry)) - (when (eq? sym (exported-index-desc-name (entry-desc entry))) - (set! libs (append libs (exported-index-desc-from-libs (entry-desc entry))))))) - idx) + (for ([entry (in-list idx)]) + (when (and (exported-index-desc? (entry-desc entry)) + (eq? sym (exported-index-desc-name (entry-desc entry)))) + (set! libs (append libs (exported-index-desc-from-libs + (entry-desc entry)))))) (if (null? libs) - (printf "Not found in any library's documentation: ~a\n" sym) - (begin - (printf "No documentation for current binding, but provided by:\n") - (let loop ([libs libs]) - (unless (null? libs) - (unless (member (car libs) (cdr libs)) - (printf " ~a\n" (car libs))) - (loop (cdr libs)))))))) + (printf "Not found in any library's documentation: ~a\n" sym) + (begin + (printf "No documentation for current binding, but provided by:\n") + (let loop ([libs libs]) + (unless (null? libs) + (unless (member (car libs) (cdr libs)) + (printf " ~a\n" (car libs))) + (loop (cdr libs)))))))) (define (go-to-tag xref t) (let-values ([(file anchor) (xref-tag->path+anchor xref t)]) @@ -68,15 +63,5 @@ (unless (send-url/file file #:fragment (and anchor (uri-encode anchor))) (error 'help "browser launch failed")))) -(define generate-search-results #f) - (define (search-for strs) - (printf "Generating and opening search page...\n") - (unless generate-search-results - (parameterize ([current-namespace (namespace-anchor->empty-namespace - anchor)]) - (set! generate-search-results - (dynamic-require 'help/search 'perform-search)))) - (generate-search-results (apply string-append - (add-between strs " ")))) - + (perform-search (apply string-append (add-between strs " "))))