:: Re: [DNG] mutt and html
Top Page
Delete this message
Reply to this message
Author: Bob Proulx
Date: 2021-11-03 18:45 -000
To: dng
Subject: Re: [DNG] mutt and html
Hendrik Boom wrote:
> ~/.muttrc:
>
> set mailcap_path="~/.mailcap"


Strange. This is not needed to be set for me. Does that setting
override the default use of /etc/mailcap?

> auto_view text/html
> ...
> Unfortunately it now prefers the .html version to the plaintext version.
> I presume I need an alternative_order line.


I have this comment in my own file.

    # The problem with autoview is that it then preferrs the text/html
    # part instead of the text/plain part.  Instead use 'm' to view the
    # part with the associated mailcap.
    # auto_view text/html


I don't know if there is a better way to configure it. But because of
not being able to deduce a way to avoid this undesired behavior I
avoid that configuration and use an explicit 'm' to mimecap-view the
html part explicitly instead.

> ~/.mailcap:
>
> #text/html ; chromium %s
> text/html ; firefox-esr -no-remote %s ; copiousoutput


For firefox-esr the "copiousoutput" does not really follow as that is
to tell mutt to pager through the output using the builtin text pager
itself. Which doesn't really apply since firefox-esr opens a
graphical window on $DISPLAY.

Also this is missing a test of $DISPLAY being set. Which means that
it will activate but fail if one is using ssh (without -X) or
otherwise when DISPLAY is not set. And also I admit to cargo culting
here but all of the stock entries use nametemplate.

I suggest starting with the stock entries for firefox-esr:

    $ grep firefox-esr /etc/mailcap
    text/html; /usr/bin/firefox-esr %s; description=HTML Text; test=test -n "$DISPLAY";  nametemplate=%s.html
    text/xml; /usr/bin/firefox-esr %s; description=XML Text; test=test -n "$DISPLAY";  nametemplate=%s.xml
    image/png;  /usr/bin/firefox-esr %s; description=PNG Image; test=test -n "$DISPLAY";  nametemplate=%s.png
    image/jpeg;  /usr/bin/firefox-esr %s; description=JPEG Image; test=test -n "$DISPLAY";  nametemplate=%s.jpeg
    image/gif;  /usr/bin/firefox-esr %s; description=GIF Image; test=test -n "$DISPLAY";  nametemplate=%s.gif


And then modifying those to add the -no-remote option or other option as desired.

Bob