help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mailcap MIME type handlers


From: Ben Bacarisse
Subject: mailcap MIME type handlers
Date: Sun, 23 Sep 2018 03:52:03 +0100

Short version:

How can I get Emacs (specifically mailcap.el) to prioritise my system's
or my personal mailcap settings?

Gnus, for example, opens PDF files in doc-view-mode rather than using
the program specified in /etc/mailcap or ~/.mailcap.

In more detail...

>From an quick examination of mailcap.el it seems that an initial set of
mailcap data, given an explicit list assigned to mailcap-mime-data, is
augmented by reading the system's mailcap files along with the user's
mailcap.  However, the initial data do not simply provide a default
back-stop because many of them use Emacs modes that are, for most
people, to be preferred.  This is achieved by sorting the list of
possible matches with a predicate that favours Lisp symbols over strings
(mailcap-viewer-lessp).  Thus '(viewer doc-view-mode) will win over
'(viewer "/usr/bin/mupdf %s") or, indeed, over any setting from the
parsed files.

I have a crude solution.  If, after mailcap is loaded, I manually
execute

  (setq mailcap-mime-data nil)
  (mailcap-parse-mailcaps nil t)

only the parsed entries will be seen as the initial value of
mailcap-mime-data is lost.  But this is not a good solution not least
because I may want some of these "built-in" handlers -- I haven't
checked them all.

What is the proper way to deal with this?

If there isn't a neat solution, maybe I can hook into the mailcap system
to get the behaviour I want.  What's the best way to do that?  Do I need
to resort to advice-add?

-- 
Ben.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]