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 8FD7341A54B for ; Thu, 9 Dec 2010 14:16:52 -0800 (PST) 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 idpraOJvejjk for ; Thu, 9 Dec 2010 14:16:50 -0800 (PST) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by olra.theworths.org (Postfix) with ESMTP id 8A0C441A552 for ; Thu, 9 Dec 2010 14:16:50 -0800 (PST) Received: by mail-bw0-f52.google.com with SMTP id 4so3687965bwz.39 for ; Thu, 09 Dec 2010 14:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=9Ce2yFZ5vaC7kEhK0VKeJqMDJt1k//ZrTSydnApkXIw=; b=sv5fxxbw2HkIZsds+MAORbIdy7qleOoxvAszsuwSrKDz2oYQV2TThUGppPfTN1wyN1 NaL8Tk2/3qi1NPDd+8F+6YppJ9qxJ+npEDIYRhezs0rj1pRzqAfdcVGfZsYQ2q4sUHhb Prdkr772ZoP5GHqzAzitl51HYcoaXC3Nz8Cyk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=pBgv8CthZg7HOo24/0CIEgrvNY2+cH4iNbicgUQLklbALGyiyGZhGFOdnR3p9NaXam cnaPsHkWuBdkkW0Xbydj/Ux/IsTTCQf11OiY6xqOnZjcMyAX9zilnv7eOveod1GBtnT1 gGTZmZ/L5Zi1UUG6VWHKuEJuVD6070//lGwv0= Received: by 10.204.115.73 with SMTP id h9mr1801bkq.22.1291933010214; Thu, 09 Dec 2010 14:16:50 -0800 (PST) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id d11sm1213721bkd.22.2010.12.09.14.16.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Dec 2010 14:16:49 -0800 (PST) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH 1/3] vim: refactor tagging stuff Date: Fri, 10 Dec 2010 00:16:23 +0200 Message-Id: <1291932985-5220-2-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <1291932985-5220-1-git-send-email-felipe.contreras@gmail.com> References: <1291932985-5220-1-git-send-email-felipe.contreras@gmail.com> Cc: Felipe Contreras 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: Thu, 09 Dec 2010 22:16:53 -0000 From: Felipe Contreras Signed-off-by: Felipe Contreras --- vim/plugin/notmuch.vim | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 8d5d1c3..6898d56 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -307,12 +307,12 @@ function! s:NM_search_edit() endfunction function! s:NM_search_archive_thread() - call NM_add_remove_tags([], '-', ['inbox']) + call NM_tag([], ['-inbox']) norm j endfunction function! s:NM_search_mark_read_then_archive_thread() - call NM_add_remove_tags([], '-', ['unread', 'inbox']) + call NM_tag([], ['-unread', '-inbox']) norm j endfunction @@ -403,7 +403,8 @@ function! s:NM_search_add_remove_tags(prompt, prefix, intags) else let tags = a:intags endif - call NM_add_remove_tags([], a:prefix, tags) + call map(tags, 'a:prefix . v:val') + call NM_tag([], tags) endfunction " --- implement show screen {{{1 @@ -497,7 +498,7 @@ function! s:NM_show_archive_thread() endfunction function! s:NM_show_mark_read_then_archive_thread() - call NM_add_remove_tags(b:nm_search_words, '-', ['unread', 'inbox']) + call NM_tag(b:nm_search_words, ['-unread', '-inbox']) call NM_show_next_thread() endfunction @@ -561,7 +562,8 @@ function! s:NM_show_advance_marking_read_and_archiving() let filter = NM_combine_tags('tag:', advance_tags, 'OR', '()') \ + ['AND'] \ + NM_combine_tags('', ids, 'OR', '()') - call NM_add_remove_tags(filter, '-', advance_tags) + call map(advance_tags, '"+" . v:val') + call NM_tag(filter, advance_tags) call NM_show_next(1, 1) return endif @@ -580,7 +582,8 @@ function! s:NM_show_advance_marking_read_and_archiving() " do this last to hide the latency let filter = NM_combine_tags('tag:', advance_tags, 'OR', '()') \ + ['AND', msg_top['id']] - call NM_add_remove_tags(filter, '-', advance_tags) + call map(advance_tags, '"-" . v:val') + call NM_tag(filter, advance_tags) endif return endif @@ -1266,12 +1269,11 @@ function! s:NM_search_expand(arg) let b:nm_prev_bufnr = prev_bufnr endfunction -function! s:NM_add_remove_tags(filter, prefix, tags) +function! s:NM_tag(filter, tags) let filter = len(a:filter) ? a:filter : [NM_search_thread_id()] if !len(filter) throw 'Eeek! I couldn''t find the thead id!' endif - call map(a:tags, 'a:prefix . v:val') let args = ['tag'] call extend(args, a:tags) call add(args, '--') -- 1.7.3.2