* mailcap MIME type handlers
@ 2018-09-23 2:52 Ben Bacarisse
2018-09-23 6:08 ` Teemu Likonen
[not found] ` <mailman.1164.1537683367.1284.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: Ben Bacarisse @ 2018-09-23 2:52 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mailcap MIME type handlers
2018-09-23 2:52 mailcap MIME type handlers Ben Bacarisse
@ 2018-09-23 6:08 ` Teemu Likonen
[not found] ` <mailman.1164.1537683367.1284.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Teemu Likonen @ 2018-09-23 6:08 UTC (permalink / raw)
To: Ben Bacarisse; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 585 bytes --]
Ben Bacarisse [2018-09-23 03:52:03+01] wrote:
> 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.
Use variable mailcap-user-mime-data:
(setq mailcap-user-mime-data
'(((type . "application/pdf")
(viewer . "my-viewer %s"))))
--
/// Teemu Likonen - .-.. <https://keybase.io/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.1164.1537683367.1284.help-gnu-emacs@gnu.org>]
* Re: mailcap MIME type handlers
[not found] ` <mailman.1164.1537683367.1284.help-gnu-emacs@gnu.org>
@ 2018-09-23 14:38 ` Ben Bacarisse
0 siblings, 0 replies; 3+ messages in thread
From: Ben Bacarisse @ 2018-09-23 14:38 UTC (permalink / raw)
To: help-gnu-emacs
Teemu Likonen <tlikonen@iki.fi> writes:
> Ben Bacarisse [2018-09-23 03:52:03+01] wrote:
>
>> 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.
>
> Use variable mailcap-user-mime-data:
>
> (setq mailcap-user-mime-data
> '(((type . "application/pdf")
> (viewer . "my-viewer %s"))))
Thanks, but that's a bit of a sledge hammer! It looses all the other
settings, and duplicates where I specify the viewer.
I'd like mailcap.el to get the setting from ~/.mailcap. My current
work-around is to
(require 'mailcap)
(setq mailcap-mime-data nil)
(mailcap-parse-mailcaps nil t)
in .emacs, but that's also rather crude because it loses the default
settings from mailcap-user-mime-data, some of which may be useful (I
have not looked at them all). Not to mention doing all the work twice.
--
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-23 14:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-23 2:52 mailcap MIME type handlers Ben Bacarisse
2018-09-23 6:08 ` Teemu Likonen
[not found] ` <mailman.1164.1537683367.1284.help-gnu-emacs@gnu.org>
2018-09-23 14:38 ` Ben Bacarisse
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.