Commit 39804c1a authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen
Browse files

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'.
parent b3182622
2014-11-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/eww.el (eww-display-html): Clear `url-queue'.
(eww-display-pdf): New function.
(eww-render): Display PDFs with `doc-view'.
2014-11-03 Yoni Rabkin <yrk@gnu.org>
* net/eww.el (eww-list-bookmarks): Autoload.
......
......@@ -214,6 +214,8 @@ word(s) will be searched for via `eww-search-prefix'."
(eww-browse-with-external-browser url))
((equal (car content-type) "text/html")
(eww-display-html charset url nil point))
((equal (car content-type) "application/pdf")
(eww-display-pdf))
((string-match-p "\\`image/" (car content-type))
(eww-display-image)
(eww-update-header-line-format))
......@@ -256,6 +258,9 @@ word(s) will be searched for via `eww-search-prefix'."
(defun eww-display-html (charset url &optional document point)
(or (fboundp 'libxml-parse-html-region)
(error "This function requires Emacs to be compiled with libxml2"))
;; There should be a better way to abort loading images
;; asynchronously.
(setq url-queue nil)
(let ((document
(or document
(list
......@@ -393,6 +398,16 @@ word(s) will be searched for via `eww-search-prefix'."
(shr-put-image data nil))
(goto-char (point-min))))
(defun eww-display-pdf ()
(let ((data (buffer-substring (point) (point-max))))
(switch-to-buffer (get-buffer-create "*eww pdf*"))
(let ((coding-system-for-write 'raw-text)
(inhibit-read-only t))
(erase-buffer)
(insert data)
(doc-view-mode)))
(goto-char (point-min)))
(defun eww-setup-buffer ()
(switch-to-buffer (get-buffer-create "*eww*"))
(let ((inhibit-read-only t))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment