Subject: [clisp-list] clhs -> browse-url

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Fri Apr 12 01:56:12 2002

Arseny Slobodjuck said:
> That's open an IE (but page doesn't open anyway - another bug...)

I suggested:
>The easy yet satisfactory solution may be to add a final "&"
>:arguments for every UNIX line, when the programs don't detach

Could people please test the following:

A. browse-url

;; cannot have portable :wait nil argument to run-program
(defun browse-url (url &key (browser *browser*) (out *standard-output*))
  "Run the browser (a keyword in `*browsers*' or a list) on the URL."
  (let* ((command
          (etypecase browser
            (list browser)
            (symbol (or (cdr (assoc browser *browsers* :test #'eq))
                        (error "unknown browser: `~s' (must be a key in `~s')"
                               browser '*browsers*)))))
         (args (mapcar (lambda (arg) (format nil arg url)) (cdr command))))
    (cond (command
           (when out
             (format out "~&;; running [~s~{ ~s~}]..." (car command) args)
             (force-output (if (eq out t) *standard-output* out)))
           (run-program (car command) :arguments args) ; :wait nil
           (when out
             (format out "done~%")))
          ((format t "~s: no browser specified; please point your browser at
 --> <URL:~a>~%" 'browse-url url)))))
;(browse-url "http://clisp.cons.org/impnotes/")

B. *browsers* on UNIX: extra "&"

(defvar *browsers*              ; alist of browsers & commands
  '(#+UNIX(:netscape "netscape" "-remote" "openURL(~a,new-window)" "&")
    #+UNIX(:konqueror "kfmclient" "openURL" "~a" "&")
    (:lynx "xterm" "-e" "lynx" "~a" #+UNIX "&")
    (:w3m "xterm" "-e" "w3m" "~a" #+UNIX "&")
    (:mmm "mmm" "-external" "~a" #+UNIX "&")
    #+UNIX(:mosaic "xmosaic" "~a" "&")
    (:emacs-w3 "gnudoit" "-q" "(w3-fetch \"~a\")")))

Thanks,
	Jorg Hohle.