X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/57c899814e74bdf9adec4c7d8211fc25d6b39697..d435a3111f03e3c9b0ad7f307a3f09076f47c05e:/.mutt/reuse-message?ds=sidebyside 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