PATCH LGTM. Did not find any patch that couldn't be saved. One issue: It saves the patches into $WORKDIR. It would be great if the target path could be prompted (default again to ~/.notmuch/tmp?) so no random dirs get polluted. But that isn't a regression to the previous behaviour -> no showstopper. Franz Ian Main wrote: > It seems like there was some bitrot on the previous version of this > which made it not work correctly. This fixes the bitrot and also > updates how it works. > > - Sometimes [PATCH.*] isn't at the beginning of the message (often on > lists I'm on). > - It now goes through all the messages in the thread. for some reason > the toplevel messages didn't usually contain all the patches in my > testing. > - Check for 'Re:' at the beginning and skip if it's there. > - Save patches to filesystem-safe filename containing the subject > (unfortunately we use system()...) > > Ian > --- > vim/notmuch.vim | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/vim/notmuch.vim b/vim/notmuch.vim > index b33c6c6..d80f22f 100644 > --- a/vim/notmuch.vim > +++ b/vim/notmuch.vim > @@ -182,12 +182,18 @@ 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] > + t.messages.each do |m| > + next if not m['subject'] =~ /\[PATCH.*\]/ > + next if m['subject'] =~ /^Re:/ > + file = "#{m['subject']}-%04d.patch" % [n += 1] > + # Sanitize for the filesystem > + file.gsub!(/[^0-9A-Za-z.\-]/, '_') > + # Remove leading underscores. > + file.gsub!(/^_+/, '') > + vim_puts "Saving patch to #{file}" > system "notmuch show --format=mbox id:#{m.message_id} > #{file}" > end > - vim_puts "Saved #{n} patches" > + vim_puts "Saved #{n} patch(es)" > EOF > endfunction > > -- > 1.9.3 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch