~rjarry/aerc#240: 
aerc doesn't listen to mailcap files

I've mailcap files set up nicely. Mutt likes them and now I'm exploring aerc because I've just too many imap accounts to start mutt sessions for.

Alas I cannot open pdfs (for example) because aerc (0.14) doesn't think there is a mimetype to handle it:

No filter configured for this mimetype ('application/pdf')                                                                                                                                     

And yet:

$ grep pdf /etc/mailcap
application/pdf; /usr/bin/xpdf %s; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf
application/x-pdf; /usr/bin/xpdf %s; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf

$DISPLAY is set to the test part of it should pass (and does under mutt).

It'd be nice to get this working in aerc.

Status
REPORTED
Submitter
~yaln
Assigned to
No-one
Submitted
3 months ago
Updated
3 months ago
Labels
feature

~ferdinandyb 3 months ago

On Tue Mar 26, 2024 at 09:41, ~yaln outgoing@sr.ht wrote:

I've mailcap files set up nicely. Mutt likes them and now I'm exploring aerc because I've just too many imap accounts to start mutt sessions for.

Alas I cannot open pdfs (for example) because aerc (0.14) doesn't think there is a mimetype to handle it:

No filter configured for this mimetype ('application/pdf')                                                                                                                                     

You need to set up filtering in aerc.conf, see the filters part of man aerc-config. The error you see is coming from there. On the other hand, I'm guessing you want to open the pdf in an external application. In that case the default behaviour is that if you press O or call :open, it will open it with the default application for that program on your system.

And yet:

$ grep pdf /etc/mailcap
application/pdf; /usr/bin/xpdf %s; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf
application/x-pdf; /usr/bin/xpdf %s; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf

I'm not sure how all of the above relate to mailcap to be honest.

~yaln 3 months ago

I'm not sure how all of the above relate to mailcap to be honest.

Indicating that they are in mailcap and showing what their config is under the assumption that this might be useful

You need to set up filtering in aerc.conf, see the filters part of man aerc-config. The error you see is coming from there. On the other hand, I'm guessing you want to open the pdf in an external application. In that case the default behaviour is that if you press O or call :open, it will open it with the default application for that program on your system.

Ok. Installed the extra app (xdg-open from memory) and got what I am looking for specifically there so thanks for that. That was a big hole in the functionality I was looking for and I didn't realise that was the solution despite the error message. Totally my bad.

That said it'd still be nice if aerc took note of mailcaps for filters and used them rather than forced people to duplicate the config in a config specific to aerc and then maintain both. mailcaps for filters (those tagged copiousoutput) can be default with aerc's filtering config overriding where something needs to be done that is aerc specific.

eg:

$ grep copious /etc/mailcap
application/x-troff-man; /usr/bin/nroff -mandoc -Tutf8; copiousoutput; print=/usr/bin/nroff -mandoc -Tutf8 | print text/plain:-
text/troff; /usr/bin/nroff -mandoc -Tutf8; copiousoutput; print=/usr/bin/nroff -mandoc -Tutf8 | print text/plain:-
application/zip; unzip -l %s; nametemplate=%s.zip; copiousoutput
text/html; /usr/bin/w3m -I %{charset} -dump -T text/html %s; copiousoutput; description=HTML Text; nametemplate=%s.html
text/html; /usr/bin/lynx -dump -force_html %s; copiousoutput; description=HTML Text; nametemplate=%s.html
application/x-troff-man; /usr/bin/man -Tascii -l %s | col -b; copiousoutput; description=Man page
text/troff; /usr/bin/man -Tascii -l %s | col -b; copiousoutput; description=Man page
application/x-info; /usr/bin/info --subnodes -o /dev/stdout -f %s 2>/dev/null; copiousoutput; description=GNU Info document
application/x-tar; /bin/tar tvf %s; print=/bin/tar tvf - | print text/plain:-; copiousoutput
application/x-gtar; /bin/tar tvf %s; print=/bin/tar tvf - | print text/plain:-; copiousoutput
application/x-ustar; /bin/tar tvf %s; print=/bin/tar tvf - | print text/plain:-; copiousoutput

All those are already configured. To get that I'd need to duplicate it in aerc (as far as I am aware) and maintain it instead of having it "for free" as part of the general system (and via ~/.mailcap) user configs.

~rjarry 3 months ago

That sounds like a reasonable feature request. I cannot promise anything, though.

If somebody has time, implementing it shouldn't be that hard. You simply need to parse mailcap files and convert them to aerc filters.

It needs to be opt-in, otherwise surprises would happen :)

Register here or Log in to comment, or comment via email.