From 073ca0d55863b7400efa73c33c1ce1ab544311e4 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 28 Jan 2008 09:17:05 +0000 Subject: [PATCH] fix some typos, remove unused 'plt option, move test so there's no internal definition svn: r8442 --- collects/net/scribblings/sendurl.scrbl | 2 +- collects/net/sendurl.ss | 30 ++++++++++++-------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/collects/net/scribblings/sendurl.scrbl b/collects/net/scribblings/sendurl.scrbl index b1ed47e493..c791d0a53d 100644 --- a/collects/net/scribblings/sendurl.scrbl +++ b/collects/net/scribblings/sendurl.scrbl @@ -43,7 +43,7 @@ The parameter is initialized to the value of the The parameter value can be any of the symbols in @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 @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 diff --git a/collects/net/sendurl.ss b/collects/net/sendurl.ss index 0aba9a8d8e..6232dd674c 100644 --- a/collects/net/sendurl.ss +++ b/collects/net/sendurl.ss @@ -22,7 +22,7 @@ ;; : any -> bool (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))) (define external-browser @@ -34,7 +34,7 @@ (error 'external-browser "~e is not a valid browser preference" x))))) ;; 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 (delay (let ([t (system-type)]) (cond [(not (eq? t 'unix)) t] @@ -45,9 +45,6 @@ ;; send-url : str [bool] -> void (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 stype (force systype)) (define preferred '|? ? ?|) @@ -56,6 +53,8 @@ (set! preferred (or external (get-preference 'external-browser)))) (and (or (not preferred) (eq? preferred browser-name)) (find-executable-path (symbol->string browser-name) #f))) + (unless (string? url-str) + (error 'send-url "expected a string, got ~e" url-str)) (cond [(procedure? external) (external url-str)] [(eq? stype 'macosx) @@ -122,17 +121,16 @@ ;; run-browser : process-proc list-of-strings -> void (define (run-browser process*/ports args) - (let-values ([(stdout stdin pid stderr control) - (apply values - (apply process*/ports - (open-output-nowhere) #f (current-error-port) - args))]) - (close-output-port stdin) - (thread (lambda () - (control 'wait) - (when (eq? 'done-error (control 'status)) - (error 'run-browser "process execute failed: ~e" args)))) - (void))) + (define-values (stdout stdin pid stderr control) + (apply values (apply process*/ports + (open-output-nowhere) #f (current-error-port) + args))) + (close-output-port stdin) + (thread (lambda () + (control 'wait) + (when (eq? 'done-error (control 'status)) + (error 'run-browser "process execute failed: ~e" args)))) + (void)) (define (browser-process* . args) (run-browser process*/ports args))