From: Lars Magne Ingebrigtsen Date: Sun, 7 Dec 2014 19:49:16 +0000 (+0100) Subject: Make a prefix to `eww-reload' work locally X-Git-Tag: emacs-25.0.90~2635^2~172 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=007d4c29c273e3c147716a9bf63b1887b1413d40;p=emacs.git Make a prefix to `eww-reload' work locally Fixes: debbugs:19086 * net/eww.el (eww-reload): Take a prefix to work locally (bug#19086). --- diff --git a/etc/NEWS b/etc/NEWS index 5a951334373..514d4232914 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c9e5bd7793a..7ebec5d8d1c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-12-07 Lars Magne Ingebrigtsen + + * net/eww.el (eww-reload): Take a prefix to work locally (bug#19086). + 2014-12-07 Ivan Shmakov * net/eww.el (eww-list-histories): Restore the history in the diff --git a/lisp/net/eww.el b/lisp/net/eww.el index f74f0eff38b..6253e4cc9aa 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -763,12 +763,19 @@ appears in a or 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