fix some typos, remove unused 'plt option, move test so there's no internal definition
svn: r8442
This commit is contained in:
parent
21ffab3fe3
commit
073ca0d558
|
@ -43,7 +43,7 @@ The parameter is initialized to the value of the
|
||||||
|
|
||||||
The parameter value can be any of the symbols in
|
The parameter value can be any of the symbols in
|
||||||
@scheme[unix-browser-list], @scheme[#f] to indicate that the
|
@scheme[unix-browser-list], @scheme[#f] to indicate that the
|
||||||
preference is under, or a pair of strings. If the preference is
|
preference is unset, or a pair of strings. If the preference is
|
||||||
unset, @scheme[send-url] uses the first of the browsers from
|
unset, @scheme[send-url] uses the first of the browsers from
|
||||||
@scheme[unix-browser-list] for which the executable is found. If the
|
@scheme[unix-browser-list] for which the executable is found. If the
|
||||||
parameter is a pair of strings, then a command line is constructed by
|
parameter is a pair of strings, then a command line is constructed by
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
;; : any -> bool
|
;; : any -> bool
|
||||||
(define (browser-preference? x)
|
(define (browser-preference? x)
|
||||||
(or (not x) (eq? 'plt x) (memq x unix-browser-list) (custom-browser? x)
|
(or (not x) (memq x unix-browser-list) (custom-browser? x)
|
||||||
(procedure? x)))
|
(procedure? x)))
|
||||||
|
|
||||||
(define external-browser
|
(define external-browser
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
(error 'external-browser "~e is not a valid browser preference" x)))))
|
(error 'external-browser "~e is not a valid browser preference" x)))))
|
||||||
|
|
||||||
;; like (system-type), but return the real OS for OSX with XonX
|
;; like (system-type), but return the real OS for OSX with XonX
|
||||||
;; (could do the same for Cygwin, but that it doesn't have shell-execute)
|
;; (could do the same for Cygwin, but it doesn't have shell-execute)
|
||||||
(define systype
|
(define systype
|
||||||
(delay (let ([t (system-type)])
|
(delay (let ([t (system-type)])
|
||||||
(cond [(not (eq? t 'unix)) t]
|
(cond [(not (eq? t 'unix)) t]
|
||||||
|
@ -45,9 +45,6 @@
|
||||||
|
|
||||||
;; send-url : str [bool] -> void
|
;; send-url : str [bool] -> void
|
||||||
(define (send-url url-str [separate-window? separate-by-default?])
|
(define (send-url url-str [separate-window? separate-by-default?])
|
||||||
(define stupid-internal-define-syntax1
|
|
||||||
(unless (string? url-str)
|
|
||||||
(error 'send-url "expected a string, got ~e" url-str)))
|
|
||||||
(define external (external-browser))
|
(define external (external-browser))
|
||||||
(define stype (force systype))
|
(define stype (force systype))
|
||||||
(define preferred '|? ? ?|)
|
(define preferred '|? ? ?|)
|
||||||
|
@ -56,6 +53,8 @@
|
||||||
(set! preferred (or external (get-preference 'external-browser))))
|
(set! preferred (or external (get-preference 'external-browser))))
|
||||||
(and (or (not preferred) (eq? preferred browser-name))
|
(and (or (not preferred) (eq? preferred browser-name))
|
||||||
(find-executable-path (symbol->string browser-name) #f)))
|
(find-executable-path (symbol->string browser-name) #f)))
|
||||||
|
(unless (string? url-str)
|
||||||
|
(error 'send-url "expected a string, got ~e" url-str))
|
||||||
(cond
|
(cond
|
||||||
[(procedure? external) (external url-str)]
|
[(procedure? external) (external url-str)]
|
||||||
[(eq? stype 'macosx)
|
[(eq? stype 'macosx)
|
||||||
|
@ -122,17 +121,16 @@
|
||||||
|
|
||||||
;; run-browser : process-proc list-of-strings -> void
|
;; run-browser : process-proc list-of-strings -> void
|
||||||
(define (run-browser process*/ports args)
|
(define (run-browser process*/ports args)
|
||||||
(let-values ([(stdout stdin pid stderr control)
|
(define-values (stdout stdin pid stderr control)
|
||||||
(apply values
|
(apply values (apply process*/ports
|
||||||
(apply process*/ports
|
|
||||||
(open-output-nowhere) #f (current-error-port)
|
(open-output-nowhere) #f (current-error-port)
|
||||||
args))])
|
args)))
|
||||||
(close-output-port stdin)
|
(close-output-port stdin)
|
||||||
(thread (lambda ()
|
(thread (lambda ()
|
||||||
(control 'wait)
|
(control 'wait)
|
||||||
(when (eq? 'done-error (control 'status))
|
(when (eq? 'done-error (control 'status))
|
||||||
(error 'run-browser "process execute failed: ~e" args))))
|
(error 'run-browser "process execute failed: ~e" args))))
|
||||||
(void)))
|
(void))
|
||||||
|
|
||||||
(define (browser-process* . args)
|
(define (browser-process* . args)
|
||||||
(run-browser process*/ports args))
|
(run-browser process*/ports args))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user