* Gary Johnson on Friday, October 05, 2007 at 07:40:03 -0700 > On 2007-10-05, Christian Ebert <[EMAIL PROTECTED]> wrote: >> The following works in a dirty way -- you are prompted for >> address and subject both in the old and new instances of Mutt, >> but this should be solvable by macro. I made it for GNU screen, >> but probably something similar works for xterm as well. One needs >> "sleep" because Mutt is too fast in unlinking the tmp file (work >> around "sleep" with "touch" doesn't seem to work here). > > If the script doesn't return to the first mutt until the cp > operation is done, and if the second mutt is the only user of > $DRAFT.tmp, and if the second mutt exits before the rm is executed, > why do you need the sleep?
Trial and error ;) Of course I first tried "sleepless", but then I got the "Aborted unmodified message." error. >> #!/bin/sh >> #[ -n "$STY" ] || exit 1 # test whether we are in running Screen >> DRAFT="$1" >> cp "$DRAFT" "$DRAFT.tmp" >> ( >> screen -X screen mutt -H "$DRAFT.tmp" ### works >> # xterm -e "exec mutt -H $DRAFT.tmp" ### untested >> sleep 1 >> rm -f "$DRAFT.tmp" >> ) & >> exit 0 Speculation: mutt -H returns success somewhere right before it calls the editor on $DRAFT.tmp. Probably there are better ways to do this. For Screen an interesting alternative would be to open a split region. c -- Python Mutt utilities <http://www.blacktrash.org/hg/muttils/>