bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons


From: Lars Ingebrigtsen
Subject: bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
Date: Fri, 25 Dec 2015 23:15:08 +0100
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux)

jidanni@jidanni.org writes:

> b runs the command browse-url-of-dired-file
> And when used on
> /tmp/WWW::Facebook::API.html
> it tried to browse
> ftp://tmp/WWW/:Facebook::API.html
>
> Say, aren't files always local files?

They are, so this is pretty nonsensical.

The culprit here is

(defun browse-url-file-url (file)
  "Return the URL corresponding to FILE.
Use variable `browse-url-filename-alist' to map filenames to URLs."
  (let ((coding (if (equal system-type 'windows-nt)
                    ;; W32 pretends that file names are UTF-8 encoded.
                    'utf-8
                  (and (default-value 'enable-multibyte-characters)
                       (or file-name-coding-system
                           default-file-name-coding-system)))))
    (if coding (setq file (encode-coding-string file coding))))
  (setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]"))
  (dolist (map browse-url-filename-alist)
    (when (and map (string-match (car map) file))
      (setq file (replace-match (cdr map) t nil file))))
  file)

(browse-url-file-url "/tmp/WWW::Facebook::API.html")
=> "ftp://tmp/WWW/:Facebook::API.html";

Which is wrong.

I don't quite understand why it does all this?  Why doesn't it just
prepend "file://" to the file name?  (Ok, it should probably do the
browse-url-url-encode-chars thing, anyway...)

Ideas?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]