From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: gmane.emacs.help Subject: mailcap MIME type handlers Date: Sun, 23 Sep 2018 03:52:03 +0100 Organization: A noiseless patient Spider Message-ID: <87va6xudrg.fsf@bsb.me.uk> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1537671200 4111 195.159.176.226 (23 Sep 2018 02:53:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Sep 2018 02:53:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 23 04:53:15 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g3uWI-0000vw-3y for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Sep 2018 04:53:14 +0200 Original-Received: from localhost ([::1]:38731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3uYO-0005Lk-KK for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Sep 2018 22:55:24 -0400 Original-Path: usenet.stanford.edu!goblin3!goblin2!goblin.stu.neva.ru!news.uzoreto.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.help Original-Lines: 40 Original-Injection-Info: reader02.eternal-september.org; posting-host="bd05ef6332e88c6a8eb9707de337af74"; logging-data="30662"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7nfwS3tsP5RoPnHYDvOfDtNVHUhVP6O4=" Cancel-Lock: sha1:Y2zBaDKwKzdoIX4Q2UOLgHVgdu0= sha1:Gj1FiqeNubtMpXHs5lPMJekwuk8= X-BSB-Auth: 1.6c0096421ebadead43cb.20180923035203BST.87va6xudrg.fsf@bsb.me.uk Original-Xref: usenet.stanford.edu comp.emacs:103351 gnu.emacs.help:223853 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:117978 Archived-At: 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.