summaryrefslogtreecommitdiff
path: root/lisp/net/eww.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-02-20 16:08:45 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-02-20 16:14:05 +0100
commit3a6129e723943e499009a7d40b38ee9eec17c8ad (patch)
tree4a7cefdc81230d1a82e7af4b1adef31e9cc84f58 /lisp/net/eww.el
parentaa6d1027ce08f9827dcf7d3a2286f94ea1a283cb (diff)
downloademacs-3a6129e723943e499009a7d40b38ee9eec17c8ad.tar.gz
Make eww work better on Tramp HTML
* lisp/net/eww.el (eww-open-file): Use it. (eww-browse-url): Ditto. * lisp/net/shr.el (shr-expand-url): Allow loading relative Tramp files if we're reading from a file:// document. * lisp/url/url-file.el (url-allow-non-local-files): New user option (bug#40425).
Diffstat (limited to 'lisp/net/eww.el')
-rw-r--r--lisp/net/eww.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index cfebb108a5b..700a6c3e82f 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -32,6 +32,7 @@
(require 'thingatpt)
(require 'url)
(require 'url-queue)
+(require 'url-file)
(require 'xdg)
(eval-when-compile (require 'subr-x))
@@ -487,15 +488,11 @@ killed after rendering."
(defun eww-open-file (file)
"Render FILE using EWW."
(interactive "fFile: ")
- (eww (concat "file://"
- (and (memq system-type '(windows-nt ms-dos))
- "/")
- (expand-file-name file))
- nil
- ;; The file name may be a non-local Tramp file. The URL
- ;; library doesn't understand these file names, so use the
- ;; normal Emacs machinery to load the file.
- (eww--file-buffer file)))
+ (let ((url-allow-non-local-files t))
+ (eww (concat "file://"
+ (and (memq system-type '(windows-nt ms-dos))
+ "/")
+ (expand-file-name file)))))
(defun eww--file-buffer (file)
(with-current-buffer (generate-new-buffer " *eww file*")
@@ -1207,7 +1204,8 @@ instead of `browse-url-new-window-flag'."
(format "*eww-%s*" (url-host (url-generic-parse-url
(eww--dwim-expand-url url))))))
(eww-mode))
- (eww url))
+ (let ((url-allow-non-local-files t))
+ (eww url)))
(defun eww-back-url ()
"Go to the previously displayed page."