On Mon, Nov 21, 2011 at 04:36:00PM -0600, David Champion wrote:
Caveats: I remember this coming up but I don't remember exactly when or in what context. (If you have a URL where you got this I could double check.)
The start of the thread is here: http://marc.info/?l=mutt-users&m=129426504121286&w=2Part of the thread is about the date conditional patch that you use, but Andreas Kneib contributed the index_format script that he had gotten from de.comm.software.mailreader.misc. A couple people made improvements, and I went nuts with the concept.
I'm not sure where the OP got his version. Mine has the correct index_format in the documentation comment block.
There should be two arguments to the script, but the $index_format there passes only one. You also need the current timestamp. The simplest solution is probably to change the script: replace this line: now="$2" # local current time in epoch seconds with this: now=$(date +%s) But I haven't tested this. Maybe Ed will see this and have a better answer.
I use the attached script and the following index_format: set index_format="/path/to/format_date '%[%s]' '%<%s>' |"That uses the %<%s> expando to avoid having to exec date to get the local current time in epoch seconds.
-- Ed Blackman
#!/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 <apo...@web.de> # mutt-users Message-ID: <20110105233817.ga23...@andreas.kneib.biz> # Improvements by # David Champion <d...@uchicago.edu> # Ed Blackman <e...@edgewood.to> msg_date="$1" # datetime of message in local timezone in epoch seconds now="$2" # 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%"
signature.txt
Description: Digital signature