The *eww pdf* buffer is only needed when viewing PDFs within Emacs,
e.g., with doc-view-mode. External PDF viewers are called with a
temporary file, so the buffer is not needed in that case. What's
more, mailcap-view-mime erased the buffer and left it in
fundamental-mode until now, so the user was left staring at a
useless, empty buffer. To make things even worse, external viewers
were invoked synchronously until now, so the user could not browse
the PDF file and use Emacs simultaneously.
* lisp/net/mailcap.el (mailcap--async-shell): New function.
(mailcap-view-mime): Use it to invoke external viewers
asynchronously. Mention erasure of current buffer in that case in
docstring. Add a period between the temporary file name and its
extension.
* lisp/net/eww.el (eww-display-pdf): Simplify using
insert-buffer-substring. Fix coding-system-for-write for a stream
of raw bytes. Pop to *eww pdf* buffer only if it is used for
displaying a document; otherwise kill it. (bug#44338)