unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
@ 2010-01-11 17:54 jidanni
  2015-12-25 22:15 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: jidanni @ 2010-01-11 17:54 UTC (permalink / raw)
  To: emacs-pretest-bug

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?

(I didn't check if my http://jidanni.org/comp/configuration/
impacted it.)
In GNU Emacs 23.1.91.1 (i486-pc-linux-gnu, GTK+ Version 2.18.5)
 of 2010-01-07 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20100106-1)






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
  2010-01-11 17:54 bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons jidanni
@ 2015-12-25 22:15 ` Lars Ingebrigtsen
  2015-12-25 22:43   ` Andreas Schwab
  2015-12-26  8:17   ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-25 22:15 UTC (permalink / raw)
  To: jidanni; +Cc: 5362

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
  2015-12-25 22:15 ` Lars Ingebrigtsen
@ 2015-12-25 22:43   ` Andreas Schwab
  2015-12-26  8:17   ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2015-12-25 22:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 5362-done, jidanni

Fixed in 25.1

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
  2015-12-25 22:15 ` Lars Ingebrigtsen
  2015-12-25 22:43   ` Andreas Schwab
@ 2015-12-26  8:17   ` Eli Zaretskii
  2015-12-26 12:41     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2015-12-26  8:17 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 5362, jidanni

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 25 Dec 2015 23:15:08 +0100
> Cc: 5362@debbugs.gnu.org
> 
> (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?

See the doc string of browse-url-filename-alist: it's for ange-ftp
support.  It aims at transparently supporting file names like
/anonym@bs2000.anywhere.com:/:X:/IMPORTANT.TEXT.ON.BS2000.  Now you
tell me how should browse-url distinguish that from the file name the
OP shows in this bug report?

> Ideas?

Since browse-url-of-dired-file knows it is operating on a local file,
it could simply bind browse-url-filename-alist to some value (nil?)
that would disable the offending translations.  Would that work?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
  2015-12-26  8:17   ` Eli Zaretskii
@ 2015-12-26 12:41     ` Lars Ingebrigtsen
  2015-12-26 13:26       ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-26 12:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 5362, jidanni

Eli Zaretskii <eliz@gnu.org> writes:

> Since browse-url-of-dired-file knows it is operating on a local file,
> it could simply bind browse-url-filename-alist to some value (nil?)
> that would disable the offending translations.  Would that work?

I think so...

However, Andreas changed the regexp to only react to colons in the first
part of the file name, which works, I guess.  But files like

/www::foo.html

(in the root) will still be mishandled, I think...

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
  2015-12-26 12:41     ` Lars Ingebrigtsen
@ 2015-12-26 13:26       ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2015-12-26 13:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 5362, jidanni

Lars Ingebrigtsen <larsi@gnus.org> writes:

> However, Andreas changed the regexp to only react to colons in the first
> part of the file name, which works, I guess.  But files like
>
> /www::foo.html
>
> (in the root) will still be mishandled, I think...

Such local files would be mishandled everywhere in Emacs, because they
use the remote file name syntax. They must be prefixed like
/:www::foo.html , see (info "(elisp) Magic File Names") .

Best regards, Michael.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-26 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-11 17:54 bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons jidanni
2015-12-25 22:15 ` Lars Ingebrigtsen
2015-12-25 22:43   ` Andreas Schwab
2015-12-26  8:17   ` Eli Zaretskii
2015-12-26 12:41     ` Lars Ingebrigtsen
2015-12-26 13:26       ` Michael Albinus

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).