Re: autoview/mailcap/elinks question
- To: mutt-users@xxxxxxxx
- Subject: Re: autoview/mailcap/elinks question
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Thu, 1 May 2008 10:18:27 -0500
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=63cSHqsN9x51jxJEtwDh9VQ+XiQ=; b=Z2jf Fk4cca9M00lJ8UAmAONOuWvCLyq7OwpAYtblqvOpXhLNEPhpWV3MLqgTRYlrFY2C eREUoQR6DtYyjsFuypcWtSi5CrfP+XL+xyL83IVLNzdLr8SK2vArIxGMNjaqNqyo Ptdb8bW5uNsr+4ftvtMmI2gyT35nppByPR65BEA=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=gChXw4JhXuVr4P92JyDhrf0w29zbjwrwrOZy3o+fH5FSwF0x0OtbkaGGE0ZjYe7tYIAZu0eeEg3HpmziAVhoMFbX94iah5qnqLhja8adFjIPmZlryylFxOMKyywHePPkkdob+Ut7u4wql0+Aerr5UlEOLGIR6I8MjtLCIfF4IXQ=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:OpenPGP:User-Agent;
- In-reply-to: <20080501110408.GA29088@th-shell-1>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- Openpgp: id=CA8E235E; url=http://www.memoryhole.net/~kyle/kyle-pgp.asc; preference=signencrypt
- References: <20080501110408.GA29088@th-shell-1>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.17 (2008-04-09)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday, May 1 at 12:04 PM, quoth Chris G:
> I have moved from using lynx as my HTML mail viewer to using elinks
> which, for some types of HTML in particular, works much better.
Personally, I prefer w3m, because it uses line-drawing characters for
tables.
> However it's still not as good as it could be. I have "auto_view
> text/html" in my muttrc file. I have "text/html; elinks -force-html
> %s; copiousoutput" in my .mailcap. HTML E-Mail is displayed 80
> columns wide even when I have a much wider window and colours (i.e.
> background etc.) are not set properly.
>
> If I hit 'v' in the index and save the HTML part of the message to a
> file and then view that file using elinks I get a much better version,
> it uses the available width of the window and sets background colours
> etc.
The important thing to realize here is that you're using elinks two
different ways here. When you trigger elinks from the view menu ('v'),
mutt is calling elinks and allowing it to control the terminal and do
things like control it's own scrolling and take input from the user
and such. When mutt calls elinks for doing auto_view, mutt connects
elinks' output to a pipe so that mutt can capture that output and
display it. The big difference as far as elinks is concerned is that
in the first case it has a connection to the terminal. It can find out
how big the terminal is, and so can adjust itself. In the auto_view
case, however, elinks doesn't have any way to ask the terminal how big
it is, so it has to rely on it's configuration. Specifically, when it
can't find out the width of the terminal, elinks defaults to assuming
standard 80-column output. You can alter that with the -dump-width
flag.
So, the way to get elinks to fill the width is to tell it the width of
the terminal. Now, how you do that is up to you; I would try a
two-pronged approach: first, before you load up mutt, run `export
COLUMNS`, which puts the current terminal size into the environment.
Then use a mailcap line like this:
text/html; elinks -force-html -dump-width $COLUMNS %s;
copiousoutput
Note that if you change terminal size while mutt is open, $COLUMNS
will still be the original value, so it's not a perfect solution. But
it's enough to get by.
The next task is to figure out how to get elinks' colors to be
preserved. The key mutt configuration value here is $allow_ansi.
Default is "no", but if you set it to "yes" then mutt will preserve
the colors in elinks' output. If that doesn't work, it means that
elinks isn't putting the colors into its dump output, so you have to
tell elinks to use colors when printing formatted text to a pipe. The
magic argument you need to pass to elinks is -dump-color-mode.
Unfortunately, as you can see in this bugreport
(http://bugzilla.elinks.cz/show_bug.cgi?id=622), they've only
implemented that flag for the cutting edge 0.12.GIT version of elinks
(it hasn't made it into a stable version of elinks yet). So, if you
REALLY REALLY want color, you can get it, but it'll be a bit of a
pain.
~Kyle
- --
In order to keep a true perspective of one's importance, everyone
should have a dog that will worship him and a cat that will ignore
him.
-- Dereke Bruce
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iEYEARECAAYFAkgZ30MACgkQBkIOoMqOI14N9ACgidZoM4myE0MeeQAXQiV6d0vL
z0YAoJ/i3j6MivsjzoCoMyObTlN1cCWs
=Tw69
-----END PGP SIGNATURE-----