Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C95A0429E28 for ; Sat, 2 Nov 2013 07:03:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qXcNUj56B3Hf for ; Sat, 2 Nov 2013 07:03:34 -0700 (PDT) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 36714429E3F for ; Sat, 2 Nov 2013 07:02:55 -0700 (PDT) Received: by mail-ob0-f182.google.com with SMTP id wn1so5653579obc.13 for ; Sat, 02 Nov 2013 07:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=suHNzO5EdpohLmcbrZxQHqChN/dQf0pU2V/MdSnFO/g=; b=ng6SFmvbtPsuPBH2Z0EZRP5Gwj1qLlbKFxUWxOHnaj826eUkCAlLJLq8zjUP36QnAd JWIDLbFAhnYdB6QLSxd0WBz+OhSFjisKRvsGl/+Sd8fD0f4umvjRmel6ETbqM/X/eUSj 7bIyhe2/R/ibFH/C7bLpnDR/+raJG8/nNcDqeufe/CX0Ie/z2lDbyFKYpqkba/yFjCnp /IzeyNNicfY9FVL3GZVyqyF+pAK9dcVoKABu+sA0Myw/IkQ4FqMhG9vkc38JxOLZ9sgP F+0Fof/cKYBX+r4oisF6lQOeJCfd6sXw0vo8kzU/kBiuZK906TXHHmq0RK/PdfdDapN6 HIkw== X-Received: by 10.182.153.226 with SMTP id vj2mr6585652obb.26.1383400974759; Sat, 02 Nov 2013 07:02:54 -0700 (PDT) Received: from localhost (187-162-140-241.static.axtel.net. [187.162.140.241]) by mx.google.com with ESMTPSA id j9sm5190122oef.8.2013.11.02.07.02.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Nov 2013 07:02:54 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH 07/21] vim: add option to save the patches of a patch series Date: Sat, 2 Nov 2013 07:55:40 -0600 Message-Id: <1383400554-1832-8-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.8.4.2+fc1 In-Reply-To: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com> References: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2013 14:03:40 -0000 Signed-off-by: Felipe Contreras --- vim/notmuch.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vim/notmuch.vim b/vim/notmuch.vim index a1c5e28..9cfa795 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()', \ '': '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: ') -- 1.8.4.2+fc1