X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/ff90937db28487ad9228eed5357565d2fcc3986e..f1ab8bcb3d0102fe44d2baad1de229f3edce4048:/.mutt/reuse-message?ds=inline diff --git a/.mutt/reuse-message b/.mutt/reuse-message index f7397ff..0d8ed23 100755 --- a/.mutt/reuse-message +++ b/.mutt/reuse-message @@ -6,12 +6,12 @@ editor= for i in "$@"; do # strip last argument from editor, yuk case "$i" in - ($mailfile) break;; + ("$mailfile") break;; (*) editor="${editor:+$editor }$i";; esac done -tmpfile=$(tempfile -p reuse) +tmpfile=$(mktemp --tmpdir reuse.XXXXXXXXXX) cleanup() { rm -f "$tmpfile"; trap - 1 2 3 4 5 6 7 8 10 11 12 13 14 15; } trap cleanup 1 2 3 4 5 6 7 8 10 11 12 13 14 15 @@ -21,8 +21,12 @@ formail -I Subject: < "$mailfile" | \ sed -e '/^Bcc:/aSubject: ' > "$tmpfile" cat "$tmpfile" > "$mailfile" +cleanup + if [ -n "$editor" ]; then eval exec "$editor" "$mailfile" + +# the last three replicate mutt's default (cf. manual) elif [ -n "$VISUAL" ]; then eval exec "$VISUAL" "$mailfile" elif [ -n "$EDITOR" ]; then