* Move the help functionality into the search collection, so it is not
packaged with the mzscheme distribution * Make scheme/help throw a helpful message if the file is missing svn: r11896
This commit is contained in:
parent
6342131e6d
commit
d892cb243e
|
@ -1,15 +1,23 @@
|
|||
#lang scheme/base
|
||||
|
||||
;; This file provides the utilities that mzscheme's `help' form uses.
|
||||
;; It is required dynamically when used from mzscheme, to avoid the
|
||||
;; loading overhead, and to have mzscheme independent of having the
|
||||
;; documentation system.
|
||||
|
||||
(require setup/xref
|
||||
scribble/xref
|
||||
scribble/manual-struct
|
||||
help/search
|
||||
net/uri-codec
|
||||
net/sendurl
|
||||
scheme/path
|
||||
scheme/list)
|
||||
scheme/list
|
||||
"search.ss")
|
||||
|
||||
(provide find-help find-help/lib search-for)
|
||||
(provide search-for find-help find-help/lib)
|
||||
|
||||
(define (search-for strs)
|
||||
(perform-search (apply string-append (add-between strs " "))))
|
||||
|
||||
(define-namespace-anchor anchor)
|
||||
|
||||
|
@ -62,6 +70,3 @@
|
|||
(when anchor (printf " anchor: ~a\n" anchor))
|
||||
(unless (send-url/file file #:fragment (and anchor (uri-encode anchor)))
|
||||
(error 'help "browser launch failed"))))
|
||||
|
||||
(define (search-for strs)
|
||||
(perform-search (apply string-append (add-between strs " "))))
|
|
@ -39,10 +39,30 @@
|
|||
(define (open-help-start)
|
||||
(find-help #'help))
|
||||
|
||||
;; Autoload utilities from help/help-utils; if it does not exists,
|
||||
;; suggest using docs.plt-scheme.org.
|
||||
|
||||
(define-namespace-anchor anchor)
|
||||
(define get-binding
|
||||
(let ([ns #f] [utils #f])
|
||||
(lambda (sym)
|
||||
(unless ns
|
||||
(set! ns (namespace-anchor->empty-namespace anchor))
|
||||
(set! utils (resolved-module-path-name
|
||||
(module-path-index-resolve
|
||||
(module-path-index-join 'help/help-utils #f)))))
|
||||
(parameterize ([current-namespace ns])
|
||||
(if (file-exists? utils)
|
||||
(dynamic-require utils sym)
|
||||
(lambda _
|
||||
(error 'help "documentation system unavailable; ~a\n~a"
|
||||
"try http://docs.plt-scheme.org/"
|
||||
(format " (missing file: ~a)" utils))))))))
|
||||
|
||||
(define-syntax-rule (define-help-autoload id)
|
||||
(begin
|
||||
(define auto (delay (dynamic-require 'scheme/private/help-autoload 'id)))
|
||||
(define (id . args) (apply (force auto) args))))
|
||||
(define id
|
||||
(let ([proc (delay (get-binding 'id))])
|
||||
(lambda args (apply (force proc) args)))))
|
||||
|
||||
(define-help-autoload find-help)
|
||||
(define-help-autoload find-help/lib)
|
||||
|
|
Loading…
Reference in New Issue
Block a user