Re: Generate Reply / New Mail in new shell session
On 2007-10-05, Christian Ebert <blacktrash@xxxxxxx> wrote:
> * 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).
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?
> 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
Regards,
Gary