Make a prefix to `eww-reload' work locally

Fixes: debbugs:19086

* net/eww.el (eww-reload): Take a prefix to work locally (bug#19086).
parent b9ad615e
......@@ -211,6 +211,10 @@ pages visited) is now preserved in the desktop file.
*** `eww-after-render-hook' is now called after eww has rendered
the data in the buffer.
---
*** The `eww-reload' command now takes a prefix to not reload via
the net, but just use the local copy of the HTML.
+++
*** The DOM shr and eww uses has been changed to the general Emacs
xml.el/libxml2 DOM, and a new package dom.el has been added to
......
2014-12-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/eww.el (eww-reload): Take a prefix to work locally (bug#19086).
2014-12-07 Ivan Shmakov <ivan@siamics.net>
* net/eww.el (eww-list-histories): Restore the history in the
......
......@@ -763,12 +763,19 @@ appears in a <link> or <a> tag."
(eww-browse-url (shr-expand-url best-url (plist-get eww-data :url)))
(user-error "No `top' for this page"))))
(defun eww-reload (&optional encode)
"Reload the current page."
(interactive)
(defun eww-reload (&optional local encode)
"Reload the current page.
If LOCAL (the command prefix), don't reload the page from the
network, but just re-display the HTML already fetched."
(interactive "P")
(let ((url (plist-get eww-data :url)))
(url-retrieve url 'eww-render
(list url (point) (current-buffer) encode))))
(if local
(if (null (plist-get eww-data :dom))
(error "No current HTML data")
(eww-display-html 'utf-8 url (plist-get eww-data :dom)
(point) (current-buffer)))
(url-retrieve url 'eww-render
(list url (point) (current-buffer) encode)))))
;; Form support.
......@@ -1387,8 +1394,8 @@ Differences in #targets are ignored."
"Set character encoding."
(interactive "zUse character set (default utf-8): ")
(if (null charset)
(eww-reload 'utf-8)
(eww-reload charset)))
(eww-reload nil 'utf-8)
(eww-reload nil charset)))
;;; Bookmarks code
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment