[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: w3m-goto-url on dodgy url file:/foo.html

>>>>> In [emacs-w3m : No.10851] Kevin Ryde wrote:
> Katsumi Yamaoka <yamaoka@xxxxxxx> writes:
>> -   ((string-match "\\`\\(\\(file:/\\{1,2\\}\\)\\|about://dtree\\)/" url)
>> +   ((string-match "\\`\\(\\(file:/\\{0,2\\}\\)\\|about://dtree\\)/" url)
>> Is it ok?

> Looks likely.  Though I notice it's not quite right (before or after :-)
> on a url with a hostname (a valid form),

>     (w3m-url-to-file-name "file://localhost/index.html")
>     => "/localhost/index.html"

> where I think it would be "index.html", or maybe tramp-ism or something.

I've fixed it, that was a long standing bug.  In addition, I've
added a code that makes it a Tramp name if it is guessed.  E.g.:

(w3m-url-to-file-name "file://remotehost/somewhere/index.html")
 => "/remotehost:/somewhere/index.html"

In that case, `tramp-default-method-alist' may want to be set
properly for "remotehost".

> Maybe url-parse.el could be pressed into service for the dirty work of
> picking apart a string url.  It might be shipping builtin with emacs23.

If you're talking about `url-generic-parse-url', it looks strict
in observing the regulations.  For example:

(url-generic-parse-url "file://foo.html")
 => [cl-struct-url "file" nil nil "foo.html" 21 "" nil nil t]

I.e., it parses that url into the host name "foo.html" and
the file name "".