Re: auto-move mails
- To: mutt-users@xxxxxxxx
- Subject: Re: auto-move mails
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Fri, 25 Jul 2008 08:59:51 -0500
- 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=OTpAdqG4icHNhuE6CoD+Iis5l6c=; b=jS4k XhQ3sHfk/q+gsTNlHEZA2hwXSqiwQX3o+rvGPTZDJSzvQ7OVIhcXciKNwLd/76mx knjTtds+fW5ZrkXT6U2hPyRo4mEp8ap5gdT9e+xcVlhXZekVCB1+yQgPzj4+KO4U trY+yEm2/pk98hk0oEhvOF7iueyH63Xgrad5rzo=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=LlddD0rdLy333SlH1VO5129CHbUMm5Gtmwh90EiqoNDkaOJBYvLpzgC2Gm/u8iesDlhb39ocnHoqUPYtfTKjigG/vqIvMkBtscIgvG6fvsuArPcVbjRd+miZUovOhutEMsPzb1rGvZmR8FTaLPkNK9Uh0daQSUuApaE2VnCVCuU=; 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: <56b92dda0807241416y7233e73bh9e7888e9759b615c@xxxxxxxxxxxxxx>
- 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: <56b92dda0807241416y7233e73bh9e7888e9759b615c@xxxxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.18 (2008-07-21)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday, July 24 at 02:16 PM, quoth Ravi Uday:
> In mutt 1.5.17 is there a way we can setup a rule where if the
> number of emails touches 150 move the first 50 to a specified folder
> ? We can then map this rule witha key too ?
Well, it's no so much a "rule" as it is a trigger. For example, you
could use a folder-hook. If you want to do things based on the
*number* of messages, then you're going to have to play some creative
games. I can't think of a way to get it to trigger only when there are
150 messages, but I *can* think of a way to make sure that there are
only the most-recent 100 messages.
Since the concept of "most-recent" relies on the sorting order, we're
going to use a combination of changing the sorting order and the ~m
matching pattern. For example, we can use a hook that will:
1. Save the current sort order
2. Sort the messages so that the most-recent come first
3. Tag all messages after the 100th message
4. Save all tagged messages into a specified folder
5. Restore the original sort order
Such as this:
folder-hook . '<enter-command>set my_savedsort=$sort<enter>\
<enter-command>set sort=reverse-date-received<enter>\
<tag-pattern>~m 101-<enter>\
<tag-prefix-cond><save-message>=foo<enter>\
<sync-mailbox>\
<enter-command>set sort=$my_savedsort<enter>'
You can, of course, bind that macro to a key instead of a hook if you
prefer.
~Kyle
- --
No man should escape our universities without knowing how little he
knows.
-- J. Robert Oppenheimer
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iEYEARECAAYFAkiJ3FcACgkQBkIOoMqOI14w0gCcDs/FOoTBR3KlFG1mmUvQyJEP
vf8AoJeV9B2vwfbtxsScIyIi0LU0Gr78
=umeY
-----END PGP SIGNATURE-----