Two questions regarding header display
raf
mutt at raf.org
Sun Jun 5 11:51:29 UTC 2022
On Sun, Jun 05, 2022 at 11:32:34AM +0200, Anton Sharonov <anton.sharonov at gmail.com> wrote:
> raf <mutt at raf.org> schrieb am So., 5. Juni 2022, 07:52:
>
> > On Sun, Jun 05, 2022 at 12:06:52AM -0400, Jason Franklin <jason at oneway.dev>
> > 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
More information about the Mutt-users
mailing list