unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: emacs-pretest-bug@gnu.org
Cc: emacs-w3m@namazu.org
Subject: bug#2992: browse-url-of-file passes funny url to browser
Date: Tue, 14 Apr 2009 19:59:41 +0900	[thread overview]
Message-ID: <b4m4owrpkki.fsf__23516.4155405529$1239708350$gmane$org@jpl.org> (raw)

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,






                 reply	other threads:[~2009-04-14 10:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='b4m4owrpkki.fsf__23516.4155405529$1239708350$gmane$org@jpl.org' \
    --to=yamaoka@jpl.org \
    --cc=2992@emacsbugs.donarmstrong.com \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=emacs-w3m@namazu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).