Subject: Re: bug#43318: Unable to open remote pdf directly with eww

From: Stefan Kangas <[email-masked]>
Date: Thu, 10 Sep 2020 14:25:55 -0700

Lars Ingebrigtsen <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> 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...