<<< Date Index >>>     <<< Thread Index >>>

race condition? -or- better way to transparently edit a message's headers?



i'm using a macro to edit a message and i'm seeing an odd race
condition.  first of all, i'm running:

Mutt 1.5.12 (2006-07-14)
patch-1.5.11.rr.compressed.1
patch-1.5.4.vk.pgp_verbose_mime
patch-1.5.5.1.nt.xtitles.3.ab.1
patch-1.5.6.dw.maildir-mtime.1
patch-1.5.6.tt.assumed_charset.1

on debian (linux 2.6.16.13) with maildir

i am using the following macros to implement a weighted importance
system within mutt.  the solitary important flag doesn't cut it for a
busy professional.

macro index <right> ":set editor='mutt_importance
inc'<Return><edit>:set editor=\"vim -c 'set
tw=72'\"<Return><sync-mailbox>y<next-undeleted><toggle-new><previous-undeleted>"
macro index <left> ":set editor='mutt_importance
dec'<Return><edit>:set editor=\"vim -c 'set
tw=72'\"<Return><sync-mailbox>y<next-undeleted><toggle-new><previous-undeleted>"

these macros will eat the message and increment or decrement the
numerical value on the right hand side of the X-Mutt-Importance
header, not exceeding the inclusive range of 0-3.  the only problem is
that it doesn't work consistently (ie, the message is unmodified).  if
i hold down the left arrow, it will show a few modified messages
(deleted+new).  if i insert a sleep(1) call into the beginning of the
script used as the editor, it works consistently.  if i insert a
sleep(1) call into the end of the script used as the editor, it does
not work consistently.  thoughts?

on a related note, for my purposes in implementing such a system soley
via macros, the editing system is lacking in flexibility.  the editing
of headers by a script should not induce this deleted+new behavior, as
i want the operation to be as transparent as possible.  i don't
require the rudimentary revision control.  i have hacked around this
by explicitly calling sync-mailbox, next-undeleted, toggle-new,
previous-undeleted; however, this is suboptimal -- i don't want to
explicitly sync the the entire mailbox just to flag a message with a
number.

any suggestions from experienced muttrc macro monkeys?

thanks,

-mike