Stephen J. Turnbull writes:
>>>>> "Franz" == Franz Haeuslschmid
<lukrez(a)gmx.at> writes:
Franz> Hm. There is no program `open'. I guess, it is supposed to work
Franz> as follows on MS Windows: The action `open' is provided by the
Franz> shell (Explorer ?).
Then you'll have to change either the specification in browse-url or
change your shell to one that provides "open".
The default shell of MS Windows already provides `open'. It is
the default action of double-clicking the icon of the resource
that should be opened or started.
Alternatively, it's probably trivial to implement
"open" as a program
(I know that Mac OS X does, simply by passing the command-line
argument to the Finder). If someone does, and it's not already part
of some well-known suite, I would certainly support adding it to
XEmacs's suite of external utilities.
I think this is what Ville Skyttä had in mind when he posted his
reply.
[Speculations on what MS Windows does when the shell opens a
resource.]
Sure, but it's not XEmacs's problem. XEmacs currently
doesn't do
message translation, so that message must have come from the shell.
Ie, XEmacs called a shell, and told it to execute the command "open".
The shell told it that no such program exists. How is XEmacs supposed
to know that "open" is actually a builtin that only exists in certain shells?
That is quite true. However, it is possible that XEmacs
constructs the "wrong" arguments for a command. I tried to take
a look behind the scenes of executing a shell command on MS
Windows. And I think that this problem is really restricted in
its effect to MS Windows.
And the problem is IMHO located at the C/C++ layer.
The parameters for the shell execution are prepared in source
file `win32.c':
--8<---------------cut here---------------start------------->8---
Extbyte *opext = NULL;
Extbyte *parmext = NULL;
Extbyte *path = NULL;
Extbyte *doc = NULL;
if (STRINGP (operation))
LISP_STRING_TO_TSTR (operation, opext);
/* #### What about path names, which may be links? */
if (STRINGP (parameters))
LISP_STRING_TO_TSTR (parameters, parmext);
if (STRINGP (current_dir))
LOCAL_FILE_FORMAT_TO_TSTR (current_dir, path);
if (STRINGP (document))
LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR (document, doc);
ret = (int) qxeShellExecute (NULL, opext, doc, parmext, path,
(INTP (show_flag) ?
XINT (show_flag) : SW_SHOWDEFAULT));
--8<---------------cut here---------------end--------------->8---
The interesting variable here is `document' that refers to a lisp
object specifying the resource to open. In my case, this could
be `www.xemacs.org'.
This lisp object is converted using the macro
`LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR'. This macro is aliased to
the macro `LOCAL_FILE_FORMAT_TO_TSTR', both are defined in
`syswindows.h'. The later macro contains a call to
`qxe_realpath' in file `realpath.c' in order to convert file
paths into some internal format. The problem now is, that this
function is applied to the URL that I like to open. As there is
no special handling for URLs, that resource is treated as a
relative path and for generating an absolute path for it, the path
of the current working directory is prepended. During the
debugging process, it was tried to open the resource
`D:\Src\xemacs-21.5\nt\www.xemacs.org'. And this file is
definitely not available.
I now think that some sort of checking should be introduced to
decide whether a resource is defined by an URL and to disable the
conversion to an absolute path internally. This is however
beyond my capability yet.
Regards,
Franz.