On Mon, Apr 24, 2017 at 11:33:20AM +0200, Vincent Lefevre wrote:
> On 2017-04-23 09:59:33 -0500, Derek Martin wrote:
> > Although, I don't really get why Mutt needs a feature for this, when
> > you can just set the environment variables in... the environment.
> > Before starting Mutt.
> 
> This is not just possible for all of them. One problem is COLUMNS,
> which may be needed for filters not attached to the terminal.

I don't get it...  I'm not sure how COLUMNS is even useful to filters
that aren't attached to the terminal.  And if they are, they should be
able to get the terminal's dimensions.  But, for the sake of argument:

$ cat ~/prog/termsize 
#!/bin/sh
echo "lines = $LINES; cols = $COLUMNS"

$ export LINES COLUMNS
$ ~/prog/termsize
lines = 24; cols = 129
$ echo $TERM
screen
$ mutt

Then, from within mutt, execute ~/prog/termsize:

---Mutt: =Mailbox [Msgs:40 Flag:1  Post:1 Inc:13 
5.0M]-----------------------------------------------------(sanitized)---
lines = 24; cols = 129
Press any key to continue...

COLUMNS and LINES are not usually automaically exported by the shell,
but once you export them, the shell maintains them when you resize the
terminal window, and children get the most recent values.  In the
past, there were some buggy versions of zsh that failed to do this,
but in short if your shell doesn't it's broken.  Fix it.  

Note:  It's NOT maintained in the children (obviously), so if you
resize your window with Mutt running in it they won't be maintained...
so unless Mutt actually maintains them for you when it receives
SIGWINCH, I'm not sure how this helps...  THAT would make this feature
worthwhile, IMO.

> Another issue is DISPLAY, e.g. when using Mutt in GNU screen or tmux
> together with ssh.

DISPLAY is slightly harder, if you're connecting to an existing screen
session and the value doesn't match what's already exported in the
session, but the same principle applies.  Export it from your shell
and set the value correctly before you start Mutt, and all is well.
I tested that it works, but I'll leave verification to the reader.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

Attachment: pgp5GG8e2qI2l.pgp
Description: PGP signature

Reply via email to