Re: Generate Reply / New Mail in new shell session
* Eyolf Østrem on Friday, October 05, 2007 at 01:07:39 +0200
a lilyponder ;)
> On 04.10.2007 (13:13), Gary Johnson wrote:
>> On 2007-10-04, David Champion <dgc@xxxxxxxxxxxx> wrote:
>>
>>> $ cat external-reply
>>> #!/bin/sh
>>> DRAFT="$1"
>>> # hard-link our own copy of the draft so that mutt can remove original
>>> ln "$DRAFT" "$DRAFT.tmp"
>>
>> I don't think that will work. I think you'll need to copy it. The
>> reason is that mutt overwrites its temporary files with zeros before
>> unlinking them.
>
> I can confirm that it doesn't work. The new xterm flashes over the
> screen for a splitsecond, but then it's gone, and the original mutt
> window behaves as if the mail has been written, ready to be sent.
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). I also
believe that you have to stick with $DRAFT.tmp vs $DRAFT.
#!/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
c
--
Python Mutt utilities <http://www.blacktrash.org/hg/muttils/>