Improve support of remote files in browse-url.el

* etc/NEWS: Mention support of remote file browsing.

* lisp/net/browse-url.el (browse-url-of-buffer): Revert last change.
(browse-url-of-file): Use temporary file in case of remote file.
(Bug#48397)
This commit is contained in:
Michael Albinus 2021-06-07 20:41:30 +02:00
parent 89f91e502e
commit fcc827619f
2 changed files with 8 additions and 1 deletions

View file

@ -1599,6 +1599,11 @@ symbol property to the browsing commands. With a new command
'browse-url-with-browser-kind', an URL can explicitly be browsed with
either an internal or external browser.
---
*** Support for browsing of remote files.
If a remote file is taken, a local temporary copy of that file is
passed to the browser.
*** Support for the conkeror browser is now obsolete.
*** Support for the Mosaic browser has been removed.

View file

@ -47,6 +47,7 @@
;; browse-url-xdg-open freedesktop.org xdg-open
;; browse-url-kde KDE konqueror (kfm)
;; browse-url-elinks Elinks Don't know (tried with 0.12.GIT)
;; eww-browse-url Emacs Web Wowser
;; Browsers can cache Web pages so it may be necessary to tell them to
;; reload the current page if it has changed (e.g., if you have edited
@ -773,6 +774,8 @@ interactively. Turn the filename into a URL with function
(cond ((not (buffer-modified-p)))
(browse-url-save-file (save-buffer))
(t (message "%s modified since last save" file))))))
(when (file-remote-p file)
(setq file (file-local-copy file)))
(browse-url (browse-url-file-url file))
(run-hooks 'browse-url-of-file-hook))
@ -806,7 +809,6 @@ narrowed."
(or buffer-file-name
(and (boundp 'dired-directory) dired-directory)))))
(when (or (not file-name)
(file-remote-p file-name)
;; This can happen when we're looking at a file from a
;; zip file buffer, for instance.
(not (file-exists-p file-name)))