<<< Date Index >>>     <<< Thread Index >>>

Re: Can one have two alternative programs to view text/html?



* John Buttery <john@xxxxxx> [2004-01-28 16:01 -0600]:
> * "A. S. Budden" <mutt.mail@xxxxxxxxxxxxxxxxxxxxx> [2004-01-28 11:44:11 
> +0000]:
> > Is it possible to set up mutt and mailcap so that by default it uses
> > lynx (or other text mode browser) to view HTML mail but one can use
> > a GUI browser (is that the word) as an option?
> > 
> > Normally I simply want to see the text of HTML E-Mail (that's all
> > there is in most of them!) but occasionally they have pictures that I
> > want to see.
> 
> * Thus spake Chris Green:
> > You can do this if you use autoview for the text mode, something like
> > this:
> > 
> > text/html; mozilla.sh %s; test=InXTerm
> > text/html; lynx -dump %s; nametemplate=%s.html; copiousoutput
> > 
> > Then when you open an html email, it'll be dumped to ascii and will be
> > viewable in the normal pager, but if you hit 'v' or 'l' or whatever it
> > is (I have a fairly heavily customised keyboard layout -- I use the vim
> > keys for most things, so I can't remember what the proper key is) to get
> > the attachments view up and load the html from there, it'll open in
> > mozilla.

But that won't open the pictures, as Mr. Budden wanted, which is why I have
a script to munpack the email.

>   Apologies for thread hijacking, but this is actually related.  ;)
> 
>   One of the things I always thought would be pretty cool was if the
> autoview config command took another argument, a mailcap-format string
> describing the desired behaviour.  In other words, instead of what we
> have now:
> 
> autoview text/html
> 
>   ...you would have something like this:
> 
> autoview text/html 'lynx -force_html -dump %s'
> 
>   My logic behind this is that autoview is a controlled environment (in
> the sense that it's always trying to display something as text), but
> normal mailcap use (and it's not only used by mail clients, mind you)
> can be anything.  As an example, I like to have mutt run "jpginfo" on my
> JPEG attachments, so I can at least see some useful information.  Of
> course, any other time I'm "running" a JPEG I want it displayed as a
> picture.  To produce this effect now, I have to do clever things with
> mutt-specific mailcap files, etc.  Anyway, just thought I'd request this
> again.  Oh, and "uncolor" for body/header objects would be great too.
> :)

You just need a mailcap entry with the "copiousoutput" flag. Eg, from my
.mailcap:

 image/*; eog %s; test=test -n "$DISPLAY"
 image/*; identify %s; copiousoutput

Eog (Eye of GNOME) is an image viewer; it is used when I open an attachment
from the attachments menu (and am in an xterm). Identify is a command line
utility from the ImageMagick suite, which prints out a one-line description
of the file; because of the copiousoutput flag, mutt knows its output can be
inserted in the pager.

I have "auto_view image/*" in my .muttrc, and it works as you seem to want.
-- 
Joshua 'bruce' Crawford ... http://www.geocities.com/mortarn

A fool and his money are my two favourite people.

Attachment: pgpnVwXKSIee2.pgp
Description: PGP signature