GNU bug report logs - #43318
Unable to open remote pdf directly with eww

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Thu, 10 Sep 2020 19:41:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43318 in the body.
You can then email your comments to 43318 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#43318; Package emacs. (Thu, 10 Sep 2020 19:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 10 Sep 2020 19:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: Unable to open remote pdf directly with eww
Date: Thu, 10 Sep 2020 12:39:59 -0700
Steps to reproduce:

0. emacs -Q
1. M-x eww RET https://www.gnu.org/software/emacs/manual/pdf/emacs.pdf RET

Result: My external pdf reader (titled "Document Viewer", not sure what
it is, maybe some Gnome thing) opens with the message "Unable to open
file '/home/skangas/wip/emacs/-'".  It seems like it tried to open the
file "-" in the directory from which I run Emacs.

It would be useful if this would open the pdf doc-view-mode, or if the
pdf was downloaded to /tmp and opened using "Document Viewer" from there
or something.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43318; Package emacs. (Thu, 10 Sep 2020 19:56:01 GMT) Full text and rfc822 format available.

Message #8 received at 43318 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 43318 <at> debbugs.gnu.org
Subject: Re: bug#43318: Unable to open remote pdf directly with eww
Date: Thu, 10 Sep 2020 21:55:41 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> 0. emacs -Q
> 1. M-x eww RET https://www.gnu.org/software/emacs/manual/pdf/emacs.pdf RET
>
> Result: My external pdf reader (titled "Document Viewer", not sure what
> it is, maybe some Gnome thing) opens with the message "Unable to open
> file '/home/skangas/wip/emacs/-'".  It seems like it tried to open the
> file "-" in the directory from which I run Emacs.
>
> It would be useful if this would open the pdf doc-view-mode, or if the
> pdf was downloaded to /tmp and opened using "Document Viewer" from there
> or something.

When I open that link in eww, I get a *eww pdf* buffer which displays
the file (after a while; that's a big pdf) using DocView mode.

So perhaps this fails if whatever tools DocView mode uses isn't
installed?  It looks like it calls...  uhm...  gs?

In that case, it should try using a different pdf viewer, but I'm not
quite sure how that's handled.  mailcap should probably be consulted?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43318; Package emacs. (Thu, 10 Sep 2020 20:52:01 GMT) Full text and rfc822 format available.

Message #11 received at 43318 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 43318 <at> debbugs.gnu.org
Subject: Re: bug#43318: Unable to open remote pdf directly with eww
Date: Thu, 10 Sep 2020 22:51:04 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> In that case, it should try using a different pdf viewer, but I'm not
> quite sure how that's handled.  mailcap should probably be consulted?

Oh, that is what it's doing:

(defun mailcap-view-mime (type)
  "View the data in the current buffer that has MIME type TYPE.
`mailcap--computed-mime-data' determines the method to use."
  (let ((method (mailcap-mime-info type)))
    (if (stringp method)
	(shell-command-on-region (point-min) (point-max)
				 ;; Use stdin as the "%s".
				 (format method "-")
				 (current-buffer)
				 t)
      (funcall method))))

eww puts the pdf data in a buffer and calls (for instance) "xpdf -" on
the data.

But this'll fail for most pdf viewers -- most of them don't read from
stdin, so this seems like a pretty gross hack...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43318; Package emacs. (Thu, 10 Sep 2020 21:27:02 GMT) Full text and rfc822 format available.

Message #14 received at 43318 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43318 <at> debbugs.gnu.org
Subject: Re: bug#43318: Unable to open remote pdf directly with eww
Date: Thu, 10 Sep 2020 14:25:55 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> In that case, it should try using a different pdf viewer, but I'm not
>> quite sure how that's handled.  mailcap should probably be consulted?
>
> Oh, that is what it's doing:
>
> (defun mailcap-view-mime (type)
>   "View the data in the current buffer that has MIME type TYPE.
> `mailcap--computed-mime-data' determines the method to use."
>   (let ((method (mailcap-mime-info type)))
>     (if (stringp method)
> 	(shell-command-on-region (point-min) (point-max)
> 				 ;; Use stdin as the "%s".
> 				 (format method "-")
> 				 (current-buffer)
> 				 t)
>       (funcall method))))
>
> eww puts the pdf data in a buffer and calls (for instance) "xpdf -" on
> the data.
>
> But this'll fail for most pdf viewers -- most of them don't read from
> stdin, so this seems like a pretty gross hack...

Sounds like a good analysis.

In my case I'm using evince, because at some point I put this in my
"~/.mailcap":

    application/pdf; evince %s

And I guess evince doesn't read from stdin, as you say...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43318; Package emacs. (Fri, 11 Sep 2020 12:08:02 GMT) Full text and rfc822 format available.

Message #17 received at 43318 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 43318 <at> debbugs.gnu.org
Subject: Re: bug#43318: Unable to open remote pdf directly with eww
Date: Fri, 11 Sep 2020 14:07:45 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> In my case I'm using evince, because at some point I put this in my
> "~/.mailcap":
>
>     application/pdf; evince %s
>
> And I guess evince doesn't read from stdin, as you say...

I've now fixed this on the trunk to start the external viewer the
traditional way.  It starts it synchronously, though, which isn't ideal,
but having the deletion triggered from a process filter, for instance,
will leave the temporary file there upon crashes...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 11 Sep 2020 12:09:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 43318 <at> debbugs.gnu.org and Stefan Kangas <stefan <at> marxist.se> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 11 Sep 2020 12:09:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43318; Package emacs. (Fri, 02 Oct 2020 14:32:01 GMT) Full text and rfc822 format available.

Message #24 received at 43318 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43318 <at> debbugs.gnu.org
Subject: Re: bug#43318: Unable to open remote pdf directly with eww
Date: Fri, 2 Oct 2020 14:31:52 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Stefan Kangas <stefan <at> marxist.se> writes:
>
>> In my case I'm using evince, because at some point I put this in my
>> "~/.mailcap":
>>
>>     application/pdf; evince %s
>>
>> And I guess evince doesn't read from stdin, as you say...
>
> I've now fixed this on the trunk to start the external viewer the
> traditional way.  It starts it synchronously, though, which isn't ideal,
> but having the deletion triggered from a process filter, for instance,
> will leave the temporary file there upon crashes...

I've now tested it and I can confirm that your fix works here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43318; Package emacs. (Fri, 02 Oct 2020 14:33:02 GMT) Full text and rfc822 format available.

Message #27 received at 43318 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 43318 <at> debbugs.gnu.org
Subject: Re: bug#43318: Unable to open remote pdf directly with eww
Date: Fri, 02 Oct 2020 16:32:42 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> I've now tested it and I can confirm that your fix works here.

Thanks!

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 31 Oct 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.