searching in help desk now says 'no results' if there are no results, and the help desk menu item in drscheme opens the front page of the manuals
svn: r8227
This commit is contained in:
parent
4b24262f96
commit
379f2a162b
|
@ -78,11 +78,5 @@
|
|||
|
||||
(define help-desk
|
||||
(case-lambda
|
||||
[() (void)]
|
||||
[(key) (help-desk key #f)]
|
||||
[(key lucky?) (help-desk key lucky? 'keyword+index)]
|
||||
[(key lucky? type) (help-desk key lucky? type 'contains)]
|
||||
[(key lucky? type mode) (help-desk key lucky? type mode #f)]
|
||||
[(key lucky? type mode language)
|
||||
(generate-search-results (list key))
|
||||
(void)]))
|
||||
[() (send-main-page)]
|
||||
[(key) (generate-search-results (list key))]))
|
||||
|
|
|
@ -302,7 +302,7 @@ TODO
|
|||
(and (is-a? tlw drscheme:unit:frame<%>)
|
||||
(send (send tlw get-definitions-text)
|
||||
get-next-settings)))))])
|
||||
(drscheme:help-desk:help-desk str #f 'keyword+index 'contains language))))]
|
||||
(drscheme:help-desk:help-desk str))))]
|
||||
[else
|
||||
(drscheme:help-desk:help-desk)])))
|
||||
(let ([with-drs-frame
|
||||
|
|
|
@ -1306,53 +1306,6 @@
|
|||
"Constructs a vector whose elements are the fields of \\var{simple-settings}.")
|
||||
|
||||
|
||||
;
|
||||
;
|
||||
;
|
||||
; ; ; ; ;
|
||||
; ; ; ; ;
|
||||
; ; ; ; ;
|
||||
; ; ;; ;;; ; ; ;; ;; ; ;;; ;;; ; ;
|
||||
; ;; ; ; ; ; ;; ; ; ;; ; ; ; ; ;
|
||||
; ; ; ; ; ; ; ; ; ; ; ; ;; ; ;
|
||||
; ; ; ;;;;;; ; ; ; ;;;;;; ; ; ;;;;;; ;; ;;;
|
||||
; ; ; ; ; ; ; ; ; ; ; ; ;
|
||||
; ; ; ; ; ;; ; ; ;; ; ; ; ;
|
||||
; ; ; ;;;; ; ; ;; ;; ; ;;;; ;;; ; ;
|
||||
; ;
|
||||
; ;
|
||||
; ;
|
||||
|
||||
(drscheme:help-desk:help-desk
|
||||
(case->
|
||||
(-> void?)
|
||||
(string? boolean? (symbols 'keyword 'keyword+index 'all) (symbols 'exact 'contains 'regexp)
|
||||
. -> .
|
||||
void?)
|
||||
(string? boolean? (symbols 'keyword 'keyword+index 'all) . -> . void?)
|
||||
(string? boolean? . -> . void?))
|
||||
(()
|
||||
(key lucky? type mode)
|
||||
(key lucky? type)
|
||||
(key lucky?))
|
||||
|
||||
"This function opens a help desk window, or brings an already open help"
|
||||
"desk window to the front. If an argument is specified, that key is"
|
||||
"searched for."
|
||||
""
|
||||
"If no arguments are supplied, this function"
|
||||
"opens a help-desk window to the starting page, or just brings a"
|
||||
"help-desk window to the front (without changing what page it is"
|
||||
"viewing)."
|
||||
""
|
||||
"If any arguments are supplied, this function"
|
||||
"opens a help-desk window and searches for \\var{key}, according to "
|
||||
"\\var{lucky?}, \\var{type}, and \\var{mode}."
|
||||
"If the second, third, fourth, and/or fifth arguments are omitted, "
|
||||
"they default to \\scmc{\\#t} \\Symbol{keyword+index} and \\Symbol{exact},"
|
||||
"and \\Symbol{all} respectively.")
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
|
|
@ -140,14 +140,7 @@ module browser threading seems wrong.
|
|||
str
|
||||
(- 200 (string-length (string-constant search-help-desk-for)))))
|
||||
menu
|
||||
(λ x (help-desk:help-desk str #f 'keyword+index 'contains language)))
|
||||
(make-object menu-item%
|
||||
(gui-utils:format-literal-label (string-constant exact-lucky-search-help-desk-for)
|
||||
(shorten-str
|
||||
str
|
||||
(- 200 (string-length (string-constant exact-lucky-search-help-desk-for)))))
|
||||
menu
|
||||
(λ x (help-desk:help-desk str #t 'keyword+index 'exact language)))
|
||||
(λ x (help-desk:help-desk str)))
|
||||
(void)))))))))
|
||||
|
||||
;; find-symbol : number -> string
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#lang scheme/base
|
||||
|
||||
(require "search.ss"
|
||||
net/sendurl
|
||||
setup/dirs
|
||||
scheme/cmdline)
|
||||
|
||||
(define exact-search? #f)
|
||||
|
@ -18,7 +16,6 @@
|
|||
(error 'plt-help "expected a single search term, got ~s" search-term))
|
||||
(send-exact-results (car search-term))]
|
||||
[(null? search-term)
|
||||
(let ([dest-path (build-path (find-doc-dir) "start" "index.html")])
|
||||
(send-url (format "file://~a" (path->string dest-path))))]
|
||||
(send-main-page)]
|
||||
[else
|
||||
(generate-search-results search-term)]))
|
||||
|
|
|
@ -10,11 +10,17 @@
|
|||
(prefix-in scheme: scribble/scheme)
|
||||
net/sendurl
|
||||
net/uri-codec
|
||||
mzlib/contract)
|
||||
mzlib/contract
|
||||
setup/dirs)
|
||||
|
||||
(provide/contract
|
||||
[generate-search-results (-> (listof string?) void?)]
|
||||
[send-exact-results (-> string? void?)])
|
||||
[send-exact-results (-> string? void?)]
|
||||
[send-main-page (-> void?)])
|
||||
|
||||
(define (send-main-page)
|
||||
(let ([dest-path (build-path (find-doc-dir) "start" "index.html")])
|
||||
(send-url (format "file://~a" (path->string dest-path)))))
|
||||
|
||||
;; if there is exactly one exact match for this search key, go directly
|
||||
;; to that place. Otherwise, go to a page that lists all of the matches.
|
||||
|
@ -58,9 +64,14 @@
|
|||
[matching-entries (filter (has-match search-regexps) index)]
|
||||
[exact-matches (filter (has-match exact-search-regexps) matching-entries)]
|
||||
[inexact-matches (filter (compose not (has-match exact-search-regexps)) matching-entries)])
|
||||
(cond
|
||||
[(and (null? exact-matches)
|
||||
(null? inexact-matches))
|
||||
(list (make-element "schemeerror" (list "No results found.")))]
|
||||
[else
|
||||
(append
|
||||
(build-itemization "Exact matches" exact-matches)
|
||||
(build-itemization "Containing matches" inexact-matches)))))
|
||||
(build-itemization "Containing matches" inexact-matches))]))))
|
||||
file)
|
||||
(send-url (format "file://~a" (path->string file)))
|
||||
(void))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user