Re: Clarification on tag-prefix-cond vs. tag-prefix
- To: mutt-users@xxxxxxxx
- Subject: Re: Clarification on tag-prefix-cond vs. tag-prefix
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Thu, 12 Feb 2009 21:29:01 -0600
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=0y4+jL8SPFjK2Pz5n8rupJDHfBw=; b=inZz W5iL43k0gr+O2u7DLaRXek0p/p4NZlrfhu3W0q6Xj5oyTvozA9YGSmUxyy/mfGDw LmpLsdXXfxeBpGSFmF1NOT7cw/zrbXknyywTKjoBVq9m5VDZC6EwykU8sjeQFiaD 2XYmVG4e7b1+EXDzs89Yec5UC2Fj/MvZAQ58bBc=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=DtKtHKXGxczd8DMtX+6bUJVHJPhqeTLECEQb491SWXld42gh+nUNJS7p9rW1pY9W+0o31BM7PE82lC7V0SZmWxEpQdWSKe1+FEIywNPgaiFVtt5iT7jia9K/aB8ySmA6YrHWycu0U24xQwyHUHPZQMsQCtNsZMKXOnNjJcsDkXA=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:OpenPGP:User-Agent;
- In-reply-to: <20090213031553.GB421@xxxxxxxxxxxx>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- Openpgp: id=CA8E235E; url=http://www.memoryhole.net/~kyle/kyle-pgp.asc; preference=signencrypt
- References: <20090213031553.GB421@xxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.19 (2009-01-27)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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?
~Kyle
- --
I'm as pure as the driven slush.
-- Tallulah Bankhead
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iEYEARECAAYFAkmU6P0ACgkQBkIOoMqOI14LpgCggHeM04zyhj5Nf28lItyG9xU5
ELEAoJMDmPmv4IxNzGlRExla4t3uZ1fN
=qqzw
-----END PGP SIGNATURE-----