On Mon, Nov 21, 2011 at 04:36:00PM -0600, David Champion wrote:
> * On 21 Nov 2011, von der Burg wrote: 
> > 
> >   I am trying to use Champion and Blackman's nice bash script, 
> >   which I have appended below, to assign different date formats
> >   according to the age of the date. 
> > 
> >   I have tested each of the conditionals of this script and 
> >   it seems to work from the shell. However when I try to use it 
> >   from the mutt command line, it sets the desired format ONLY 
> >   for the messages which are less than one day old. More accurately
> >   it applies the "less-than-one-day-old" to ALL messages.
> 
> 
> 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.)  And I don't use the script in question, since I get the same
> functionality (faster) through a patch to mutt's code.

Just in case you want to try going the patch route instead of the script
route, I use the following two patches to achieve this:

http://www.dr-qubit.org/mutt/mutt-1.5.21-patch.tsc.date_conditional.1
http://home.uchicago.edu/~dgc/sw/mutt/patch-1.5.1.dgc.deepif.1

The former is a modified version of the date_conditional patch from
http://www.schrab.com/aaron/mutt/patch-1.5.1.ats.date_conditional.1
Depending on precisely what formatting you're after, you might prefer
this one. The second patch is David's deepif patch, which you'll need in
either case. (It applies fine to recent mutt versions, e.g. mutt-1.5.21.)

With those patches applied, I use the following index_format to apply
different date formats to messages received today, messages received this
year, or older messages:

set index_format='%4C %?X?%2X&  ? %Z  %?[1y?%\?[1d\?%[%H:%M]     \&%[%d
 %b]    \?&%[%d/%m/%Y]?  %-30.30L  %s' 

(should all be on one line).

The difference between the two date_conditional patches is, for example,
that my version applies the "today" date format to all messages received
today, whereas the original version would apply the "today" format to all
messages received within the last 24h. Which version you need is purely
down to personal preference. Neither is "better" than the other.

HTH,

Toby
-- 
Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain

email: ts...@cantab.net
web:   www.dr-qubit.org

Reply via email to