From ab6dea82bfc48652f130e193fe434deba54306b1 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sun, 1 Dec 2013 14:11:36 +0100 Subject: [PATCH] (eww-current-dom): New variable used to save the current DOM. Rewritten from a short patch by T.V. Raman. --- lisp/ChangeLog | 1 + lisp/net/eww.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 469bd37ec8a..e9c8b528f65 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,7 @@ * net/eww.el (eww-restore-history): Update the window title after moving in the history. + (eww-current-dom): New variable used to save the current DOM. 2013-12-01 Dmitry Gutov diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 28ef237b612..70fd5641756 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -89,6 +89,7 @@ :group 'eww) (defvar eww-current-url nil) +(defvar eww-current-dom nil) (defvar eww-current-title "" "Title of current page.") (defvar eww-history nil) @@ -219,6 +220,7 @@ word(s) will be searched for via `eww-search-prefix'." 'base (list (cons 'href url)) (libxml-parse-html-region (point) (point-max))))) (eww-setup-buffer) + (setq eww-current-dom document) (let ((inhibit-read-only t) (after-change-functions nil) (shr-width nil) @@ -378,6 +380,7 @@ word(s) will be searched for via `eww-search-prefix'." \\{eww-mode-map}" ;; FIXME? This seems a strange default. (set (make-local-variable 'eww-current-url) 'author) + (set (make-local-variable 'eww-current-dom) nil) (set (make-local-variable 'browse-url-browser-function) 'eww-browse-url) (set (make-local-variable 'after-change-functions) 'eww-process-text-input) (set (make-local-variable 'eww-history) nil) @@ -390,6 +393,7 @@ word(s) will be searched for via `eww-search-prefix'." (push (list :url eww-current-url :title eww-current-title :point (point) + :dom eww-current-dom :text (buffer-string)) eww-history)) @@ -429,6 +433,7 @@ word(s) will be searched for via `eww-search-prefix'." (let ((inhibit-read-only t)) (erase-buffer) (insert (plist-get elem :text)) + (setq eww-current-dom (plist-get elem :dom)) (goto-char (plist-get elem :point)) (setq eww-current-url (plist-get elem :url) eww-current-title (plist-get elem :title)) -- 2.39.2