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

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



>>>>> In [emacs-w3m : No.10844] Kevin Ryde wrote:
> With the current cvs, evaluating

>     (w3m-goto-url "file:/foo.html")

> gets an error

>     Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>       file-directory-p(nil)
>       w3m-goto-url("file:/foo.html")
>       eval((w3m-goto-url "file:/foo.html"))

> The url of course should be "file:///foo.html", but it might be good if
> w3m-goto-url either allowed a mistake like that, or gave a more
> informative error message than "stringp".

> I had this in my WWW_HOME environment variable, I think for lynx, maybe
> for old mosaic even.  Lynx allows it, but I think an error might be
> best, so as not to encourage anyone to use an incorrect syntax.

Allowing "file:/foo.html" seems to cause no harm.  This patch
makes emacs-w3m allow "file:/foo.html" as "/foo.html" in addition
to "file://foo.html" and "file:///foo.html":

--- w3m.el~	2009-04-22 06:32:37 +0000
+++ w3m.el	2009-04-23 09:40:00 +0000
@@ -2746 +2746 @@
-   ((string-match "\\`\\(\\(file:/\\{1,2\\}\\)\\|about://dtree\\)/" url)
+   ((string-match "\\`\\(\\(file:/\\{0,2\\}\\)\\|about://dtree\\)/" url)

Is it ok?
OTOH, making emacs-w3m cause an error or issue a warning seems
not to be very easy.