]> git.madduck.net Git - etc/mutt.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

New functionality: reusing messages
authormartin f. krafft <madduck@madduck.net>
Sat, 15 Jun 2013 19:02:40 +0000 (21:02 +0200)
committermartin f. krafft <madduck@madduck.net>
Sat, 15 Jun 2013 19:02:40 +0000 (21:02 +0200)
.mutt/keybindings
.mutt/reuse-message [new file with mode: 0755]

index 5a2109cf7e08383545fd69a266e86ba9419bf2eb..0fe8867a74b5d6191f875aabc4f6f20944e328fb 100644 (file)
@@ -14,9 +14,6 @@ macro index   p       "<enter-command><enter>" "do nothing"
 macro index            S       "<tag-prefix><save-message>=store<enter><sync-mailbox>" "save messages to store"
 macro pager            S       "<save-message>=store<enter><sync-mailbox>" "save message to store"
 
-macro index            \er     '<tag-prefix><save-message>=resubmit<enter><sync-mailbox>' "resubmit messages"
-macro pager            \er     '<save-message>=resubmit<enter><sync-mailbox>' "resubmit message"
-
 macro index,pager      E       '<enter-command>source "$my_confdir/supersede-header X-Tickle get-timestamp|"<enter><next-undeleted><enter-command>push \er<enter>' "schedule messages with tickler"
 macro index,pager      \ex     '<enter-command>source "$my_confdir/remove-header X-Postponed|"<enter>' "release postponed messages"
 
@@ -72,6 +69,10 @@ macro index,pager    e       '<enter-command>set my_editor="$editor"<enter><enter-command
 
 macro index            \ej     '<enter-command>set my_editor="$editor"<enter><enter-command>source "$my_confdir/batch-subject-editor|"<enter><tag-prefix><edit><enter-command>set editor="$my_editor"<enter>' "change message subject"
 
+macro index,pager      \er     '<enter-command>set my_editor="$editor"<enter><enter-command>set editor="~/.mutt/reuse-message $my_editor"<enter><reply><enter-command>set editor="$my_editor"<enter>' "invoke normal editor to edit message"
+macro index,pager      \eg     '<enter-command>set my_editor="$editor"<enter><enter-command>set editor="~/.mutt/reuse-message $my_editor"<enter><group-reply><enter-command>set editor="$my_editor"<enter>' "invoke normal editor to edit message"
+macro index,pager      \el     '<enter-command>set my_editor="$editor"<enter><enter-command>set editor="~/.mutt/reuse-message $my_editor"<enter><list-reply><enter-command>set editor="$my_editor"<enter>' "invoke normal editor to edit message"
+
 macro index            <F8>    "<enter-command>unset wait_key<enter><shell-escape>~/.mutt/mutt-notmuch --prompt search<enter><change-folder-readonly>~/.cache/mutt_results<enter>" "search mail (using notmuch)"
 macro index            <F9>    "<enter-command>unset wait_key<enter><pipe-message>~/.mutt/mutt-notmuch thread<enter><change-folder-readonly>~/.cache/mutt_results<enter><enter-command>set wait_key<enter>" "search and reconstruct owning thread (using notmuch)"
 
diff --git a/.mutt/reuse-message b/.mutt/reuse-message
new file mode 100755 (executable)
index 0000000..c833bd3
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -eu
+
+eval mailfile="\${$#}"
+for i in "$@"; do
+  # strip last argument from editor, yuk
+  case "$i" in
+    ($mailfile) break;;
+    (*) editor="${editor:+$editor }$i";;
+  esac
+done
+
+tmpfile=$(tempfile -p reuse)
+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
+
+formail -I Subject: < "$mailfile" | \
+  formail -I In-Reply-To: | \
+  sed -e '/^$/,/^-- /d' | \
+  sed -e '/^Bcc:/aSubject: ' > "$tmpfile"
+cat "$tmpfile" > "$mailfile"
+
+if [ -n "$editor" ]; then
+  eval exec "$editor" "$mailfile"
+elif [ -n "$VISUAL" ]; then
+  eval exec "$VISUAL" "$mailfile"
+elif [ -n "$EDITOR" ]; then
+  eval exec "$EDITOR" "$mailfile"
+fi
+exec /usr/bin/editor "$mailfile"