[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
browse-url-of-file passes funny url to browser
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Tue, 14 Apr 2009 19:59:41 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 10827
Hi,
`browse-url-of-file' performed for a local file passes a funny
url to the browser. So do `browse-url-of-dired-file' and
`browse-url-of-buffer'. For instance:
(let* (result
(browse-url-browser-function (lambda (url &optional arg)
(setq result url))))
(browse-url-of-file "/some/where/index.html")
result)
=> "file:/some/where/index.html"
Some browsers (e.g. Firefox) work with such a url but others
(e.g. emacs-w3m) don't. It is due to the last item of the default
value of `browse-url-filename-alist':
--8<---------------cut here---------------start------------->8---
browse-url-filename-alist is a variable defined in `browse-url.el'.
Its value is
(("^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*" . "ftp://\\2/")
("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/")
("^/+" . "file:/"))
--8<---------------cut here---------------end--------------->8---
I believe it should be ("^/+" . "file:///"). Does anyone know
any harm with this change?
--8<---------------cut here---------------start------------->8---
*** browse-url.el~ Mon Jan 5 03:22:43 2009
--- browse-url.el Tue Apr 14 10:57:43 2009
***************
*** 446,452 ****
,@(if (memq system-type '(windows-nt ms-dos cygwin))
'(("^\\([a-zA-Z]:\\)[\\/]" . "file:\\1/")
("^[\\/][\\/]+" . "file://")))
! ("^/+" . "file:/"))
"An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'.
Any substring of a filename matching one of the REGEXPs is replaced by
the corresponding STRING using `replace-match', not treating STRING
--- 446,452 ----
,@(if (memq system-type '(windows-nt ms-dos cygwin))
'(("^\\([a-zA-Z]:\\)[\\/]" . "file:\\1/")
("^[\\/][\\/]+" . "file://")))
! ("^/+" . "file:///"))
"An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'.
Any substring of a filename matching one of the REGEXPs is replaced by
the corresponding STRING using `replace-match', not treating STRING
--8<---------------cut here---------------end--------------->8---
Regards,