Subject: bug#40247: 27.0.90; mailcap-mime-data erased when parsing mime parts

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 02 Aug 2020 08:20:23 +0200

Juan José García Ripoll <[email-masked]> writes:

> Symptoms:
> - Start Emacs in a system without ~/.mailcap
> - Launch Gnus
> - Open an email / news that has some part in text/html
> - mailcap-mime-data is erased and none of the default viewers are
> available any more.
>
> The problem persits if Emacs is customized using mailcap-add

Oops.  This is all such a mess -- we have defaults coming from Emacs via
mailcap-mime-data, system defaults from /etc and user defaults from
~/.mailcap and mailcap-add...

The problem is that we don't keep track of where and how things are
added -- it's all just stored in mailcap-mime-data, and reconstructing
the precedence (for instance, when the user edits ~/.mailcap) is
impossible.

The fix I made in October is clearly wrong, but it basically works for
the basic (and common) "respect my ~/.mailcap" file case.

But I'm not quite sure how to go about fixing this bug...  Hm.  I think
perhaps we have to stop messing about with the mailcap-mime-data
variable when we compute the precedence.  So mailcap-parse-mailcaps
should heed all the files, and mailcap-mime-info, but store the computed
data in a new variable, that will then be consulted when trying to
determine what viewers to use.

I'll take a whack at implementing it that way and then see how that goes.

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