GNU bug report logs -
#44338
27.1; EWW can't download and view pdf
Previous Next
Reported by: Nicholas Harrison <nicholasharrison222 <at> gmail.com>
Date: Fri, 30 Oct 2020 22:21:02 UTC
Severity: minor
Tags: fixed, patch
Found in version 27.1
Fixed in version 28.1
Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Bug is archived. No further changes may be made.
Full log
Message #117 received at 44338 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 44338 fixed
close 44338 28.1
quit
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>
>> In other words, can we remove the binding altogether from
>> eww-display-pdf and make the *eww pdf* buffer unibyte, as Stefan
>> suggested?
>
> Yes, this is the correct fix.
Thanks, done.
Fix coding system in eww-display-pdf
4610241a9b 2020-11-05 21:06:39 +0000
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=4610241a9b3fbddd1f0973bf49f7008ed09ab955
I'm therefore marking this bug as fixed in 28.1.
Nicholas, here's the cumulative change to the function eww-display-pdf,
in case you want to patch/advise yours on Emacs 27.1:
[eww.diff (text/x-diff, inline)]
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index d6f850ca3b..43405fbd9c 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -667,14 +811,19 @@ eww-display-image
(declare-function mailcap-view-mime "mailcap" (type))
(defun eww-display-pdf ()
- (let ((data (buffer-substring (point) (point-max))))
- (pop-to-buffer-same-window (get-buffer-create "*eww pdf*"))
- (let ((coding-system-for-write 'raw-text)
- (inhibit-read-only t))
- (erase-buffer)
- (insert data)
- (mailcap-view-mime "application/pdf")))
- (goto-char (point-min)))
+ (let ((buf (current-buffer))
+ (pos (point)))
+ (with-current-buffer (get-buffer-create "*eww pdf*")
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (set-buffer-multibyte nil)
+ (insert-buffer-substring buf pos)
+ (mailcap-view-mime "application/pdf"))
+ (if (zerop (buffer-size))
+ ;; Buffer contents passed to shell command via temporary file.
+ (kill-buffer)
+ (goto-char (point-min))
+ (pop-to-buffer-same-window (current-buffer))))))
(defun eww-setup-buffer ()
(when (or (plist-get eww-data :url)
[Message part 3 (text/plain, inline)]
--
Basil
This bug report was last modified 4 years and 291 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.