Subject: mailcap (was Re: bug#21331: 24.5; LibreOffice documents have less support...)

From: [email-masked] (N. Jackson)
Date: Wed, 26 Aug 2015 14:34:58 -0300

I apologise profusely for causing this disturbance with a bug title that
turns out to have been a result of user misunderstanding.

As pointed out when I closed the bug, this is not an Emacs bug. Through
a mechanism of which I do not know the details, Gnus can open mail
attachments in an external program if there is an entry for the MIME
type of the attachment in the system (or user's?) mailcap file.

I happened to have an entry for the MIME type "application/msword" in my
mailcap file and no entries for LibreOffice files, causing the behaviour
I observed and misinterpreted as being "caused" by Emacs.

At 13:19 -0300 on Wednesday 2015-08-26, Glenn Morris wrote:

> I really doubt any GNU/Linux distribution has better support for MS
> Office in this area (a program they cannot ship or even install,
> ignoring Wine) then LibreOffice (which they do ship).

Checking this today, I deleted my mailcap file and reinstalled the
mailcap package from the Fedora 21 repository. The newly installed file
is:

    ### 
    ### Begin Red Hat Mailcap
    ###

    audio/*; /usr/bin/xdg-open %s

    image/*; /usr/bin/xdg-open %s

    application/msword; /usr/bin/xdg-open %s
    application/pdf; /usr/bin/xdg-open %s
    application/postscript ; /usr/bin/xdg-open %s

    text/html; /usr/bin/xdg-open %s ; copiousoutput

I'm guessing that the entry for msword has been added automatically
based on some configuration I've inadvertently made somewhere else
(probably as a desperate measure when I first switched permanently away
from Windows and needed to view a file from work).

But the possibility exists that this entry came from the distribution.
That would mean that for programs that use mailcap rather than desktop
facilities (xdg-utils or whatever), there is better support on Fedora
for Microsoft Word files (which will open in LibreOffice) than for
LibreOffice documents. But I too really doubt that. It worries me
though, so I will probably go on investigating until I find the truth of
the matter.

But not an Emacs problem.

> So on modern systems probably Emacs should give up and just call
> xdg-open.

That would be nice.

> (Though I seem to recall it's a pain because it forks and seems to
> exit.)

Presumably Gnus successfully uses xdg-open after it finds the xdg-open
entries in my mailcap file, so this problem can't be insurmountable, it
seems.