[vox-tech] two mutt questions

Ken Bloom vox-tech@lists.lugod.org
Fri, 4 Oct 2002 15:09:44 -0700


I just sent a message to vox-tech that exactly quoted somebody else's
post but didn't contribute anything of my own. I appologize.

I'm writing a shell script whose purpose it is to reply to individual
messages from a vox or vox-tech digest. The script (which lives as
$HOME/bin/vox is meant to be invoked from mutt using the keystrokes
"|vox 10" where 10 is the number in the digest of the message to which I
want to respond. I've got the text matching stuff working correctly, but
I had a couple of questions about mutt.



The first (which explains the message for which I am appologizng) is
that the script worked fine until the 'mutt' line. When mutt ran, it
just up and sent the message without giving me a chance to edit the
message. 

Running a similar command from an interactive shell would give
me a chance to edit the message before sending it. I tried using the
construction "mutt ... < `tty`", but when running in the script, `tty`
returns "not a tty" and so I can't make mutt read input from the tty.

How can I make mutt show its face when invoked from this shell script?
(Remember, the script itself reads the full text of the original digest
from STDIN).



The second question: when I get the script working, I'd like to rebind
the r key (for reply) when I'm viewing vox and vox-tech digests (and only
when I'm viewing these digests) so that instead of replying by default,
it instead types "|vox " and waits for me to input the message number and
hit return. Is there a way I can do this?



A third queston: I've written several good shell scripts for mutt, but I
also use Mozilla mail as a mail client. Any way to convince it to pipe
messages through shell scripts?


###################shell script $HOME/bin/vox starts on next line
#!/bin/tcsh

set FNAME=/tmp/vox_digest_reply-`date +%m.%d.%Y-%H.%M.%S`

awk '/Message: '$1'/,/--__--__--/{print "> "$0}' > $FNAME
#               ^^this is the shell's $1    ^^this one is awk's $0
#                                       and it means the whole input line

set SUBJECT=`grep '^> Subject' $FNAME | head -1 | sed 's/> Subject: //'`
set TOADDR=`grep '^> Reply-To' $FNAME | head -1 | sed 's/> Reply-To: //'`

mutt $TOADDR -s "$SUBJECT" -i $FNAME

rm -f $FNAME
###################### end of script ###########################