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

Re: Background mail composition



On 14/10/03 14.55, Andrew Sayers wrote:
> I'd like to compose mail in a different window/different
> screen/background task, a la GUI clients.  So far, I've managed to get
> this working for new messages by doing this:
> 
> macro index   m       "<shell-escape>screen -X screen mutt ''\n"
> 
> (in other words, tell the current screen session to open a new screen in
> the same session and run mutt with a blank "To" address)
> 
> Not a pretty solution, but it works.  You can presumably get similar
> results by using "mutt '' &" or "xterm -e mutt '' &".  However, I can't
> see how I'd do an equivalent trick when replying to an existing message.
> Does anyone have any suggestions?
> 
> Also, while looking around for the above macro, I found that in
> command-lines like `mutt -f /dev/null -e 'exec quit'`, the '-e' argument
> seems to be ignored because of the '-f'.  Should this be filed as a bug?

The attached scripts attempt to do something like what you are asking
for. They are not that good, they were mostly written to see if it
could be done, but the basic idea is this: Copy the message to a
temporary mailbox, invoke a new mutt on that mailbox, and have the new
mutt do something clever, while the original mutt continues doing
whatever it was doing.

To use it put something like 'source "~/.muttrc.d/bin/compose_mutt |"'
in your muttrc and fix the paths and stuff in the scripts.

Please note that no issues of security or stability have been
considered, and the scripts might very well seriously mess up your
system. 

source std_disclaimer.rc


Feel free to hack it into something nice, share it with the world, or
whatever.

/dossen
-- 
Common sense is the collection of prejudices acquired by age eighteen.
                -- Albert Einstein
#!/usr/bin/env perl

### Setup ###

$PID=$$;

$USER=$ENV{USER} || "me";

$TMP=$ENV{TMP} || "/tmp";

$SCRIPT="~/.muttrc.d/bin/compose_mutt_script";

$TMP_MBOX="${TMP}/comp_mbox-${USER}-${PID}";

### Defining mutt primitives ###

$TOUCH="<enter-command>set wait_key=no<enter><shell-escape>touch 
$TMP_MBOX<enter><enter-command>set wait_key=yes<enter>";
$SOURCE="<enter-command>source '$0 |'<enter>";
$RUN1="<enter-command>set wait_key=no<enter><shell-escape>$SCRIPT $TMP_MBOX ";
$RUN2="<enter><enter-command>set wait_key=yes<enter>";
$COPY="$TOUCH<copy-message>$TMP_MBOX<enter>";
$REPLY="<set-flag>r"

### Outputting the configuration ###

print "macro index r \"$COPY$RUN1 reply$RUN2$REPLY$SOURCE\" \"reply to a 
message in new XTerm\"\n";

print "macro index m \"$TOUCH$RUN1 mail$RUN2$SOURCE\" \"compose a new mail 
message in new XTerm\"\n";
#!/usr/bin/env bash
if [ "X$3" == "Xexecute" ]; then
  if ( [ "X$2" == "Xmail" ] || [ "X$2" == "Xreply" ] ); then
    TMP_MBOX=$1
    TMP_RC="$TMP_MBOX.rc"
    export MUTT_COMMAND="push <$2>"
    echo 'source "~/.muttrc"' > "$TMP_RC"
    echo 'folder-hook /tmp/comp_mbox-dossen-10570 `echo $MUTT_COMMAND`' >> 
"$TMP_RC"
    xterm -title "Composing message" -e mutt -m mbox -F "$TMP_RC" -f "$TMP_MBOX"
    rm -f $TMP_MBOX $TMP_RC
  fi
  else $0 $1 $2 execute &
fi

Attachment: pgpyRkRUjdj36.pgp
Description: PGP signature