X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/bd32ebec018c0942ff148a53ba0848045696289d..d215fb8c4bb24685149e374ced9ab2fa5c2fd21e:/.mutt/batch-subject-editor?ds=sidebyside diff --git a/.mutt/batch-subject-editor b/.mutt/batch-subject-editor new file mode 100755 index 0000000..ad12bef --- /dev/null +++ b/.mutt/batch-subject-editor @@ -0,0 +1,25 @@ +#!/bin/sh +# +# batch-subject-editor - helper script to change subject lines with mutt +# +# Based on an idea by David Champion +# +# Copyright © 2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +set -eu + +printf 'Enter new subject: ' >/dev/tty +read subj &2 + exit 1 +fi + +RE_REPLY='(re([[(]?[[:digit:]]+[)]]?)?|aw|antwort):[[:space:]]*' +RE_SUBJ_PREFIX="^Subject:[[:space:]]*(${RE_REPLY})?" +RE_SUBJ='.*' +EDITOR="sed -i -re \"s,(${RE_SUBJ_PREFIX})${RE_SUBJ},\\\1$subj,i\"" + +printf "set editor='${EDITOR} %s'\n"