Slow to respond here.

Mutt's MIME handling stuff has a long section in the manual here:
http://www.mutt.org/doc/manual/#mimesupport
with the mailcap section commencing here:
http://www.mutt.org/doc/manual/#mailcap

In particular see the stuff about "copiousoutput" and the pager.

On 12May2022 15:38, Christopher Conforti <christop...@conforti.xyz> wrote:
>Hi list, I'm having a bit of a weird one, at least for me. I can't get mutt to
>read my entire mailcap file properly, it seems. For example, I have the
>following line in my mailcap:
>
>images/*;      eog %s

I'm surprised; image MIME types are normally "image/*", not "images/*".

>It handles this just fine; all image attachments are opened with eog. However,
>another line:
>
>text/html      lynx -dump %s | more
>
>is seemingly ignored, even when there are no other options given for handling
>HTML.

I was going to explain that this is interactive and thus not chosen. But 
I see that this is _exactly_ the example in the manual in the MIME 
section :-(

The section on Reading Mail has a part on the pager:
http://www.mutt.org/doc/manual/#pager-menu
which says that by default it uses its builtin pager. That means it 
cannot use an interactive programme unless you configure $pager:
http://www.mutt.org/doc/manual/#pager

But that is for the message as a whole, after conversion to plain text.

You're trying to configure how mutt presents HTML inline in the message 
body. Because that is paged (either with the builtin pager or via an 
external pager you specify with $pager) mutt cannot choose an 
interactive mailcap command. Therefore your command cannot be chosen.

Marking the mailcap entry with "copiousoutput" says that the command 
produces a lot of output, and should be paged. Since that works for you, 
this implies that when "more" isn't sending to a terminal it basicly 
acts like "cat". A quick experiment confirms this for me:

    man mutt|more|less

pages the output with "less" - the "more" command has just passed the 
text through. So you get away with it.

Technically you should have 2 entries. Mine look lke this:

    text/html; env DISPLAY= unhtml %s | less
    text/html; exec 2>&1 && env DISPLAY= unhtml %s; copiousoutput

because the mailcap isn't a mutt-specific thing, and also since mutt 
doesn't use it just for the message display, but also for the attachment 
view action.

So the first entry there has mutt write an HTML component to a file, 
then call "unhtml" on that file and pipe the output through "less".

"unhtml" is just a shell script of my own which runs my current 
preferred HTML-to-plain-tetx converter. Presently it uses "lynx -stdin 
-dump" with a bunch of pre and post manking.

The second entry is for the pager: it has "copiousoutput" appended, and 
does not invoke a paging programme.

>What the heck is going on? Where can I learn how to fix it?

Give the MIME section of the manual a read - it has a lot of detail on 
what you can put in the mailcap entry, including an example of multiple 
entries for a type in the "3.3.2. Search Order" part.

Cheers,
Cameron Simpson <c...@cskk.id.au>

Reply via email to