From: Michael Albinus Date: Mon, 7 Jun 2021 18:41:30 +0000 (+0200) Subject: Improve support of remote files in browse-url.el X-Git-Tag: emacs-28.0.90~2168 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fcc827619f2cdac9d574f49e08ce4e5be41daf0a;p=emacs.git 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) --- diff --git a/etc/NEWS b/etc/NEWS index ff06a13a986..64b39d737aa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 0220c7adf6e..7fa81c5c295 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -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)))