X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/57c899814e74bdf9adec4c7d8211fc25d6b39697..c734a415a3bcbdfde490557edf83d0c3158a107d:/.mutt/reuse-message?ds=inline diff --git a/.mutt/reuse-message b/.mutt/reuse-message index c833bd3..0bdb3f8 100755 --- a/.mutt/reuse-message +++ b/.mutt/reuse-message @@ -2,10 +2,11 @@ set -eu eval mailfile="\${$#}" +editor= for i in "$@"; do # strip last argument from editor, yuk case "$i" in - ($mailfile) break;; + ("$mailfile") break;; (*) editor="${editor:+$editor }$i";; esac done @@ -20,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