From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicholas Harrison Newsgroups: gmane.emacs.bugs Subject: bug#44338: 27.1; EWW can't download and view pdf Date: Thu, 5 Nov 2020 10:52:10 -0700 Message-ID: References: <878sbmo6i0.fsf@tcd.ie> <83tuu5b1oh.fsf@gnu.org> <837dqzc42r.fsf@gnu.org> <83sg9najmh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000fe9c5405b35fc13b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37708"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44338@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 05 18:55:06 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kajTV-0009gi-TM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Nov 2020 18:55:06 +0100 Original-Received: from localhost ([::1]:51300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kajTU-0007WW-SO for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Nov 2020 12:55:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kajRX-000505-5z for bug-gnu-emacs@gnu.org; Thu, 05 Nov 2020 12:53:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kajRW-0004yg-6M for bug-gnu-emacs@gnu.org; Thu, 05 Nov 2020 12:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kajRW-0001cW-63 for bug-gnu-emacs@gnu.org; Thu, 05 Nov 2020 12:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Nicholas Harrison Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Nov 2020 17:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44338 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44338-submit@debbugs.gnu.org id=B44338.16045987506186 (code B ref 44338); Thu, 05 Nov 2020 17:53:02 +0000 Original-Received: (at 44338) by debbugs.gnu.org; 5 Nov 2020 17:52:30 +0000 Original-Received: from localhost ([127.0.0.1]:54060 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kajQz-0001bg-Hc for submit@debbugs.gnu.org; Thu, 05 Nov 2020 12:52:29 -0500 Original-Received: from mail-yb1-f178.google.com ([209.85.219.178]:34337) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kajQx-0001bS-5K for 44338@debbugs.gnu.org; Thu, 05 Nov 2020 12:52:27 -0500 Original-Received: by mail-yb1-f178.google.com with SMTP id o70so2094131ybc.1 for <44338@debbugs.gnu.org>; Thu, 05 Nov 2020 09:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aai1ssO1Rds1rrvn2jjODXuvAIIdzKeKi1vMKr5YSAA=; b=Nhs9WpBz5gIL4saHUV79YRsxdMpKv3OGCfTv/fTytr8EvAbhC1oxSoVPYfsjlNt3s+ EEPiGMN6S4pOxiGq3qI+BlyffGN8npz9Wdw8DCHTyW5YiuTc6B5ippzbjJH33ffeQ3tm ecqumn+JACtD5RD3pDJ5GChOSQhY2MqSaFrwr5rWOw1GzAW/Z6VsigySDt/7ErvMz/NF MKWcaV3PSrkPQMY1aeN7Ec5uOh+j39FA1QRal9ZY0teVUEZtVuZpC7TxNHkAzK1u+cjP 1qBI1/C1Q+K5Goa98FXI3uCHQKpNXhC/CuL83p0EG0R2XypHreqIAZ3iTzilUw5YCDRR 7Viw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aai1ssO1Rds1rrvn2jjODXuvAIIdzKeKi1vMKr5YSAA=; b=Egw88DkwxNGrI8IXtA3Dd62YwaOq0Yo/nLso1FYEmsBFkAH5eaz3JunbXXYXbP2Ij5 qKFWSGmEXdXVZqA+SnvEBnlRfNrLp9wEngBd4CFKZbIl5uXKYaFBcO84vac7zKKQY6QG HBO7+WxsFoPLx6G+NOtmVkr+1pk2X+Sv9RRbS5tRFkt2z9pIlDcQsaLcoi4OUNlbdwsU 3+Yquy67AMWJUo9GiX2cXzoPpORTM2DVwj03gsiDY53dINoQGKxCsM04BcDytsvyxds+ 4oxGzHaH8V7v6qKJj3B934JVcklOlkCKGfNtVzFiUbYv1TRrH5bnzzTKrjOxIX4NhHTq 3osg== X-Gm-Message-State: AOAM533xRqR+2NrBRHaPTBPtFamtvXJicHMHE4aKB9IRFxQFADIkLR2M HknUWThvRekQDi7z02ssQ5Sv0yd8dBnjLT5aG3M= X-Google-Smtp-Source: ABdhPJyGeklp3l7dbuU+fgYuOFwU7E42mxdouEinl0K8tW6faE7Cp1CFIfIQPTA11+HhIO/dHSO3VuZvkjOzU3D7y3I= X-Received: by 2002:a25:2002:: with SMTP id g2mr408143ybg.138.1604598741506; Thu, 05 Nov 2020 09:52:21 -0800 (PST) In-Reply-To: <83sg9najmh.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192746 Archived-At: --000000000000fe9c5405b35fc13b Content-Type: text/plain; charset="UTF-8" No, it didn't ask me for an encoding. Good stab in the dark. I ran your new function code and the mailcap-user-mime-data code again (after loading eww). No debugger triggered. It converted and showed the pdf correctly. On Thu, Nov 5, 2020 at 8:50 AM Eli Zaretskii wrote: > > From: Nicholas Harrison > > Date: Thu, 5 Nov 2020 08:18:19 -0700 > > Cc: 44338@debbugs.gnu.org > > > > After running the code you gave and using eww to open a pdf, this is > what I get: > > > > Debugger entered--entering a function: > > * select-safe-coding-system("100" nil prefer-utf-8 nil > > "c:/Users/nicho/AppData/Local/Temp/docview1001/!eww > > pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el") > > write-region("100" nil > "c:/Users/nicho/AppData/Local/Temp/docview1001/!eww > > pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el" nil silently) > > #f(compiled-function () #)() > > doc-view-sentinel(#png> "finished\n") > > > > Debugger entered--returning value: prefer-utf-8-dos > > select-safe-coding-system("100" nil prefer-utf-8 nil > "c:/Users/nicho/AppData/Local/Temp/docview1001/!eww > > pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el") > > write-region("100" nil > "c:/Users/nicho/AppData/Local/Temp/docview1001/!eww > > pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el" nil silently) > > #f(compiled-function () #)() > > doc-view-sentinel(#png> "finished\n") > > Hmm, that's not the problem you reported originally, and it doesn't > look like Emacs asked you to select an encoding here, did it? > > > The buffer it ends up with says: > > Cannot display this page! > > Maybe because of a conversion failure! > > So I guess I'm confused now and don't know what is the problem, sorry. > > A stub in the dark: if you replace raw-text with raw-text-unix here: > > (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))) > > does the problem go away? > --000000000000fe9c5405b35fc13b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
No, it didn't ask me for an encoding.

Good stab in the dark. I ran your new function code and the mailcap-user= -mime-data code again (after loading eww). No debugger triggered. It=C2=A0c= onverted and showed the pdf correctly.

On Thu, Nov 5, 2020 at 8:50 AM = Eli Zaretskii <eliz@gn= u.org> wrote:
> From: Nicholas Harrison <nicholasharrison222@gmail.com>
> Date: Thu, 5 Nov 2020 08:18:19 -0700
> Cc: 44338@d= ebbugs.gnu.org
>
> After running the code you gave and using eww to open a pdf, this is w= hat I get:
>
> Debugger entered--entering a function:
> * select-safe-coding-system("100" nil prefer-utf-8 nil
> "c:/Users/nicho/AppData/Local/Temp/docview1001/!eww
> pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el")
>=C2=A0 =C2=A0write-region("100" nil "c:/Users/nicho/AppD= ata/Local/Temp/docview1001/!eww
> pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el" nil silently= )
>=C2=A0 =C2=A0#f(compiled-function () #<bytecode 0x1ff19f1>)()
>=C2=A0 =C2=A0doc-view-sentinel(#<process pdf/ps->png> "fi= nished\n")
>
> Debugger entered--returning value: prefer-utf-8-dos
>=C2=A0 =C2=A0select-safe-coding-system("100" nil prefer-utf-8= nil "c:/Users/nicho/AppData/Local/Temp/docview1001/!eww
> pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el")
>=C2=A0 =C2=A0write-region("100" nil "c:/Users/nicho/AppD= ata/Local/Temp/docview1001/!eww
> pdf!-2072e1249b26ee28e656f1a01f0cb4a9/resolution.el" nil silently= )
>=C2=A0 =C2=A0#f(compiled-function () #<bytecode 0x1ff19f1>)()
>=C2=A0 =C2=A0doc-view-sentinel(#<process pdf/ps->png> "fi= nished\n")

Hmm, that's not the problem you reported originally, and it doesn't=
look like Emacs asked you to select an encoding here, did it?

> The buffer it ends up with says:
> Cannot display this page!
> Maybe because of a conversion failure!

So I guess I'm confused now and don't know what is the problem, sor= ry.

A stub in the dark: if you replace raw-text with raw-text-unix here:

=C2=A0 (defun eww-display-pdf ()
=C2=A0 =C2=A0 (let ((data (buffer-substring (point) (point-max))))
=C2=A0 =C2=A0 =C2=A0 (pop-to-buffer-same-window (get-buffer-create "*e= ww pdf*"))
=C2=A0 =C2=A0 =C2=A0 (let ((coding-system-for-write 'raw-text)=C2=A0 &l= t;<<<<<<<<<<<<<<<<<<<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (inhibit-read-only t))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (erase-buffer)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (insert data)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (mailcap-view-mime "application/pdf")= ))
=C2=A0 =C2=A0 (goto-char (point-min)))

does the problem go away?
--000000000000fe9c5405b35fc13b--