[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] mime-aware repl'ying
From: |
Paul Fox |
Subject: |
Re: [Nmh-workers] mime-aware repl'ying |
Date: |
Mon, 26 Sep 2005 16:19:48 -0400 |
> I have `-editor zprompter' in .mh_profile for repl. zprompter is a zsh
> script I've written that is a bit like prompter. Among other things, it
> does:
> exec 3>$1
> ...
> if [[ -n $editalt ]]; then
> mhshow -part 1 -form mhl.null -file $editalt | sed -e '1 d' -e 's/^/> /'
> >&3
> fi
thanks. given this start, and some ideas from the mhonarc script
mha-mhedit (which does a more complete job of text extraction), i
came up with the following. add it as "repl: -edit
mh.repledit". make sure that your replcomps file ends in a blank
line to make extracting the header part of the draft easy. also,
be sure and include a new "mh.repledit-next: vi" or whatever
line in .mh_profile, to keep this from being run twice on your
message.
cat >mh.repledit <<EOF
#!/bin/sh
SIGFILE=$HOME/.signature
DRAFT=$1
CURRENT=$(mhpath cur)
# if the message being replied to is multipart, only quote the
# first part. the first part will be quoted, regardless of its type.
if [ "$(sed -e '/^$/,$d' $CURRENT |
egrep -i '^content-type:[[:space:]]*multipart\/mixed' )" ]
then
( sed -n -e '1,/^$/p' $DRAFT
mhshow -part 1 -form mhl.null -file $CURRENT |
sed -e 1,2d -e 's/^/ > /'
) >$DRAFT.x
mv $DRAFT.x $DRAFT
fi
(echo ; cat $SIGFILE ) >> $DRAFT
vi "$@"
exit
EOF
=---------------------
paul fox, address@hidden (arlington, ma, where it's 67.3 degrees)