diff options
| author | Michael Albinus | 2021-06-07 20:41:30 +0200 |
|---|---|---|
| committer | Michael Albinus | 2021-06-07 20:41:30 +0200 |
| commit | fcc827619f2cdac9d574f49e08ce4e5be41daf0a (patch) | |
| tree | f472744db6604108ec9b2888ed9092e56d515f26 | |
| parent | 89f91e502ec484e7e544c3d33de596da5fe53f73 (diff) | |
| download | emacs-fcc827619f2cdac9d574f49e08ce4e5be41daf0a.tar.gz emacs-fcc827619f2cdac9d574f49e08ce4e5be41daf0a.zip | |
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)
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/net/browse-url.el | 4 |
2 files changed, 8 insertions, 1 deletions
| @@ -1599,6 +1599,11 @@ symbol property to the browsing commands. With a new command | |||
| 1599 | 'browse-url-with-browser-kind', an URL can explicitly be browsed with | 1599 | 'browse-url-with-browser-kind', an URL can explicitly be browsed with |
| 1600 | either an internal or external browser. | 1600 | either an internal or external browser. |
| 1601 | 1601 | ||
| 1602 | --- | ||
| 1603 | *** Support for browsing of remote files. | ||
| 1604 | If a remote file is taken, a local temporary copy of that file is | ||
| 1605 | passed to the browser. | ||
| 1606 | |||
| 1602 | *** Support for the conkeror browser is now obsolete. | 1607 | *** Support for the conkeror browser is now obsolete. |
| 1603 | 1608 | ||
| 1604 | *** Support for the Mosaic browser has been removed. | 1609 | *** 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 @@ | |||
| 47 | ;; browse-url-xdg-open freedesktop.org xdg-open | 47 | ;; browse-url-xdg-open freedesktop.org xdg-open |
| 48 | ;; browse-url-kde KDE konqueror (kfm) | 48 | ;; browse-url-kde KDE konqueror (kfm) |
| 49 | ;; browse-url-elinks Elinks Don't know (tried with 0.12.GIT) | 49 | ;; browse-url-elinks Elinks Don't know (tried with 0.12.GIT) |
| 50 | ;; eww-browse-url Emacs Web Wowser | ||
| 50 | 51 | ||
| 51 | ;; Browsers can cache Web pages so it may be necessary to tell them to | 52 | ;; Browsers can cache Web pages so it may be necessary to tell them to |
| 52 | ;; reload the current page if it has changed (e.g., if you have edited | 53 | ;; 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 | |||
| 773 | (cond ((not (buffer-modified-p))) | 774 | (cond ((not (buffer-modified-p))) |
| 774 | (browse-url-save-file (save-buffer)) | 775 | (browse-url-save-file (save-buffer)) |
| 775 | (t (message "%s modified since last save" file)))))) | 776 | (t (message "%s modified since last save" file)))))) |
| 777 | (when (file-remote-p file) | ||
| 778 | (setq file (file-local-copy file))) | ||
| 776 | (browse-url (browse-url-file-url file)) | 779 | (browse-url (browse-url-file-url file)) |
| 777 | (run-hooks 'browse-url-of-file-hook)) | 780 | (run-hooks 'browse-url-of-file-hook)) |
| 778 | 781 | ||
| @@ -806,7 +809,6 @@ narrowed." | |||
| 806 | (or buffer-file-name | 809 | (or buffer-file-name |
| 807 | (and (boundp 'dired-directory) dired-directory))))) | 810 | (and (boundp 'dired-directory) dired-directory))))) |
| 808 | (when (or (not file-name) | 811 | (when (or (not file-name) |
| 809 | (file-remote-p file-name) | ||
| 810 | ;; This can happen when we're looking at a file from a | 812 | ;; This can happen when we're looking at a file from a |
| 811 | ;; zip file buffer, for instance. | 813 | ;; zip file buffer, for instance. |
| 812 | (not (file-exists-p file-name))) | 814 | (not (file-exists-p file-name))) |