Skip to main content

Module mailcap

Module mailcap 

Source
Expand description

RFC 1524 mailcap, read the way mutt reads it for auto_view: a [filters] entry with an empty command means “the command is in my mailcap”, and only a copiousoutput entry can answer, since that is the one promising plain text on stdout rather than a window of its own.

The files are $MAILCAPS (colon-separated) when it is set, and otherwise mutt’s default list: ~/.mailcap, /etc/mailcap, /usr/etc/mailcap, /usr/local/etc/mailcap, in that order. The first entry that matches a type wins, text/* wildcards included.

Structs§

Entry
One mailcap line: the type it handles, the view command, and the flags rmut cares about.
Viewer
What view-mailcap needs of the entry it picked.

Functions§

apply_nametemplate
A part’s temp-file name through the entry’s nametemplate, mutt’s rfc1524_expand_filename: basenames only; around the template’s %s, each side of the name that already matches is kept, and each side that does not is added - so page.html through %s.html stays itself, and part-2 becomes part-2.html. A template with no %s names the file outright.
command_for
The command that renders mimetype inline, or None when no entry can: mutt takes the first matching copiousoutput entry whose test passes. An entry wanting the terminal, or one interpolating a %{parameter} rmut does not have, is passed over.
load
Every entry from every readable mailcap file, in search order. A missing file is not an error, like mutt.
parse
Parse one mailcap file.
paths
The mailcap files to consult, in order.
viewer_for
The viewer for mimetype, mutt’s view-mailcap: the first matching entry whose test passes, terminal-wanting or not.