aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorGravatar Felipe Contreras <felipe.contreras@gmail.com>2013-10-13 22:38:38 -0500
committerGravatar Felipe Contreras <felipe.contreras@gmail.com>2013-11-20 07:23:29 -0600
commit77c2c3143be1f69f10f04f9e5e885a30248c2fd0 (patch)
tree95ab667300addefa7b0fdd9df341c90d3c8a0b36 /vim
parent2d583fb17a4b18abad8631f7200eb76440cc6838 (diff)
vim: add option to save the patches of a patch series
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'vim')
-rw-r--r--vim/notmuch.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index a1c5e286..9cfa795d 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -34,6 +34,7 @@ let g:notmuch_rb_show_maps = {
\ 'o': 'show_open_msg()',
\ 'e': 'show_extract_msg()',
\ 's': 'show_save_msg()',
+ \ 'p': 'show_save_patches()',
\ 'r': 'show_reply()',
\ '?': 'show_info()',
\ '<Tab>': 'show_next_msg()',
@@ -181,6 +182,20 @@ ruby << EOF
EOF
endfunction
+function! s:show_save_patches()
+ruby << EOF
+ q = $curbuf.query($cur_thread)
+ t = q.search_threads.first
+ n = 0
+ t.toplevel_messages.first.replies.each do |m|
+ next if not m['subject'] =~ /^\[PATCH.*\]/
+ file = "%04d.patch" % [n += 1]
+ system "notmuch show --format=mbox id:#{m.message_id} > #{file}"
+ end
+ vim_puts "Saved #{n} patches"
+EOF
+endfunction
+
function! s:show_tag(intags)
if empty(a:intags)
let tags = input('tags: ')