Subject: [clisp-list] ext:clhs & (apropos "browse") and customization bug & call for co de snippet (win32 registry->browser)

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

Stefan X wrote:
> But Wow. It is frustrating, to know that there is a command, 
> but to not know, where to find documents.

The first place to look for is the CLISP implementation notes. It says:

"ext:clhs. [Common Lisp HyperSpec] access is provided via (ext:clhs symbol &KEY :browser)
function, which uses your web browser. browser should be a valid keyword in the
custom:*browsers* alist."

> [32]> (clhs 'browser)
> *** - No HyperSpec doc for `BROWSER'

You should know that CLHS is the Common Lisp (ANSI standard) Hyperspec. As such, you'll find nothing there about CLISP specific extensions.

Follows a bug report:

impnotes mentions custom:*browsers* (see above text), however
REGEXP[79]> custom:*browsers*
*** - READ from 
#<INPUT CONCATENATED-STREAM #<INPUT STRING-INPUT-STREAM>
  #<IO SYNONYM-STREAM *TERMINAL-IO*>>: #<PACKAGE CUSTOM> has no external symbol with name "*BROWSERS*"
1. Break REGEXP[80]> (apropos "browse")
EXT:*BROWSER*                              variable
EXT:*BROWSERS*                             variable
CUSTOM:*INSPECT-BROWSER*                   variable
EXT:BROWSE-URL                             function
EXT::BROWSE-URL-1                       
EXT::BROWSE-URL-2                       
EXT::BROWSE-URL-3                       
:BROWSER                                   constant
SYSTEM::BROWSER                         

*BROWSERS* is not reexported to the package CUSTOM.

Follows small gripes:
1) the *browsers* list in file src/clhs.lisp is biased towards UNIX.
  '((:netscape "netscape" "-remote" "openURL(~a,new-window)")
    (:konqueror "kfmclient" "openURL" "~a")
    (:lynx "xterm" "-e" "lynx" "~a")
    (:w3m "xterm" "-e" "w3m" "~a")
    (:mmm "mmm" "-external" "~a")
    (:mosaic "xmosaic" "~a")
    (:emacs-w3 "gnudoit" "-q" "(w3-fetch \"~a\")")))
It doesn't provide any reasonable default for any other system. Furthermore, the elements in the alist are not made conditional upon #+UNIX.
Where can one expect "netscape -remote xyz" to work?

2) even the code in browse-url only works on UNIX (or a simulator).
  (run-program (car command) :arguments args :wait nil)
:WAIT nil (appending a "&" to the command line) only works in a UNIX shell.
We had a run-program topic here in the list a few weeks ago.

My opinion: starting a program is highly dependent on OS and
user configuration. A hook should be provided for this purpose,
not a hard coded run-program with non-standard keywords.

I seem to remember there is already a similar hook somewhere
in CLISP, possibly in one of the inspector packages? (or was
that in CMUCL?)

The easy yet satisfactory solution may be to add a final "&"
:arguments for every UNIX line, when the programs don't detach
by themselves anyway (netscape -remote?), e.g.
    (:mosaic "xmosaic" "~a" "&")
    (:emacs-w3 "gnudoit" ...) ; don't add "&"!

3) defvar *browsers* should include a documentation string about the ~A format trick.

Here's what I found out for my installation of of M$-Windows-2000:
(setq ext:*browsers*
      '(;; Sadly, location of iexplore.exe depends on MS-Windows-95/98/NT/2000/xy/z
        #+win32(:IE "C:\\PROGRA~1\\Internet Explorer\\IEXPLORE.EXE" "~a")
        ;; PROGRA~1 works with "Program Files", "Programme" and hopefully more
        #+win32(:netscape "C:\\PROGRA~1\\Netscape\\Communicator\\Program\\netscape.exe" "-browser" "~a")
        ;; Netscape will detach (run asynchronously) by itself, IE does not.
        #+win32(:emacs-w3 "C:\\PROGRA~1\\emacs-20.7\\gnuserv\\gnudoit.exe" "-q" "(w3-fetch \"~a\")")
        ;; gnuclient/gnudoit are semi-aynchronous
        #+win32(:emacs "C:\\PROGRA~1\\emacs-20.7\\gnuserv\\gnuclient.exe" "~a")
        ))

However, the list does not work with the :WAIT nil thing still in clhs.lisp:BROWSE-URL

More portable code would query the registry for the application
associated with ".html" or ".htm"). Who wants to write that?
  (:default ... sys::registry or new dir-key code ...)
(setq *browser* :default)

4) ext:*browser[s]* (or custom:*) should be mentioned in config.lisp
That's the file that users are supposed to look at. (not clhs.lisp)

BTW, what's the final word on *lib-directory*, clisp-data-file
and the data/ subdirectory?
data/ or not data/ subdirectory?

Regards,
	Jorg Hohle

---

From: Sam Steingold <[email-masked]>
Date: Fri Apr 12 07:21:51 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] ext:clhs & (apropos "browse") and customization bug & call for co de snippet (win32 registry->browser)"
> * Sent on Fri, 12 Apr 2002 09:58:44 +0200
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> Follows a bug report:

fixed, thanks!

> It doesn't provide any reasonable default for any other
> system. Furthermore, the elements in the alist are not made
> conditional upon #+UNIX.

the notion of system default effectively exists only on KDE, GNOME and
win32.

> Where can one expect "netscape -remote xyz" to work?

everywhere.

> We had a run-program topic here in the list a few weeks ago.

yes, actually, I still want to clean up this mess.

> (setq *browser* :default)

if dir-key is made into a module, we will have to stick to
sys::registry which looks only under one root.
is this browser setting there?
I don't have a w32 box to check.

actually, this is not even necessary.
IIUC, if you tell w32 to "run" an HTML file, it will start a browser.
(cf. Emacs `w32-shell-execute').

> That's the file that users are supposed to look at. (not clhs.lisp)
done.

> data/ or not data/ subdirectory?

it's `data' on all platforms.
I thought I did that already! (2002-02-26)

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
<http://www.palestine-central.com/> <http://www.mideasttruth.com/>
Your mouse has moved - WinNT has to be restarted for this to take effect.