mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 01:14:53 +01:00
vim: add option to save the patches of a patch series
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
parent
2d583fb17a
commit
77c2c3143b
1 changed files with 15 additions and 0 deletions
|
@ -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: ')
|
||||
|
|
Loading…
Reference in a new issue