Re: keep headers fixed in pager

2012-11-13 Thread steve
Le 06-10-2012, à 12:17:08 +0200, Marco Giusti (marco.giu...@gmail.com) a écrit :

 On Wed, Sep 26, 2012 at 10:20:56PM +0200, steve wrote:
  Hi,
  
  Is it possible, while reading a mail, to keep the headers fixed while 
  scrolling
  down the message? I experienced many times when I have to go back to the 
  top of
  the message to see who has been CCied for example. Keeping chosen headers 
  fixed
  would be really useful (in some circumstances).
  I tried to dig the archives for a solution but since I'm not sure I've got 
  the
  right keywords, my search failed.
 
 rough but I think it does what you need, but I would not use it

Thanks Marco, unfortunately I haven't had time yet to dig in your code.


Re: keep headers fixed in pager

2012-10-06 Thread Jamie Paul Griffin
[ Gary Johnson wrote on Fri  5.Oct'12 at 16:14:54 -0700 ]

 On 2012-10-05, Brandon McCaig wrote:
  On Fri, Oct 05, 2012 at 08:40:55AM -0700, Gary Johnson wrote:
   The only headers I usually care about are the sender, subject
   and date/time, and all those are in the status bar at the
   bottom of the screen or in the mini-index at the top.  For the
   rare times when I want to see other header information, I
   scroll or jump to the top of the message.  For more detail I
   hit the 'h' key.  I wouldn't want to lose that vertical space
   all the time.
  
  My status line is at the top of the message. I am assuming we are
  referring to the same thing because at the bottom I don't have
  anything like that (and I can't find an option to configure it;
  correct me if I'm wrong). The default pager_format lacks the date
  and sender address (a name can be useful, but sometimes an E-mail
  is more distinct and/or unique).
 
 My mistake.  I meant pager_format.  I was in a hurry and didn't look
 the name up.
 
 I have my pager configured like this:
 
 Help Line (help is set)
 5 lines of Pager Index (pager_index_lines=6)
 Status Bar/Line (uses status_format)
 Message text
 Message Status Line (uses pager_format)
 Command Line
 
 Where the status line goes can be set with status_on_top, which I
 have left unset.
 
 This is my pager_format:
 
 set pager_format=%4C %Z %[!%b %e at %I:%M %p]  %.20n  %s%* -- (%P)
 
 The line below your message looks like this:
 
 2711  s  Oct  5 at 11:30 AM  Brandon McCaig  Re: keep headers fixed in 
 pager  -- (96%)
 
 I use a wide screen (currently 207 columns) so there is actually a
 lot of space between pager and the --.
 
 Regards,
 Gary


Have a look, if you would like, at RadoS' configuration which is linked to on 
the mutt wiki [1] where columns and rows are set up using a wrapper script. I 
very much liked this idea when I saw it and so I have 'borrowed' a number of 
techniques he uses. It provides a nice layout for different formats, 
$status_format being one them and it avoids the large space issue (if it is an 
issue for you, it might not be of course) between certain elements of the 
status bar.

The wrapper script idea is a gerat way to define certain attributes before mutt 
starts. The script shown on Rados page is written in ksh but i use bash and 
those principal ideas work well in that shell too. I do prefer ksh, and have 
used it for years but I'm having to learn bash ATM for some other reason so 
i've switched. Gary's and others' tips on that wiki are also useful I should 
add. Definitely have a look.

It's not a good idea to just copy and paste things though, at risk of sounding 
patronsing, you would need to look up the relevent configuration aspects in the 
man pages and manual so you can then make informed alterations to suit your 
set-up. 

Unlike Gary, I have unset $help and have my status on top which for me displays 
nicely.

[1] http://xblast.sourceforge.net/rado/mutt/


Re: keep headers fixed in pager

2012-10-06 Thread Marco Giusti
On Wed, Sep 26, 2012 at 10:20:56PM +0200, steve wrote:
 Hi,
 
 Is it possible, while reading a mail, to keep the headers fixed while 
 scrolling
 down the message? I experienced many times when I have to go back to the top 
 of
 the message to see who has been CCied for example. Keeping chosen headers 
 fixed
 would be really useful (in some circumstances).
 I tried to dig the archives for a solution but since I'm not sure I've got the
 right keywords, my search failed.

rough but I think it does what you need, but I would not use it

m

#!/usr/bin/env python
# vim: set encoding=utf8 :

import sys
import curses


KEY_UP = (curses.KEY_UP, ord('k'))
KEY_DOWN = (curses.KEY_DOWN, ord('j'))
KEY_LEFT = (curses.KEY_LEFT, ord('h'))
KEY_RIGHT = (curses.KEY_RIGHT, ord('l'))


def print_body(pager, body_l, r, c, y=0, x=0):
pager.erase()
for i, line in enumerate(body_l[y:r+y]):
pager.addstr(i, 0, line[x:c+x])
pager.refresh()


def do(stdscr):
with open(sys.argv[1]) as fp:
email = fp.read()
status, headers, body = email.split('\n\n', 2)
headers_l = headers.split('\n')
body_l = body.split('\n')
y, x = stdscr.getmaxyx()
num_h = len(headers_l)
num_b = len(body_l)
r, c = y - num_h - 1, x
# maxx = max(map(len, body_l))
pager = stdscr.subpad(r, c, num_h+1, 0)
for i, line in enumerate(headers_l):
stdscr.addstr(i, 0, line)
stdscr.refresh()

cur_line = 0
cur_col = 0
touched = True

while 1:
if touched:
print_body(pager, body_l, r, c, cur_line, cur_col)
touched = False
ch = stdscr.getch()
if ch == ord('q'):
break
elif ch in KEY_DOWN:
if cur_line  num_b - r:
cur_line += 1
touched = True
elif ch in KEY_UP:
if cur_line  0:
cur_line -= 1
touched = True
elif ch in KEY_LEFT:
if cur_col  0:
cur_col -= 1
touched = True
elif ch in KEY_RIGHT:
cur_col += 1
touched = True


curses.wrapper(do)


Re: keep headers fixed in pager

2012-10-05 Thread steve
Hi Adam,

Thank you for your answer.

But your suggestion seems (unfortunately) much too complicated for me. I guess
I'll have to live with this. But I'm curious to know how people deal with the
issue I raised. Do people simply scroll back to the top to get this info ? Just
curious.

Have a nice day,
steve


Re: keep headers fixed in pager

2012-10-05 Thread Brandon McCaig
On Fri, Oct 05, 2012 at 04:04:54PM +0200, steve wrote:
 But your suggestion seems (unfortunately) much too complicated
 for me. I guess I'll have to live with this. But I'm curious to
 know how people deal with the issue I raised. Do people simply
 scroll back to the top to get this info ? Just curious.

I usually do. There is a top command, and I think the default
mapping is to the ^ character. So if you type ^ then you should
jump to the top in one keypress. I think the mapping is different
in the index though. I usually end up experimenting with all
possibilities when I want to jump to the top where ever I am in
mutt... :P

Regards,


-- 
Brandon McCaig bamcc...@gmail.com bamcc...@castopulence.org
Castopulence Software https://www.castopulence.org/
Blog http://www.bamccaig.com/
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'



signature.asc
Description: Digital signature


Re: keep headers fixed in pager

2012-10-05 Thread Gary Johnson
On 2012-10-05, steve wrote:
 Hi Adam,
 
 Thank you for your answer.
 
 But your suggestion seems (unfortunately) much too complicated for me. I guess
 I'll have to live with this. But I'm curious to know how people deal with the
 issue I raised. Do people simply scroll back to the top to get this info ? 
 Just
 curious.

The only headers I usually care about are the sender, subject and
date/time, and all those are in the status bar at the bottom of the
screen or in the mini-index at the top.  For the rare times when I
want to see other header information, I scroll or jump to the top of
the message.  For more detail I hit the 'h' key.  I wouldn't want to
lose that vertical space all the time.

Regards,
Gary



Re: keep headers fixed in pager

2012-10-05 Thread Brandon McCaig
On Fri, Oct 05, 2012 at 08:40:55AM -0700, Gary Johnson wrote:
 The only headers I usually care about are the sender, subject
 and date/time, and all those are in the status bar at the
 bottom of the screen or in the mini-index at the top.  For the
 rare times when I want to see other header information, I
 scroll or jump to the top of the message.  For more detail I
 hit the 'h' key.  I wouldn't want to lose that vertical space
 all the time.

My status line is at the top of the message. I am assuming we are
referring to the same thing because at the bottom I don't have
anything like that (and I can't find an option to configure it;
correct me if I'm wrong). The default pager_format lacks the date
and sender address (a name can be useful, but sometimes an E-mail
is more distinct and/or unique).

My default seems to be this:

:set pager_format=-%Z- %C/%m: %-20.20n   %s%*  -- (%P)

Since I have relatively wide displays ordinarily I'm going to try
the following for a while and see how I like it:

:set pager_format=-%Z- %C/%m %e/%E %D %.20F %.20a   %s%*  -- (%P)

It's based on the default, but adds %e/%E (for thread
position), %D (for the date in local time), and replaces %-20.20n
(which is ordinarily the author's name) with %.20F %.20a (which is
either the author's or recipients name, depending on context,
followed by the the author's address in angle brackets[1]).

[1] There doesn't seem to be a context sensitive option to switch
between author and recipient.

I wouldn't say it's ideal, and I may need to tweak my .muttrc on
certain platforms (i.e., my EeePC, which I rarely use) in order
to see the subject, but it will hopefully save me time scrolling.
:) I'll have to try it out for a while to know if I like it, I
guess. It might be nice for some long time mutt users to post
their ideal pager_format. :)

Regards,


-- 
Brandon McCaig bamcc...@gmail.com bamcc...@castopulence.org
Castopulence Software https://www.castopulence.org/
Blog http://www.bamccaig.com/
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'



signature.asc
Description: Digital signature


Re: keep headers fixed in pager

2012-10-05 Thread Gary Johnson
On 2012-10-05, Brandon McCaig wrote:
 On Fri, Oct 05, 2012 at 08:40:55AM -0700, Gary Johnson wrote:
  The only headers I usually care about are the sender, subject
  and date/time, and all those are in the status bar at the
  bottom of the screen or in the mini-index at the top.  For the
  rare times when I want to see other header information, I
  scroll or jump to the top of the message.  For more detail I
  hit the 'h' key.  I wouldn't want to lose that vertical space
  all the time.
 
 My status line is at the top of the message. I am assuming we are
 referring to the same thing because at the bottom I don't have
 anything like that (and I can't find an option to configure it;
 correct me if I'm wrong). The default pager_format lacks the date
 and sender address (a name can be useful, but sometimes an E-mail
 is more distinct and/or unique).

My mistake.  I meant pager_format.  I was in a hurry and didn't look
the name up.

I have my pager configured like this:

Help Line (help is set)
5 lines of Pager Index (pager_index_lines=6)
Status Bar/Line (uses status_format)
Message text
Message Status Line (uses pager_format)
Command Line

Where the status line goes can be set with status_on_top, which I
have left unset.

This is my pager_format:

set pager_format=%4C %Z %[!%b %e at %I:%M %p]  %.20n  %s%* -- (%P)

The line below your message looks like this:

2711  s  Oct  5 at 11:30 AM  Brandon McCaig  Re: keep headers fixed in 
pager  -- (96%)

I use a wide screen (currently 207 columns) so there is actually a
lot of space between pager and the --.

Regards,
Gary



Re: keep headers fixed in pager

2012-10-02 Thread steve
Hi again,

Is my question so obvious or is it simply not possible?

Thank you

Le 26-09-2012, à 22:20:56 +0200, steve (dl...@bluewin.ch) a écrit :

 Hi,
 
 Is it possible, while reading a mail, to keep the headers fixed while 
 scrolling
 down the message? I experienced many times when I have to go back to the top 
 of
 the message to see who has been CCied for example. Keeping chosen headers 
 fixed
 would be really useful (in some circumstances).
 I tried to dig the archives for a solution but since I'm not sure I've got the
 right keywords, my search failed.
 
 Thank in advance for your help.
 
 steve
 


Re: keep headers fixed in pager

2012-10-02 Thread Cameron Simpson
On 02Oct2012 08:34, steve dl...@bluewin.ch wrote:
| Is my question so obvious or is it simply not possible?

I think it is not possible. It seems to me that mutt pages the output of
$display_filter, which includes the message headers. Very cool if you
want to filter the displayed headers, but inflexible with respect to
your wish.
-- 
Cameron Simpson c...@zip.com.au

Who is the happier man, he who has braved the storm of life and lived, or he
who has stayed securely on shore and merely existed?
- Hunter S. Thompson, age seventeen


Re: keep headers fixed in pager

2012-10-02 Thread steve
Le 02-10-2012, à 17:34:25 +1000, Cameron Simpson (c...@zip.com.au) a écrit :

 On 02Oct2012 08:34, steve dl...@bluewin.ch wrote:
 | Is my question so obvious or is it simply not possible?
 
 I think it is not possible. It seems to me that mutt pages the output of
 $display_filter, which includes the message headers. Very cool if you
 want to filter the displayed headers, but inflexible with respect to
 your wish.

Ok, too bad.

Thank you for your answer.

steve


Re: keep headers fixed in pager

2012-10-02 Thread Peter Davis
On Tue, Oct 02, 2012 at 01:21:13PM +0200, steve wrote:
 Le 02-10-2012, à 17:34:25 +1000, Cameron Simpson (c...@zip.com.au) a écrit :
 
  On 02Oct2012 08:34, steve dl...@bluewin.ch wrote:
  | Is my question so obvious or is it simply not possible?
  
  I think it is not possible. It seems to me that mutt pages the output of
  $display_filter, which includes the message headers. Very cool if you
  want to filter the displayed headers, but inflexible with respect to
  your wish.
 
 Ok, too bad.

You could write your own pager and tell mutt to use that instead of the
built-in one, but that may be more effort than it's worth. (I don't know
what it's worth to you.)

-pd


-- 

Peter Davis
 The Tech Curmudgeon - http://www.techcurmudgeon.com


Re: keep headers fixed in pager

2012-10-02 Thread Adam Wellings

Hello,

I've not tried this, but you could set mutt to use an external pager and set
that up to do it. Off the top of my head, you could call vim in read only mode,
with a special set-up that loads the email into a split screen with the cursor
in the lower one. Then as you scroll down the upper screen would stay at the
top, on the headers. 


You could also set this up bound to a separate key so that the standard
behaviour remains - will need to use macro for that I think.  Might take a bit
of work to do though and how easy it is will depend on how well you know vim (or
whatever pager you choose).

The mutt config variable is Pager.

Cheers,
Adam


* steve (dl...@bluewin.ch) wrote:

Hi again,

Is my question so obvious or is it simply not possible?

Thank you

Le 26-09-2012, à 22:20:56 +0200, steve (dl...@bluewin.ch) a écrit :


Hi,

Is it possible, while reading a mail, to keep the headers fixed while scrolling
down the message? I experienced many times when I have to go back to the top of
the message to see who has been CCied for example. Keeping chosen headers fixed
would be really useful (in some circumstances).
I tried to dig the archives for a solution but since I'm not sure I've got the
right keywords, my search failed.

Thank in advance for your help.

steve



Re: keep headers fixed in pager

2012-10-02 Thread steve
Le 02-10-2012, à 10:31:42 -0400, Peter Davis (p...@pfdstudio.com) a écrit :

 On Tue, Oct 02, 2012 at 01:21:13PM +0200, steve wrote:
  Le 02-10-2012, à 17:34:25 +1000, Cameron Simpson (c...@zip.com.au) a écrit :
  
   On 02Oct2012 08:34, steve dl...@bluewin.ch wrote:
   | Is my question so obvious or is it simply not possible?
   
   I think it is not possible. It seems to me that mutt pages the output of
   $display_filter, which includes the message headers. Very cool if you
   want to filter the displayed headers, but inflexible with respect to
   your wish.
  
  Ok, too bad.
 
 You could write your own pager and tell mutt to use that instead of the
 built-in one, but that may be more effort than it's worth. (I don't know
 what it's worth to you.)

I dream I could :)


Re: keep headers fixed in pager

2012-09-27 Thread steve
  Is it possible, while reading a mail, to keep the headers fixed while 
  scrolling
  down the message? I experienced many times when I have to go back to the 
  top of
  the message to see who has been CCied for example. Keeping chosen headers 
  fixed
  would be really useful (in some circumstances).
 
 Could maybe changing “pager_format” resolve your problem?

I don't see how it could. Would you please suggest an example ?


keep headers fixed in pager

2012-09-26 Thread steve
Hi,

Is it possible, while reading a mail, to keep the headers fixed while scrolling
down the message? I experienced many times when I have to go back to the top of
the message to see who has been CCied for example. Keeping chosen headers fixed
would be really useful (in some circumstances).
I tried to dig the archives for a solution but since I'm not sure I've got the
right keywords, my search failed.

Thank in advance for your help.

steve


Re: keep headers fixed in pager

2012-09-26 Thread P. Mazart
Hi,

steve schrieb am 26.09.2012 22:20:56:
 Is it possible, while reading a mail, to keep the headers fixed while 
 scrolling
 down the message? I experienced many times when I have to go back to the top 
 of
 the message to see who has been CCied for example. Keeping chosen headers 
 fixed
 would be really useful (in some circumstances).

Could maybe changing “pager_format” resolve your problem?

P.M.