Subject: bug#44338: 27.1; EWW can't download and view pdf

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 03 Nov 2020 15:49:34 +0100

"Basil L. Contovounesios" <[email-masked]> writes:

> Here's what I'm doing, with the pdf-tools package already installed
> under package-user-dir:
>
> 0. emacs -Q
> 1. M-x package-initialize RET
> 2. M-x pdf-tools-install RET
>    (this autoloads pdf-view-mode, registers it on auto-mode-alist, etc.)
> 3. M-x eww RET https://www.gnu.org/software/emacs/manual/emacs.html RET
> 4. C-s extra pdf RET RET
>
> This uses doc-view-mode, whereas C-x C-f path/to/pdf RET uses
> pdf-view-mode.

Thanks for the recipe; I'm seeing this bug, too.

(pp mailcap--computed-mime-data (current-buffer))
=>

  ("pdf"
   (viewer . doc-view-mode)
   (type . "application/pdf")
   (test . window-system))
  ("pdf"
   (viewer . pdf-view-mode)
   (type . "application/pdf")
   (test . window-system))

So doc-view-mode is ahead of pdf-view-mode in the computed structure...

Ah; mailcap-mime-data entries are handled in opposite order -- the final
matching entry is the one that wins, not the first one?  Looks like it.

I've now noted this in the doc string, and I've also moved pdf-view-mode
later, because it makes sense to prefer that if it's installed (since
doc-view-mode is build in.

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