Re: auto-move mails

2008-07-25 Thread Steve S
On Jul 24 14:16, Ravi Uday wrote:
 Hi,
 
 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 ?
 

If you are also satisfied with using the message age as criterion, you could
use something like archivemail and a cronjob to put old mail in a .gz file. To
re-read old mail, do `mutt -f mailbox_archive.gz`.

steve


Re: auto-move mails

2008-07-25 Thread Marianne Promberger
On Friday, 25 July 2008, 10:25 (UTC+0200), Steve S wrote:
 On Jul 24 14:16, Ravi Uday wrote:
  Hi,
  
  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 ?
  
 
 If you are also satisfied with using the message age as criterion, you could
 use something like archivemail and a cronjob to put old mail in a .gz file. To
 re-read old mail, do `mutt -f mailbox_archive.gz`.

If date can be used as a key I'd do something with a folder-hook and
push and match a ~d  X pattern. Not sure if this is what the OP
wants.

Something like (not tested, and I'm sure others have better direct
function names where I use keyboard presses)

folder-hook . 'push tag-pattern~d  1menters\Ca\Ck=archive\n$'

Actually, trying the line above just now it doesn't work; it just tags
but doesn't save the message to the archive mailbox, not sure why.

m.



Re: auto-move mails

2008-07-25 Thread Mads Laursen
On Fri, Jul 25, 2008 at 11:07, Marianne Promberger
[EMAIL PROTECTED] wrote:
[snip]
 Something like (not tested, and I'm sure others have better direct
 function names where I use keyboard presses)

 folder-hook . 'push tag-pattern~d  1menters\Ca\Ck=archive\n$'

 Actually, trying the line above just now it doesn't work; it just tags
 but doesn't save the message to the archive mailbox, not sure why.

I don't have a terminal with mutt at the moment, but AFAIKS you need a
tag-prefix or ';' in front of your s to make it work.

If you look closely, it should have saved exactly one message (not
necessarily one of the tagged ones) to =archive - I think.

HTH  HAND

/dossen
-- 
This is a personal problem. There are very few personal problems that
cannot be solved through a suitable use of high explosives. This is
not one of those exceptions.


Re: auto-move mails

2008-07-25 Thread Marianne Promberger
On Friday, 25 July 2008, 11:46 (UTC+0200), Mads Laursen wrote:
 On Fri, Jul 25, 2008 at 11:07, Marianne Promberger
 [EMAIL PROTECTED] wrote:
 [snip]
  Something like (not tested, and I'm sure others have better direct
  function names where I use keyboard presses)
 
  folder-hook . 'push tag-pattern~d  1menters\Ca\Ck=archive\n$'
 
  Actually, trying the line above just now it doesn't work; it just tags
  but doesn't save the message to the archive mailbox, not sure why.
 
 I don't have a terminal with mutt at the moment, but AFAIKS you need a
 tag-prefix or ';' in front of your s to make it work.
 
 If you look closely, it should have saved exactly one message (not
 necessarily one of the tagged ones) to =archive - I think.

Thanks, this is exactly what happens. 

I had forgotten about this because I have set 'auto_tag= yes' in the
.muttrc

However, it turns out that even with tag-prefix such as ...

folder-hook . 'push tag-pattern~s 
test234entertag-prefixs\Ca\Ck=isomerica/archive\n'

if no message matches ~s test234 it does always save the last
message to the archive, so this would have to be changed to _only_
apply _if_ any message is tagged (or is there something like
delete-pattern for saving?

Anyway, I don't want to do this anyway, and not even sure if it's of
help to the OP, so no need on my part to pursue this further.

m.

 
 HTH  HAND
 
 /dossen
 -- 
 This is a personal problem. There are very few personal problems that
 cannot be solved through a suitable use of high explosives. This is
 not one of those exceptions.

-- 
Marianne Promberger
Graduate student in Psychology
http://www.psych.upenn.edu/~mpromber


Re: auto-move mails

2008-07-25 Thread Michael Kjorling
On 24 Jul 2008 14:16 -0700, by [EMAIL PROTECTED] (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 ?

If you are using maildir (I guess MH could work too, but may take a
little more work, and mbox would take the most work), you could rather
easily write a short shell script to accomplish this. True, it
wouldn't be within mutt, but if you want to you can certainly bind it
to a key combination to invoke it from within mutt.

Hint: ls new cur | wc -l should get you far.

-- 
Michael Kjörling .. [EMAIL PROTECTED] .. http://michael.kjorling.se
* . No bird soars too high if he soars with his own wings . *
* ENCRYPTED email preferred -- OpenPGP key ID: 0x 758F8749 BDE9ADA6 *
* ASCII Ribbon Campaign: Against HTML mail, proprietary attachments *



signature.asc
Description: Digital signature


Re: auto-move mails

2008-07-25 Thread Kyle Wheeler
-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-commandset my_savedsort=$sortenter\
 enter-commandset sort=reverse-date-receivedenter\
 tag-pattern~m 101-enter\
 tag-prefix-condsave-message=fooenter\
 sync-mailbox\
 enter-commandset sort=$my_savedsortenter'

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-


Re: auto-move mails

2008-07-25 Thread Nicolas Rachinsky
* Marianne Promberger [EMAIL PROTECTED] [2008-07-25 12:17 +0200]:
 However, it turns out that even with tag-prefix such as ...
 
 folder-hook . 'push tag-pattern~s 
 test234entertag-prefixs\Ca\Ck=isomerica/archive\n'
 
 if no message matches ~s test234 it does always save the last
 message to the archive, so this would have to be changed to _only_
 apply _if_ any message is tagged (or is there something like
 delete-pattern for saving?

You can use tag-prefix-cond instead of tag-prefix, this will
abort the macro if there are no tagged messages.

Nicolas

-- 
http://www.rachinsky.de/nicolas


auto-move mails

2008-07-24 Thread Ravi Uday
Hi,

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 ?

Thanks,
- Ravi