[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 007d4c2 1/2: Make a prefix to `eww-reload' work loc
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 007d4c2 1/2: Make a prefix to `eww-reload' work locally |
Date: |
Sun, 07 Dec 2014 19:50:31 +0000 |
branch: master
commit 007d4c29c273e3c147716a9bf63b1887b1413d40
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>
Make a prefix to `eww-reload' work locally
Fixes: debbugs:19086
* net/eww.el (eww-reload): Take a prefix to work locally (bug#19086).
---
etc/NEWS | 4 ++++
lisp/ChangeLog | 4 ++++
lisp/net/eww.el | 21 ++++++++++++++-------
3 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 5a95133..514d423 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 c9e5bd7..7ebec5d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-07 Lars Magne Ingebrigtsen <address@hidden>
+
+ * net/eww.el (eww-reload): Take a prefix to work locally (bug#19086).
+
2014-12-07 Ivan Shmakov <address@hidden>
* net/eww.el (eww-list-histories): Restore the history in the
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index f74f0ef..6253e4c 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -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