all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ben Bacarisse <ben.usenet@bsb.me.uk>
To: help-gnu-emacs@gnu.org
Subject: mailcap MIME type handlers
Date: Sun, 23 Sep 2018 03:52:03 +0100	[thread overview]
Message-ID: <87va6xudrg.fsf@bsb.me.uk> (raw)

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	other threads:[~2018-09-23  2:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-23  2:52 Ben Bacarisse [this message]
2018-09-23  6:08 ` mailcap MIME type handlers Teemu Likonen
     [not found] ` <mailman.1164.1537683367.1284.help-gnu-emacs@gnu.org>
2018-09-23 14:38   ` Ben Bacarisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87va6xudrg.fsf@bsb.me.uk \
    --to=ben.usenet@bsb.me.uk \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.