aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2014-11-03 20:39:08 +0100
committerLars Magne Ingebrigtsen2014-11-03 20:39:08 +0100
commit39804c1adb5972939221d22c422c421dd2b7145c (patch)
treee06bffac117bb756eb45db37717a2ae7463e4ea6
parentb318262277d237e37be9def42407d55c4bdf84d8 (diff)
downloademacs-39804c1adb5972939221d22c422c421dd2b7145c.tar.gz
emacs-39804c1adb5972939221d22c422c421dd2b7145c.zip
Make eww display PDFs inline
* net/eww.el (eww-display-html): Clear `url-queue'. (eww-display-pdf): New function. (eww-render): Display PDFs with `doc-view'.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/eww.el15
2 files changed, 21 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ffea1b323ad..4de1fe0fded 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-11-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * net/eww.el (eww-display-html): Clear `url-queue'.
4 (eww-display-pdf): New function.
5 (eww-render): Display PDFs with `doc-view'.
6
12014-11-03 Yoni Rabkin <yrk@gnu.org> 72014-11-03 Yoni Rabkin <yrk@gnu.org>
2 8
3 * net/eww.el (eww-list-bookmarks): Autoload. 9 * net/eww.el (eww-list-bookmarks): Autoload.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index f319d68e1fb..9a97f02747f 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -214,6 +214,8 @@ word(s) will be searched for via `eww-search-prefix'."
214 (eww-browse-with-external-browser url)) 214 (eww-browse-with-external-browser url))
215 ((equal (car content-type) "text/html") 215 ((equal (car content-type) "text/html")
216 (eww-display-html charset url nil point)) 216 (eww-display-html charset url nil point))
217 ((equal (car content-type) "application/pdf")
218 (eww-display-pdf))
217 ((string-match-p "\\`image/" (car content-type)) 219 ((string-match-p "\\`image/" (car content-type))
218 (eww-display-image) 220 (eww-display-image)
219 (eww-update-header-line-format)) 221 (eww-update-header-line-format))
@@ -256,6 +258,9 @@ word(s) will be searched for via `eww-search-prefix'."
256(defun eww-display-html (charset url &optional document point) 258(defun eww-display-html (charset url &optional document point)
257 (or (fboundp 'libxml-parse-html-region) 259 (or (fboundp 'libxml-parse-html-region)
258 (error "This function requires Emacs to be compiled with libxml2")) 260 (error "This function requires Emacs to be compiled with libxml2"))
261 ;; There should be a better way to abort loading images
262 ;; asynchronously.
263 (setq url-queue nil)
259 (let ((document 264 (let ((document
260 (or document 265 (or document
261 (list 266 (list
@@ -393,6 +398,16 @@ word(s) will be searched for via `eww-search-prefix'."
393 (shr-put-image data nil)) 398 (shr-put-image data nil))
394 (goto-char (point-min)))) 399 (goto-char (point-min))))
395 400
401(defun eww-display-pdf ()
402 (let ((data (buffer-substring (point) (point-max))))
403 (switch-to-buffer (get-buffer-create "*eww pdf*"))
404 (let ((coding-system-for-write 'raw-text)
405 (inhibit-read-only t))
406 (erase-buffer)
407 (insert data)
408 (doc-view-mode)))
409 (goto-char (point-min)))
410
396(defun eww-setup-buffer () 411(defun eww-setup-buffer ()
397 (switch-to-buffer (get-buffer-create "*eww*")) 412 (switch-to-buffer (get-buffer-create "*eww*"))
398 (let ((inhibit-read-only t)) 413 (let ((inhibit-read-only t))