On Thu, Feb 12, 2009 at 09:29:01PM -0600, Kyle Wheeler wrote: > On Thursday, February 12 at 08:15 PM, quoth John J. Foster: > >Am I nuts, or are these functionally equivalent? > > You're nuts. :) > > But they *are* very similar. Tag-prefix, of course, means that the > next command will apply to all of the tagged messages. But what if > there AREN'T any tagged messages? Well then, the next command will > apply to whatever message happens to be highlighted! This is usually > the right thing to do when working interactively with the user, but > when used as part of scripts, lots of times there may not be any > tagged messages and in that case, the subsequent action should not > occur. THAT is what tag-prefix-cond does: if there aren't any tagged > messages, the command buffer is flushed without doing anything (in > other words, whatever hook you're in stops dead in its tracks). > > Take for example the folder-hook that I posted earlier today. The idea > is that I want mutt to automatically move any messages that are older > than 3 months into the archive folder. To refresh your memory, here's > what it looks like: > > folder-hook =Sent 'push "<tag-pattern>~r > >3m<enter><tag-prefix-cond><save-message>=Archive.Sent<enter><untag-pattern>~A<enter>"' > > So what happens if there aren't any messages that are older than three > months? If I had used <tag-prefix> instead of <tag-prefix-cond>, what > would happen is that whatever message happened to be highlighted when > I entered that folder would get moved to the archive folder. In my > case, I have mutt highlight the first new or unread message when it > opens new folders, so if I used <tag-prefix>, that new message would > get moved to the archive folder. However, because I use > <tag-prefix-cond>, when there aren't any tagged messages (i.e. the > pattern "~r >3m" didn't match anything), mutt will stop processing > that hook and none of the rest of it will happen. > > Does that make sense? Yep - and I'm nuts regardless! Thanks for the explanation Kyle. festus -- I just want to break even. Richard Manuel
Attachment:
pgpwjm98G6U0G.pgp
Description: PGP signature