unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2992: browse-url-of-file passes funny url to browser
@ 2009-04-14 10:59 Katsumi Yamaoka
  0 siblings, 0 replies; only message in thread
From: Katsumi Yamaoka @ 2009-04-14 10:59 UTC (permalink / raw)
  To: emacs-pretest-bug; +Cc: emacs-w3m

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,






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-14 10:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14 10:59 bug#2992: browse-url-of-file passes funny url to browser Katsumi Yamaoka

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).