(eww-current-dom): New variable used to save the current DOM.

Rewritten from a short patch by T.V. Raman.
This commit is contained in:
Lars Magne Ingebrigtsen 2013-12-01 14:11:36 +01:00
parent 3e9876dedc
commit ab6dea82bf
2 changed files with 6 additions and 0 deletions

View file

@ -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 <dgutov@yandex.ru>

View file

@ -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))