mailcap
The ~/.mailcap file is parsed by most MIME-aware message handlers and describes how elements are supposed to be displayed. Here’s an example file:
image/*; gimp -8 %s
audio/wav; wavplayer %s
application/msword; catdoc %s ; copiousoutput ; nametemplate=%s.docThis says that all image files should be displayed with gimp, that WAVE audio files should be played by wavplayer, and that MS-WORD files should be inlined by catdoc.
The mailcap library parses this file, and provides functions for matching types.
mailcap-mime-data
This variable is an alist of alists containing backup viewing rules.
mailcap-user-mime-data
A customizable list of viewers that take preference over mailcap-mime-data.
Interface functions:
mailcap-view-file
Prompt for a file name, and start a viewer applicable for the file type in question.
mailcap-parse-mailcaps
Parse the ~/.mailcap file.
mailcap-mime-info
Takes a MIME type as its argument and returns the matching viewer.
The mailcap-prefer-mailcap-viewers variable controls which viewer is chosen. The default non-nil value means that settings from ~/.mailcap is preferred over system-wide or Emacs-provided viewer settings.
If nil, Emacs-provided viewer settings have precedence. Next, the most specific viewer has precedence over less specific settings, no matter if they’re system-provided or private, so ‘image/gif’ in /etc/mailcap will “win” over an ‘image/*’ setting in ~/.mailcap.