Re: Two questions regarding header display

2022-06-20 Thread raf via Mutt-users
On Mon, Jun 20, 2022 at 08:15:13AM +1000, Cameron Simpson  
wrote:

> On 07Jun2022 09:56, raf  wrote:
> >And I'm not sure I can do anything about it.
> 
> There are many things you can do. I see you've already shifted to just 
> using "bold" etc in your color directives, but also:
> - run a personal terminfo record without the color capabilities; 
>   decompile the provided terminfo with untic, edit to remove the colours 
>   (or change the colours to "mono" escape sequences, build new entry 
>   with tic, set $TERMINFO to refer to it
> - run mutt itself from a script or alias which sets $TERM just for mutt 
>   i.e. overriding the $TERM provided by screen (which will be describing 
>   the terminal capabilities of screen itself)
> - switch from screen to tmux
> 
> Cheers,
> Cameron Simpson 

Thanks.

cheers,
raf



Re: Two questions regarding header display

2022-06-20 Thread Patrick Shanahan
* Bastian  [06-20-22 08:33]:
> I did not follow the entire thread, sorry for potential double post.
> On 20Jun22 08:15+1000, Cameron Simpson wrote:
> > On 07Jun2022 09:56, raf  wrote:
> > >And I'm not sure I can do anything about it.
> > There are many things you can do. I see you've already shifted to just 
> > using "bold" etc in your color directives, but also:
> 
> On my systems, mutt is built and linked against ncurses. I could not 
> make it use 256 colors. I do not recall where, but I read somewhere on 
> the internet (and thus it must be true :) ) that mutt needs to be built 
> against slang to support 256 colors. I never tried that actually and I 
> just accept to only have the 16 default colors set in my Xdefaults.
> Of course this might be total nonsense.

my mutt is built against ncurses 6.3.20220612
and I have 256 colors

mutt -v |grep -i color
+HAVE_COLOR  +HAVE_START_COLOR


-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  @ptilopteri
http://en.opensuse.orgopenSUSE Community Memberfacebook/ptilopteri
Photos: http://wahoo.no-ip.org/piwigo   paka @ IRCnet oftc


Re: Two questions regarding header display

2022-06-19 Thread Cameron Simpson
On 07Jun2022 09:56, raf  wrote:
>And I'm not sure I can do anything about it.

There are many things you can do. I see you've already shifted to just 
using "bold" etc in your color directives, but also:
- run a personal terminfo record without the color capabilities; 
  decompile the provided terminfo with untic, edit to remove the colours 
  (or change the colours to "mono" escape sequences, build new entry 
  with tic, set $TERMINFO to refer to it
- run mutt itself from a script or alias which sets $TERM just for mutt 
  i.e. overriding the $TERM provided by screen (which will be describing 
  the terminal capabilities of screen itself)
- switch from screen to tmux

Cheers,
Cameron Simpson 


Re: Two questions regarding header display

2022-06-18 Thread Anton Sharonov
> > raf  schrieb am Di., 7. Juni 2022, 01:57:
> > 
> > > TERM=screen.
> > >
> > > It's OK. screen is more important to me than bold
> > > headers.
> > >
> > 

> On Wed, Jun 08, 2022 at 12:23:07AM +0200, Anton Sharonov 
>  wrote:
> 
> > ... Gnu screen definitely supports bold if running on
> > xterm...
> > ...not configured in mutt yet by
> > now...

Reply was from handheld. Now more precise: headers in
compose menu, current message in index, status line and top bar
in index - all are displayed bold for me.

> > TERM value is screen-bce for me. It has to be supported by
> > corresponding terminfo entry.

That was wrong info: only TERM=xterm-256color works for me.
Any other TERM value lead to no bold, not even simple colors
are displayed in mutt (via gnu-screen or directly in xterm).

> > There is a bunch of color related settings in
> > .screenrc on my end as well. Even italic works in xterm+gnu screen but for
> > italic you would need to compile not yet released dev version of gnu screen
> > (last time checked in 2021, may be they even  released since then already)

gnu-screen has italic support (which can be seen in vim for
example when edit markdown file with syntax enabled) at least in
version compiled from https://git.savannah.gnu.org/git/screen.git
master (pre 5.0 branch?),
f0d6154b95075f1e1198cd1fd12f7516cca57add (Date: Mon Apr 27
18:24:37 2020 +0200). Still no 5.0 tag in git.  Most recent
v4.9.0 version branch has _lot_ of commits which are not on
master at all, may be meanwhile has even italic support merged
in.

On Wed, Jun 08, 2022 at 11:18:22AM +1000, raf wrote:
> 
> Thanks. It'll probably work if I just switch from "mono"
> directives to "color" directives and tell it to use bold
> and default colours. Yep, that did it:
> 
>   color header bold default default ^(Subject|From|To|Cc|Date):
> 
> cheers,
> raf
> 

Everything with "bold" on my end:

  color header bold color25 color252 "^(Date:|To:|From:|CC:)"
  color header bold color133 color252 "^Subject:"
  color indicator bold color16 color153
  color status bold color16 color153

cheers,
Anton



Re: Two questions regarding header display

2022-06-07 Thread raf
On Wed, Jun 08, 2022 at 12:23:07AM +0200, Anton Sharonov 
 wrote:

> raf  schrieb am Di., 7. Juni 2022, 01:57:
> 
> > TERM=screen.
> >
> > It's OK. screen is more important to me than bold
> > headers.
> >
> 
> Don't give up. Gnu screen definitely supports bold if running on xterm, i
> see it all the time - in my vim at least, not configured in mutt yet by
> now. TERM value is screen-bce for me. It has to be supported by
> corresponding terminfo entry. There is a bunch of color related settings in
> .screenrc on my end as well. Even italic works in xterm+gnu screen but for
> italic you would need to compile not yet released dev version of gnu screen
> (last time checked in 2021, may be they even  released since then already)
> 
> Cheers, Anton

Thanks. It'll probably work if I just switch from "mono"
directives to "color" directives and tell it to use bold
and default colours. Yep, that did it:

  color header bold default default ^(Subject|From|To|Cc|Date):

cheers,
raf



Re: Two questions regarding header display

2022-06-07 Thread Anton Sharonov
raf  schrieb am Di., 7. Juni 2022, 01:57:

> TERM=screen.
>
> It's OK. screen is more important to me than bold
> headers.
>

Don't give up. Gnu screen definitely supports bold if running on xterm, i
see it all the time - in my vim at least, not configured in mutt yet by
now. TERM value is screen-bce for me. It has to be supported by
corresponding terminfo entry. There is a bunch of color related settings in
.screenrc on my end as well. Even italic works in xterm+gnu screen but for
italic you would need to compile not yet released dev version of gnu screen
(last time checked in 2021, may be they even  released since then already)

Cheers, Anton


Re: Two questions regarding header display

2022-06-06 Thread raf
On Mon, Jun 06, 2022 at 09:53:35AM -0700, "Kevin J. McCarthy"  
wrote:

> On Tue, Jun 07, 2022 at 12:37:59AM +1000, raf wrote:
> > On Sun, Jun 05, 2022 at 07:02:24PM -0700, "Kevin J. McCarthy" 
> >  wrote:
> > > TERM=xterm-mono might work for you
> > 
> > Thanks, but that didn't change it.
> 
> Interesting.  It works for me, at least on Debian in an xterm.
> 
> You may want to check your terminfo entries, e.g. what do "infocmp xterm |
> grep color" and "infocmp xterm-mono | grep color" return?
> 
> -- 
> Kevin J. McCarthy
> GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

I always assumed that xterm was mono because of the
existence of xterm-color. I should mention that I run
xterm with the resource XTerm*colorMode: False

  > infocmp xterm-color | grep color
colors#8, cols#80, it#8, lines#24, ncv@, pairs#64,
  > infocmp xterm | grep color
colors#8, cols#80, it#8, lines#24, pairs#64,
  > infocmp xterm-mono | grep color

I can see what's breaking it for me. I always run mutt
with -n via an alias. If I don't use -n then bold in
xterm-mono works. But if I do use -n then the currently
selected message doesn't appear in reverse video in the
index, so I can't easily tell which one is selected. If
I comment out everything in /etc/Muttrc.d/colors.rc
(this is on Debian11), then it's fine, and the reverse
video and bold work.

But the screen program is also (mostly) to blame. I
thought it odd that color directives in the system
config would affect xterm-mono, and when I uncommented
them again, it still worked (unlike my original
report). But my alias is actually alias m='screen mutt
-n', and within screen, the TERM variable is set to
"screen". That's the real reason that setting
TERM=xterm-mono didn't work - it was being discarded by
screen.

And I'm not sure I can do anything about it. If I
create a script to set TERM=xterm-mono and then run
mutt, and then run that script via screen, screen
terminates immediately. It must really want
TERM=screen.

It's OK. screen is more important to me than bold
headers.

Thanks.

cheers,
raf



Re: Two questions regarding header display

2022-06-06 Thread Kevin J. McCarthy

On Tue, Jun 07, 2022 at 12:37:59AM +1000, raf wrote:

On Sun, Jun 05, 2022 at 07:02:24PM -0700, "Kevin J. McCarthy"  
wrote:

TERM=xterm-mono might work for you


Thanks, but that didn't change it.


Interesting.  It works for me, at least on Debian in an xterm.

You may want to check your terminfo entries, e.g. what do 
"infocmp xterm | grep color" and "infocmp xterm-mono | grep color" 
return?


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Two questions regarding header display

2022-06-06 Thread raf
On Sun, Jun 05, 2022 at 07:02:24PM -0700, "Kevin J. McCarthy"  
wrote:

> On Mon, Jun 06, 2022 at 10:57:47AM +1000, raf wrote:
> > And there's also the "mono" directive for terminals that
> > don't support colour, e.g.:
> > 
> >  mono header bold ^(Subject|From|To|Cc|Date):
> > 
> > But it doesn't work for me anymore (with TERM=xterm).
> 
> TERM=xterm-mono might work for you

Thanks, but that didn't change it.

> > And it would bold entire headers, not just their names.
> 
> "color header bold default default ^(Subject|From|To|Cc|Date):"
> will work the same, with $header_color_partial unset (the default).
> 
> -- 
> Kevin J. McCarthy
> GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA



Re: Two questions regarding header display

2022-06-05 Thread Kevin J. McCarthy

On Mon, Jun 06, 2022 at 10:57:47AM +1000, raf wrote:

And there's also the "mono" directive for terminals that
don't support colour, e.g.:

 mono header bold ^(Subject|From|To|Cc|Date): 


But it doesn't work for me anymore (with TERM=xterm).


TERM=xterm-mono might work for you


And it would bold entire headers, not just their names.


"color header bold default default ^(Subject|From|To|Cc|Date):"
will work the same, with $header_color_partial unset (the default).

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Two questions regarding header display

2022-06-05 Thread raf
On Sun, Jun 05, 2022 at 09:33:43AM -0700, "Kevin J. McCarthy"  
wrote:

> On Sun, Jun 05, 2022 at 10:24:47AM -0400, Jason Franklin wrote:
> > On Sun, Jun 05, 2022 at 09:26:04AM +0200, Jakub Jindra wrote:
> > > set header_color_partial = yes
> > > color hdrdefault FG  BG
> > > color header FG  BG  "REGEX"
> > > color header FG1 BG1 "REGEX1"
> > > 
> > > tune the colors FG, BG and REGEX to your needs.
> > 
> > I came across that option in the manual, but I couldn't make it work at
> > the time. I will have to play around with it a bit.
> 
> See http://www.mutt.org/relnotes/1.9/ for a sample usage.
> 
> Also note, starting with 1.12 you can add attributes before the color name.
> 
> For example, to *only* make the headers bold:
> 
> set header_color_partial
> color header bold default default '^[^[:blank:]:]*:'
> 
> -- 
> Kevin J. McCarthy
> GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

And there's also the "mono" directive for terminals that
don't support colour, e.g.:

  mono header bold ^(Subject|From|To|Cc|Date):

But it doesn't work for me anymore (with TERM=xterm).
I don't know why that is. I think it must have worked in the
past. I just "ignore" the headers I don't want to see so
it's not really a problem.

And it would bold entire headers, not just their names.

cheers,
raf



Re: Two questions regarding header display

2022-06-05 Thread Kevin J. McCarthy

On Sun, Jun 05, 2022 at 10:24:47AM -0400, Jason Franklin wrote:

On Sun, Jun 05, 2022 at 09:26:04AM +0200, Jakub Jindra wrote:

set header_color_partial = yes
color hdrdefault FG  BG
color header FG  BG  "REGEX"
color header FG1 BG1 "REGEX1"

tune the colors FG, BG and REGEX to your needs.


I came across that option in the manual, but I couldn't make it work at
the time. I will have to play around with it a bit.


See http://www.mutt.org/relnotes/1.9/ for a sample usage.

Also note, starting with 1.12 you can add attributes before the color 
name.


For example, to *only* make the headers bold:

set header_color_partial
color header bold default default '^[^[:blank:]:]*:'

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Two questions regarding header display

2022-06-05 Thread Jason Franklin
On Sun, Jun 05, 2022 at 09:26:04AM +0200, Jakub Jindra wrote:
> Hi Jason,
> 
> You're looking for config option [1]header_color_partial
> 
> 1. http://www.mutt.org/doc/manual/#header-color-partial
> 
> set header_color_partial = yes
> color hdrdefault FG  BG
> color header FG  BG  "REGEX"
> color header FG1 BG1 "REGEX1"
> 
> tune the colors FG, BG and REGEX to your needs.

I came across that option in the manual, but I couldn't make it work at
the time. I will have to play around with it a bit.

At least I was looking in the right place.

Thanks, Jakub!

-- 
Jason


Re: Two questions regarding header display

2022-06-05 Thread Jason Franklin
On Sun, Jun 05, 2022 at 09:51:29PM +1000, raf wrote:
> On Sun, Jun 05, 2022 at 11:32:34AM +0200, Anton Sharonov 
>  wrote:
> > Will usage of display_filter option with your perl script below not be
> > already sufficient solution even without procmail?
> 
> Good thinking. I just tried it and it works great.
> 
>  set display_filter = /home/me/bin/fix-mail-headers-filter

This is really helpful!

Many thanks to Anton and raf. :)

-- 
Jason


Re: Two questions regarding header display

2022-06-05 Thread raf
On Sun, Jun 05, 2022 at 11:32:34AM +0200, Anton Sharonov 
 wrote:

> raf  schrieb am So., 5. Juni 2022, 07:52:
> 
> > On Sun, Jun 05, 2022 at 12:06:52AM -0400, Jason Franklin 
> > wrote:
> >
> > > Greetings:
> > >
> > > I have two questions regarding header display...
> > >
> > > First, can the pager display header names in bold if the terminal
> > > supports it?
> > >
> > > Second some senders have weird capitalization of headers. Is it possible
> > > to display some canonical representation of any given standard header?
> > >
> > > To clarify, if the header is sent as "reply-to", I would like to always
> > > see "Reply-To" in the pager.
> > >
> > > Thanks!
> > >
> > > --
> > > Jason
> >
> > Hi, I don't know about the first part, but the second part
> > could be done if procmail or similar is used for local
> > delivery, and it passes incoming messages through a filter
> > to "correct" the headers to your liking. But it might
> > be a hassle if you aren't already using procmail.
> >
> 
> Will usage of display_filter option with your perl script below not be
> already sufficient solution even without procmail?

Good thinking. I just tried it and it works great.

 set display_filter = /home/me/bin/fix-mail-headers-filter

But the script needs a fix to prevent changing the From_ mbox header:

/home/me/bin/fix-mail-headers-filter:

  #!/usr/bin/env perl
  use warnings;
  use strict;
  # Modify headers if needed (e.g. "reply-to:" to "Reply-To:")
  while (<>)
  {
# Skip to the following trivial loop after headers
print, last if /^$/;
# Replace lowercase at start of word before colon with uppercase
s/^([^: ]*)\b([a-z])/$1\U$2/ while /^[^: ]*\b[a-z]/;
print;
  }
  # Just print the rest unchanged
  print while (<>);

> > The above was barely tested. Don't use it without testing it on
> > lots of existing mail (one message at a time - see formail(1))
> > until you are sure that it works. And note that it doesn't
> > convert any uppercase to lowercase, only the other way around.
> >
> > cheers,
> > raf


Re: Two questions regarding header display

2022-06-05 Thread Anton Sharonov
raf  schrieb am So., 5. Juni 2022, 07:52:

> On Sun, Jun 05, 2022 at 12:06:52AM -0400, Jason Franklin 
> wrote:
>
> > Greetings:
> >
> > I have two questions regarding header display...
> >
> > First, can the pager display header names in bold if the terminal
> > supports it?
> >
> > Second some senders have weird capitalization of headers. Is it possible
> > to display some canonical representation of any given standard header?
> >
> > To clarify, if the header is sent as "reply-to", I would like to always
> > see "Reply-To" in the pager.
> >
> > Thanks!
> >
> > --
> > Jason
>
> Hi, I don't know about the first part, but the second part
> could be done if procmail or similar is used for local
> delivery, and it passes incoming messages through a filter
> to "correct" the headers to your liking. But it might
> be a hassle if you aren't already using procmail.
>

Will usage of display_filter option with your perl script below not be
already sufficient solution even without procmail?



> ~/.procmailrc:
>
>   :0 fw
>   | /home/me/bin/fix-mail-headers-filter
>
> /home/me/bin/fix-mail-headers-filter:
>
>   #!/usr/bin/env perl
>   use warnings;
>   use strict;
>   # Modify headers if needed (e.g. "reply-to:" to "Reply-To:")
>   while (<>)
>   {
> # Skip to the following trivial loop after headers
> print, last if /^$/;
> # Replace lowercase at start of word before colon with uppercase
> s/^([^:]*)\b([a-z])/$1\U$2/ while /^[^:]*\b[a-z]/;
> print;
>   }
>   # Jut print the rest unchanged
>   print while (<>);
>
> The above was barely tested. Don't use it without testing it on
> lots of existing mail (one message at a time - see formail(1))
> until you are sure that it works. And note that it doesn't
> convert any uppercase to lowercase, only the other way around.
>
> cheers,
> raf
>
>


Re: Two questions regarding header display

2022-06-05 Thread Jakub Jindra

Hi Jason,

You're looking for config option [1]header_color_partial

1. http://www.mutt.org/doc/manual/#header-color-partial

set header_color_partial = yes
color hdrdefault FG  BG
color header FG  BG  "REGEX"
color header FG1 BG1 "REGEX1"

tune the colors FG, BG and REGEX to your needs.

Best,
JJ

On 2022-06-05 00:06, Jason Franklin wrote:

Greetings:

I have two questions regarding header display...

First, can the pager display header names in bold if the terminal
supports it?

Second some senders have weird capitalization of headers. Is it possible
to display some canonical representation of any given standard header?

To clarify, if the header is sent as "reply-to", I would like to always
see "Reply-To" in the pager.

Thanks!

--
Jason


--
Jakub Jindra


signature.asc
Description: PGP signature


Re: Two questions regarding header display

2022-06-04 Thread raf
On Sun, Jun 05, 2022 at 12:06:52AM -0400, Jason Franklin  
wrote:

> Greetings:
> 
> I have two questions regarding header display...
> 
> First, can the pager display header names in bold if the terminal
> supports it?
> 
> Second some senders have weird capitalization of headers. Is it possible
> to display some canonical representation of any given standard header?
> 
> To clarify, if the header is sent as "reply-to", I would like to always
> see "Reply-To" in the pager.
> 
> Thanks!
> 
> -- 
> Jason

Hi, I don't know about the first part, but the second part
could be done if procmail or similar is used for local
delivery, and it passes incoming messages through a filter
to "correct" the headers to your liking. But it might
be a hassle if you aren't already using procmail.

~/.procmailrc:

  :0 fw
  | /home/me/bin/fix-mail-headers-filter

/home/me/bin/fix-mail-headers-filter:

  #!/usr/bin/env perl
  use warnings;
  use strict;
  # Modify headers if needed (e.g. "reply-to:" to "Reply-To:")
  while (<>)
  {
# Skip to the following trivial loop after headers
print, last if /^$/;
# Replace lowercase at start of word before colon with uppercase
s/^([^:]*)\b([a-z])/$1\U$2/ while /^[^:]*\b[a-z]/;
print;
  }
  # Jut print the rest unchanged
  print while (<>);

The above was barely tested. Don't use it without testing it on
lots of existing mail (one message at a time - see formail(1))
until you are sure that it works. And note that it doesn't
convert any uppercase to lowercase, only the other way around.

cheers,
raf



Two questions regarding header display

2022-06-04 Thread Jason Franklin
Greetings:

I have two questions regarding header display...

First, can the pager display header names in bold if the terminal
supports it?

Second some senders have weird capitalization of headers. Is it possible
to display some canonical representation of any given standard header?

To clarify, if the header is sent as "reply-to", I would like to always
see "Reply-To" in the pager.

Thanks!

-- 
Jason