Re: index-format-hook date pattern for current week

2021-11-04 Thread Ed Blackman
On Tue, Aug 31, 2021 at 05:54:23AM -0700, li...@ifohancroft.com wrote:
[...]
> index-format-hook date "~d<1d" "%[%H:%M]" # If it's from today - I only want
> the time
> index-format-hook date "~d<1w" "%[%d %a]" # If it's from this week - I only
> want the day and the date
[...]
> The rest works as I want it to and as I expect it to, besides the week
> pattern. If any email is from the last seven days, it gets caught by the
> week pattern. I don't want that. I want only emails from the current week to
> get caught by the week pattern, not all emails from the last 7 days.
> 
> Here's what is currently happening:
> 
> Today is Tuesday, August 31st. In my email, currently, the oldest email
> being caught by the week pattern is from Wednesday, August 25th.
> 
> Here's what I want to be happening:
> 
> Today is Tuesday, August 31st. In my email, the oldest email that should be
> getting caught by the week pattern should be from Monday, August 30th.

Sorry for the late response, and I don't have a direct answer to your question, 
but since I didn't see any direct answers I figured I'd share my solution that 
might be something that you can adapt.

I use a Mutt pipe variable to let me use a script to set the index format, 
passing the datetime of the message and the current datetime as variables.  I 
then have the script do date calcuations and echo an otherwise fixed index 
format that has a variable date format.

My current script does what your index-format-hook does: shows the weekday name 
if the difference between the message and the current datetime is between 7 and 
1 days.  But since it's a shell script, the test can be changed to something 
else to do what you want.

Despite running the shell script for each visible message, I don't notice any 
slowdown.

Here's an untested patch for what you're asking for, using GNU date supporting 
the %V format string (ISO week number with Monday as the first day of the 
%week).  Note that this runs two more commands ("date" twice) for dates that 
are less than 7 days old.  I doubt that will make it noticibly slower, but test 
it.

Replace
 format="%8[%a %-I%P]" # ' Thu 6pm'

with

 # use week day name only within the same ISO week number, with weeks starting 
on Monday
 if [ "$(date +%V -d "@$now")" = "$(date +%V -d "@$msg_date") ]; then
  format="%8[%a %-I%P]"# ' Thu 6pm'
 else
  format="%8[%b %d]"   # '  Jan 20'
 fi

In ~/.mutt/muttrc:

# Show different date/time formats in index based on message age
# WORKAROUND: '<%s>' used to work, but doesn't in NeoMutt 1.7.2. Width 
specifier fixes.
set index_format="/home/edgewood/.mutt/bin/format_date '%[%s]' '%1<%s>' |"

~/.mutt/bin/format_date:

#!/bin/bash
# format_date
#
# In .muttrc:
# set index_format="/path/to/format_date '%[%s]' '%<%s>' |"
#
# 
http://groups.google.com/group/de.comm.software.mailreader.misc/browse_thread/thread/ab966bddc0b424
 46/421549103438b830?q=#421549103438b830
# via Andreas Kneib 
# mutt-users Message-ID: <20110105233817.ga23...@andreas.kneib.biz>
# Improvements by
# David Champion 
# Ed Blackman 

# 2018-10-24: remove annoying ^N and spaces added by NeoMutt 1.7
# arguments are both epoch seconds, so limiting to just digits is safe

msg_date="${1//[!0-9]}" # datetime of message in local timezone 
in epoch seconds
now="${2//[!0-9]}"  # current time in local timezone in 
epoch seconds
msg_age="$(( ($now - $msg_date) / 86400 ))" # age of message in 
integer days

if [ $msg_age -ge 30 ]; then
 format="%[%m/%d/%y]"  # '01/20/11'
elif [ $msg_age -ge 7 ]; then
 format="%8[%b %d]"# '  Jan 20'
elif [ $msg_age -ge 1 ]; then
 format="%8[%a %-I%P]" # ' Thu 6pm'
else
 format="%[ %_I:%M%P]" # '  6:41pm'
fi

echo "%4C %Z $format %-15.15F (%?l?%4l&%4c?) %?H?[%H]?%s%"

-- 
Ed Blackman


Re: index-format-hook date pattern for current week

2021-08-31 Thread raf
On Tue, Aug 31, 2021 at 05:54:23AM -0700, li...@ifohancroft.com wrote:

> Hi,
> 
> I am using an index-format-hook inside of index_format, to change the way
> the date column is displayed based on how old the email is.
> 
> My current setting is the following:
> 
> # ID, Attachments, Flags, Subject, Correspondent, Date
> set index_format = "%4C %?X?&
> ?%-1.1@replied@%-2.2@encrypted@%-1.1@flagged@ %-92.92s
> %-64.64@correspondent@ %* %10@date@"
> 
> index-format-hook date "~d<1d" "%[%H:%M]" # If it's from today - I only want
> the time
> index-format-hook date "~d<1w" "%[%d %a]" # If it's from this week - I only
> want the day and the date
> index-format-hook date "~d<1y" "%[%b %d]" # If it's from this year, I only
> want the date and the month
> index-format-hook date "~A" "%[%d/%m/%Y]" # If it's from a past year I only
> want the date, the month and the year
> 
> The rest works as I want it to and as I expect it to, besides the week
> pattern. If any email is from the last seven days, it gets caught by the
> week pattern. I don't want that. I want only emails from the current week to
> get caught by the week pattern, not all emails from the last 7 days.
> 
> Here's what is currently happening:
> 
> Today is Tuesday, August 31st. In my email, currently, the oldest email
> being caught by the week pattern is from Wednesday, August 25th.
> 
> Here's what I want to be happening:
> 
> Today is Tuesday, August 31st. In my email, the oldest email that should be
> getting caught by the week pattern should be from Monday, August 30th.
> 
> Is there another week pattern or another pattern in general, that I can use
> to make that happen or perhaps a way to make the current pattern work like
> this?
> 
> Best Regards,
> IFo Hancroft

Perhaps you could use an actual date, and cron a weekly
update to your .muttrc file (and not leave mutt running
for too long).

cheers,
raf



index-format-hook date pattern for current week

2021-08-31 Thread lists

Hi,

I am using an index-format-hook inside of index_format, to change the 
way the date column is displayed based on how old the email is.


My current setting is the following:

# ID, Attachments, Flags, Subject, Correspondent, Date
set index_format = "%4C %?X?&  
?%-1.1@replied@%-2.2@encrypted@%-1.1@flagged@ %-92.92s 
%-64.64@correspondent@ %* %10@date@"


index-format-hook date "~d<1d" "%[%H:%M]" # If it's from today - I only 
want the time
index-format-hook date "~d<1w" "%[%d %a]" # If it's from this week - I 
only want the day and the date
index-format-hook date "~d<1y" "%[%b %d]" # If it's from this year, I 
only want the date and the month
index-format-hook date "~A" "%[%d/%m/%Y]" # If it's from a past year I 
only want the date, the month and the year


The rest works as I want it to and as I expect it to, besides the week 
pattern. If any email is from the last seven days, it gets caught by the 
week pattern. I don't want that. I want only emails from the current 
week to get caught by the week pattern, not all emails from the last 7 
days.


Here's what is currently happening:

Today is Tuesday, August 31st. In my email, currently, the oldest email 
being caught by the week pattern is from Wednesday, August 25th.


Here's what I want to be happening:

Today is Tuesday, August 31st. In my email, the oldest email that should 
be getting caught by the week pattern should be from Monday, August 
30th.


Is there another week pattern or another pattern in general, that I can 
use to make that happen or perhaps a way to make the current pattern 
work like this?


Best Regards,
IFo Hancroft


Index format for subscribed lists

2002-05-03 Thread Joseph Ishac

Hi,

I was just wondering if there was an easy way to show messages as 
arriving from me when coming from a mailing list known to mutt.

For example: (a thread on mutt-users)

What normally happens ...

 555 Apr 10 Some User A(  16) Some topic
 556 r   Apr 10 Some User B(  21) |-
 557 Apr 10 To mutt-users  (  12)   |-
 
What seems logical to me :)
 
 555 Apr 10 Some User A(  16) Some topic
 556 r   Apr 10 Some User B(  21) |-
 557 Apr 10 Joseph (  12)   |-

However mail that isn't sent to a known list still shows up as To
... if it's from me.

Reason for all this being that I would like to be able to quickly
see my messages in a thread, where at the same time still see To
addresses for normal outgoing mail (for folders that hold a copy of my
outgoing mail and such).

Thanks,

-Joseph



Re: Index format

2002-02-07 Thread Gary Johnson

On Wed, Feb 06, 2002 at 05:36:23PM +, Patrick Colbeck wrote:

 Unfortunately I cannot get mutt to recognise the folder hook, no errors
 are generated but there is no change in the index format. If I change
 the global format even with a folder hook . then I do see a change.
 
 I am using Mutt 1.3.22.1i on SuSE 7.2
 
 Here is some of my muttrc (stolen from all over the net)
 
 set folder=~/Mail
 
 #folder-hook . 'set index_format=%4C %Z %{%b %d} %-15.15t (%4l) %s'
 folder-hook . 'set index_format=%4C %Z %{%b %d} %-15.15t (%4l) %t'
 
 either of the two above work and change the index in all mailboxes
 
 folder-hook +Spool/mutt-users my_hdr From: [EMAIL PROTECTED]
 folder-hook +Spool/mutt-users set signature=~/Signatures/bashq.sig
 folder-hook +Spool/mutt-users 'fcc-hook .* +Outgoing/mutt-user
 folder-hook +Outgoing/mutt-users 'set index_format=%4C %Z %{%b %d}
 %-15.15t (%4l) %s'
 
 The above doesnt work in that ~/Mail/Outgoing/mutt-users gets the same
 index as whatever is set as the default for all folders.

The only things wrong I can see are that the line

 folder-hook +Spool/mutt-users 'fcc-hook .* +Outgoing/mutt-user

has only one single-quote and that the line

 folder-hook +Outgoing/mutt-users 'set index_format=%4C %Z %{%b %d}
 %-15.15t (%4l) %s'

wraps.  Otherwise, your use of the folder-hook looks fine, including
putting the default folder-hook first.  You said the index_formats
worked when set directly, so I didn't look closely at those.

HTH,
Gary

-- 
Gary Johnson   | Agilent Technologies
[EMAIL PROTECTED]   | Spokane, Washington, USA
http://www.spocom.com/users/gjohnson/mutt/ |



Re: Index format

2002-02-07 Thread David T-G

Patrick --

...and then Patrick Colbeck said...
% 
% Hi

Hello!


% 
% I am trying to use a folder hook to change the index format. I want my
% sent mail typpe folders to display who the mail was sent to rather than
% who it was from (seeing as I know I wgho sent it if its in my sent mail
% ...)

That's pretty easy.  You shouldn't even need any special hooks.  Of
course, you've specifically chosen %-15.15t, which displays the To:
field, instead of something like %-15.15L (list-from function) or %15.15F
(author's name unless you're the author).  Did you intend to do that?

Is $alternates set up correctly?


% 
...
% Thanks

HTH  HAND


% 
% Pat
% 
% -- 
% ---
% Pat Colbeck
% E-mail:   [EMAIL PROTECTED]
% Tel:  I'm not telling

Good idea and good pun :-)


:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg24273/pgp0.pgp
Description: PGP signature


Re: Index format

2002-02-07 Thread Patrick Colbeck

Hi

Thanks to all who replied. I have got it working now thanks. Just in
case anyone else is having similar issued it looks like this now:

Default format

folder-hook . 'set index_format=%4C %Z %{%b %d} %-15.15L (%4l) %s'

Normal incoming mail mailbox

folder-hook +Spool/azlan  'set index_format=%4C %Z %{%b %d} %-15.15L
(%4l) %s'

Normal outgoing mail mailbox

folder-hook +Outgoing/azlan 'set index_format=%4C %Z %{%b %d} %-15.15t
(%4l) %s'

Incoming mailbox that is mail from a mailing list (thsi si the one that
was causing me problems I think)

folder-hook +Spool/debian-user 'set index_format=%4C %Z %{%b %d}
%-15.15F (%4l) %s'

Note the use of 15.15F in the above instead of the 15.15L for normal
mailboxes.

Some of the above lines may have wrapped as I have text width set to 72
chars.

Thanks again all.

Pat

-- 
---
Pat Colbeck
E-mail: [EMAIL PROTECTED]
Tel:I'm not telling
---



Index format

2002-02-06 Thread Patrick Colbeck

Hi

I am trying to use a folder hook to change the index format. I want my
sent mail typpe folders to display who the mail was sent to rather than
who it was from (seeing as I know I wgho sent it if its in my sent mail
...)

Unfortunately I cannot get mutt to recognise the folder hook, no errors
are generated but there is no change in the index format. If I change
the global format even with a folder hook . then I do see a change.

I am using Mutt 1.3.22.1i on SuSE 7.2

Here is some of my muttrc (stolen from all over the net)

set folder=~/Mail

#folder-hook . 'set index_format=%4C %Z %{%b %d} %-15.15t (%4l) %s'
folder-hook . 'set index_format=%4C %Z %{%b %d} %-15.15t (%4l) %t'

either of the two above work and change the index in all mailboxes

folder-hook +Spool/mutt-users my_hdr From: [EMAIL PROTECTED]
folder-hook +Spool/mutt-users set signature=~/Signatures/bashq.sig
folder-hook +Spool/mutt-users 'fcc-hook .* +Outgoing/mutt-user
folder-hook +Outgoing/mutt-users 'set index_format=%4C %Z %{%b %d}
%-15.15t (%4l) %s'

The above doesnt work in that ~/Mail/Outgoing/mutt-users gets the same
index as whatever is set as the default for all folders.

Thanks

Pat

-- 
---
Pat Colbeck
E-mail: [EMAIL PROTECTED]
Tel:I'm not telling
---



Re: Index format

2002-02-06 Thread John P Verel

My experience with hooks is that if you have to set specific mailbox
hooks BEFORE setting a  default.  Try changing the order of the hooks
so that the default comes after all the others.  My o/s and version are
as above.

John
On 02/06/02, 05:36:23PM +, Patrick Colbeck wrote:
 Hi
 
 Unfortunately I cannot get mutt to recognise the folder hook, no errors
 are generated but there is no change in the index format. If I change
 the global format even with a folder hook . then I do see a change.
 
 I am using Mutt 1.3.22.1i on SuSE 7.2
 
 Here is some of my muttrc (stolen from all over the net)
 
 set folder=~/Mail
 
 #folder-hook . 'set index_format=%4C %Z %{%b %d} %-15.15t (%4l) %s'
 folder-hook . 'set index_format=%4C %Z %{%b %d} %-15.15t (%4l) %t'
 
 either of the two above work and change the index in all mailboxes
 
 folder-hook +Spool/mutt-users my_hdr From: [EMAIL PROTECTED]
 folder-hook +Spool/mutt-users set signature=~/Signatures/bashq.sig
 folder-hook +Spool/mutt-users 'fcc-hook .* +Outgoing/mutt-user
 folder-hook +Outgoing/mutt-users 'set index_format=%4C %Z %{%b %d}
 %-15.15t (%4l) %s'
 
 The above doesnt work in that ~/Mail/Outgoing/mutt-users gets the same
 index as whatever is set as the default for all folders.
 
 Thanks
 
 Pat

-- 
John P. Verel
Living Proof That Low Tech Beats High Tech!



Re: setting index format in folder-hook

2001-12-15 Thread Michael Tatge

Michael P. Soulier muttered:
 set index_format=%4C %Z %{%b %d} %-15.15n (%4l) %s
 
 However, if I put this into a folder-hook instead, I get an error about %Z
 being an unknown variable. What's the proper syntax to set this in a
 folder-hook?

Usage: folder-hook [!]regexp command

folder-hook FOLDER 'set index_format=%4C %Z %{%b %d} %-15.15n (%4l) %s'


HTH,

Michael
-- 
The nice thing about Windows is - It does not just crash, it displays a
dialog box and lets you press 'OK' first.
(Arno Schaefer's .sig)

PGP-Key: http://www-stud.ims.uni-stuttgart.de/~tatgeml/public.key



setting index format in folder-hook

2001-12-14 Thread Michael P. Soulier

Hey people. 

I'm currently using the following to set my index format

set index_format=%4C %Z %{%b %d} %-15.15n (%4l) %s

However, if I put this into a folder-hook instead, I get an error about %Z
being an unknown variable. What's the proper syntax to set this in a
folder-hook?

Thanks,

Mike

-- 
Michael P. Soulier [EMAIL PROTECTED], GnuPG pub key: 5BC8BE08
...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort.  -Harley Hahn, A Student's Guide to Unix



msg21610/pgp0.pgp
Description: PGP signature


index format

2001-06-07 Thread Doug Kearns

Hello all,

Is there some way to to set the index format so that it strips certain
characters from the subject( %s ) ?

eg. I'd like to strip the leading [...] from the subject
[ruby-talk:15734] java based interpreter and regexes

Any ideas ?

Thanks,
Doug




Re: index format

2001-06-07 Thread Lars Hecking

Doug Kearns writes:
 Hello all,
 
 Is there some way to to set the index format so that it strips certain
 characters from the subject( %s ) ?
 
 eg. I'd like to strip the leading [...] from the subject
 [ruby-talk:15734] java based interpreter and regexes

 There is no way to do it in mutt, as the format strings available for
 index_format don't allow access to substrings. But you can do this in
 procmail:

:0 fhw
* ^Subject:[]*\[[^]]*\][]\/.*
| formail -I Subject: $MATCH

 The empty bracket pairs contain a space and a tab each.




Re: index format

2001-06-07 Thread Doug Kearns

On Thu, Jun 07, 2001 at 04:35:18PM +0100, Lars Hecking wrote:
 Doug Kearns writes:
  Hello all,
  
  Is there some way to to set the index format so that it strips certain
  characters from the subject( %s ) ?
  
  eg. I'd like to strip the leading [...] from the subject
  [ruby-talk:15734] java based interpreter and regexes
 
  There is no way to do it in mutt, as the format strings available for
  index_format don't allow access to substrings. But you can do this in
  procmail:
 
 :0 fhw
 * ^Subject:[  ]*\[[^]]*\][]\/.*
 | formail -I Subject: $MATCH
 
  The empty bracket pairs contain a space and a tab each.
 
Thanks.
I didn't want to actually strip it - just didn't want to have to look at
it in the index.
I find subject strings of this type to be too 'noisy'.

Regards,
Doug




Re: Lists and threading in index format

2000-07-20 Thread DAve

And life is good, it works, Mutt rocks. How many MUAs have I tried to find 
nirvana? How many WMs did I install to enable this lib or that so some 
esoteric function in the newest ginchey MUA would be available? 

It wasn't whether this XPM lib was installed, or if that widget was 
compiled, or having a window for everything. Nirvana is when I only have to 
worry about my mail.

I delt with all 163 messages tonight in a fraction of time I normally have to 
spend and it was.  easy! 

Remove the shiney distractions and all that is left is how to deal with the 
process of reading mail, Mutt made that task simple.

Thank you, Thank you, Thank you. 

DAve

And Suresh Ramasubramanian said

 DAve proclaimed on mutt-users that:
 
 Why no threads? No list names in the index? I've looked through several 
 sample muttrc files from the site, and read the FAQ but it still don't work.
 
 What did I forget/miss?
 
 set sort=threads
 
 Lists has been replaced by subscribe in newer mutts
 
 -suresh
 
 -- 
 Suresh Ramasubramanian + [EMAIL PROTECTED]
 "Sometimes I simply feel that the whole world is a cigarette and I'm
 the only ashtray."

-- 
"On the Plains of Hesitation bleach the bones of countless millions who, at
 the Dawn of Victory, sat down to wait, and waiting -- died"   
 



Re: Lists and threading in index format

2000-07-19 Thread Suresh Ramasubramanian

DAve proclaimed on mutt-users that:

Why no threads? No list names in the index? I've looked through several 
sample muttrc files from the site, and read the FAQ but it still don't work.

What did I forget/miss?

set sort=threads

Lists has been replaced by subscribe in newer mutts

-suresh

-- 
Suresh Ramasubramanian + [EMAIL PROTECTED]
"Sometimes I simply feel that the whole world is a cigarette and I'm
the only ashtray."



postponed index format?

1999-08-04 Thread Ken W

I have looked around the manual, but can't find anything on this.  Can
I set the format of the postponed index?  Now it sets it to show the
sender, like most other mailboxes.  I set 'postponed' in my muttrc to
show the recipient instead, like in my 'sent' mailbox.  This only
works if I go to the postponed mailbox.  But if I hit 'R' to recall a
postponed message and there is more than one, the index is formatted
with the sender.

Thanks for any input...



-Ken

-- 
[EMAIL PROTECTED]AIM: ScopusFest