[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mutt/Neomutt and mailcap



On Wed 15 Sep 2021 at 16:21:12 (-0500), Nate Bargmann wrote:
> * On 2021 15 Sep 14:20 -0500, tomas@tuxteam.de wrote:
> > On Wed, Sep 15, 2021 at 02:01:23PM -0400, Greg Wooledge wrote:
> > > On Wed, Sep 15, 2021 at 12:58:10PM -0500, Nate Bargmann wrote:
> > > > * On 2021 15 Sep 10:44 -0500, Jonathan Dowland wrote:
> > > > > What does this command report?
> > > > > 
> > > > >     ;see --norun application/octet-stream:/dev/null
> > 
> > > Jonathan's message confused me too.  As far as I can tell, "see" is
> > > a *shell* command, not a mutt command [...]
> > 
> > Perhaps the semicolon was intended to be an exclamation mark (!)
> > (although, assuming Jonathan has a USish keyboard layout they are
> > far apart indeed).
> 
> Indeed!  That works.
> 
> I missed it in the help list as my mind was fixated on the ;.  Other
> programs like Vim use ! as a means to execute a shell command.
> 
> It should have been so obvious...

I think what your system is doing is as follows:

You probably have in your (default) /etc/Muttrc:

  # Use mime.types to look up handlers for application/octet-stream. Can
  # be undone with unmime_lookup.
  mime_lookup application/octet-stream

That sends mutt looking in /etc/mime.types where it finds the line:

  text/x-diff                                     diff patch

Your attachment had the extension ".patch", so it searches your
and the system's mailcap files for "text/x-diff", fails to find it,
and eventually hits the default entry:

   text/*; less '%s'; needsterminal

which it obeys.

BTW, your shell command,

  !see --norun application/octet-stream:/dev/null

will give you an answer in the context of a subshell, and
not necessarily in the context of mutt itself. For example,
on my shell:

$ see --norun text/html:/dev/null
/usr/bin/sensible-browser /dev/null
$ 

but the special mailcap prioritised by my mutt defines:

  text/html; /usr/bin/lynx -force-html -localhost -stdin

and any subshell would know nothing about that.

About the ";", it could also be an accidentally unshifted ":",
and it might be easy to mis-remember:

    ":" is mutt's keystroke for entering mutt commands, whereas
    "!" is mutt's keystroke for entering shell commands.

Cheers,
David.


Reply to: