Re: Dangerous space bar key (was: Preventing the user shooting themself in the foot)
[notmuch-archives.git] / 4c / b08909dca1d43e2daa4140bf5c1f45b61555e9
1 Return-Path: <felipe.contreras@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 8FD7341A54B\r
6         for <notmuch@notmuchmail.org>; Thu,  9 Dec 2010 14:16:52 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id idpraOJvejjk for <notmuch@notmuchmail.org>;\r
17         Thu,  9 Dec 2010 14:16:50 -0800 (PST)\r
18 Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com\r
19         [209.85.214.52])\r
20         by olra.theworths.org (Postfix) with ESMTP id 8A0C441A552\r
21         for <notmuch@notmuchmail.org>; Thu,  9 Dec 2010 14:16:50 -0800 (PST)\r
22 Received: by mail-bw0-f52.google.com with SMTP id 4so3687965bwz.39\r
23         for <notmuch@notmuchmail.org>; Thu, 09 Dec 2010 14:16:50 -0800 (PST)\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
25         h=domainkey-signature:received:received:from:to:cc:subject:date\r
26         :message-id:x-mailer:in-reply-to:references;\r
27         bh=9Ce2yFZ5vaC7kEhK0VKeJqMDJt1k//ZrTSydnApkXIw=;\r
28         b=sv5fxxbw2HkIZsds+MAORbIdy7qleOoxvAszsuwSrKDz2oYQV2TThUGppPfTN1wyN1\r
29         NaL8Tk2/3qi1NPDd+8F+6YppJ9qxJ+npEDIYRhezs0rj1pRzqAfdcVGfZsYQ2q4sUHhb\r
30         Prdkr772ZoP5GHqzAzitl51HYcoaXC3Nz8Cyk=\r
31 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
32         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
33         b=pBgv8CthZg7HOo24/0CIEgrvNY2+cH4iNbicgUQLklbALGyiyGZhGFOdnR3p9NaXam\r
34         cnaPsHkWuBdkkW0Xbydj/Ux/IsTTCQf11OiY6xqOnZjcMyAX9zilnv7eOveod1GBtnT1\r
35         gGTZmZ/L5Zi1UUG6VWHKuEJuVD6070//lGwv0=\r
36 Received: by 10.204.115.73 with SMTP id h9mr1801bkq.22.1291933010214;\r
37         Thu, 09 Dec 2010 14:16:50 -0800 (PST)\r
38 Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80])\r
39         by mx.google.com with ESMTPS id\r
40         d11sm1213721bkd.22.2010.12.09.14.16.49\r
41         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
42         Thu, 09 Dec 2010 14:16:49 -0800 (PST)\r
43 From: Felipe Contreras <felipe.contreras@gmail.com>\r
44 To: notmuch@notmuchmail.org\r
45 Subject: [PATCH 1/3] vim: refactor tagging stuff\r
46 Date: Fri, 10 Dec 2010 00:16:23 +0200\r
47 Message-Id: <1291932985-5220-2-git-send-email-felipe.contreras@gmail.com>\r
48 X-Mailer: git-send-email 1.7.3.2\r
49 In-Reply-To: <1291932985-5220-1-git-send-email-felipe.contreras@gmail.com>\r
50 References: <1291932985-5220-1-git-send-email-felipe.contreras@gmail.com>\r
51 Cc: Felipe Contreras <felipe.contreras@ngmail.com>\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Thu, 09 Dec 2010 22:16:53 -0000\r
65 \r
66 From: Felipe Contreras <felipe.contreras@ngmail.com>\r
67 \r
68 Signed-off-by: Felipe Contreras <felipe.contreras@ngmail.com>\r
69 ---\r
70  vim/plugin/notmuch.vim |   18 ++++++++++--------\r
71  1 files changed, 10 insertions(+), 8 deletions(-)\r
72 \r
73 diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim\r
74 index 8d5d1c3..6898d56 100644\r
75 --- a/vim/plugin/notmuch.vim\r
76 +++ b/vim/plugin/notmuch.vim\r
77 @@ -307,12 +307,12 @@ function! s:NM_search_edit()\r
78  endfunction\r
79  \r
80  function! s:NM_search_archive_thread()\r
81 -        call <SID>NM_add_remove_tags([], '-', ['inbox'])\r
82 +        call <SID>NM_tag([], ['-inbox'])\r
83          norm j\r
84  endfunction\r
85  \r
86  function! s:NM_search_mark_read_then_archive_thread()\r
87 -        call <SID>NM_add_remove_tags([], '-', ['unread', 'inbox'])\r
88 +        call <SID>NM_tag([], ['-unread', '-inbox'])\r
89          norm j\r
90  endfunction\r
91  \r
92 @@ -403,7 +403,8 @@ function! s:NM_search_add_remove_tags(prompt, prefix, intags)\r
93          else\r
94                  let tags = a:intags\r
95          endif\r
96 -        call <SID>NM_add_remove_tags([], a:prefix, tags)\r
97 +        call map(tags, 'a:prefix . v:val')\r
98 +        call <SID>NM_tag([], tags)\r
99  endfunction\r
100  \r
101  " --- implement show screen {{{1\r
102 @@ -497,7 +498,7 @@ function! s:NM_show_archive_thread()\r
103  endfunction\r
104  \r
105  function! s:NM_show_mark_read_then_archive_thread()\r
106 -        call <SID>NM_add_remove_tags(b:nm_search_words, '-', ['unread', 'inbox'])\r
107 +        call <SID>NM_tag(b:nm_search_words, ['-unread', '-inbox'])\r
108          call <SID>NM_show_next_thread()\r
109  endfunction\r
110  \r
111 @@ -561,7 +562,8 @@ function! s:NM_show_advance_marking_read_and_archiving()\r
112                  let filter = <SID>NM_combine_tags('tag:', advance_tags, 'OR', '()')\r
113                           \ + ['AND']\r
114                           \ + <SID>NM_combine_tags('', ids, 'OR', '()')\r
115 -                call <SID>NM_add_remove_tags(filter, '-', advance_tags)\r
116 +                call map(advance_tags, '"+" . v:val')\r
117 +                call <SID>NM_tag(filter, advance_tags)\r
118                  call <SID>NM_show_next(1, 1)\r
119                  return\r
120          endif\r
121 @@ -580,7 +582,8 @@ function! s:NM_show_advance_marking_read_and_archiving()\r
122                          " do this last to hide the latency\r
123                          let filter = <SID>NM_combine_tags('tag:', advance_tags, 'OR', '()')\r
124                                   \ + ['AND', msg_top['id']]\r
125 -                        call <SID>NM_add_remove_tags(filter, '-', advance_tags)\r
126 +                        call map(advance_tags, '"-" . v:val')\r
127 +                        call <SID>NM_tag(filter, advance_tags)\r
128                  endif\r
129                  return\r
130          endif\r
131 @@ -1266,12 +1269,11 @@ function! s:NM_search_expand(arg)\r
132          let b:nm_prev_bufnr = prev_bufnr\r
133  endfunction\r
134  \r
135 -function! s:NM_add_remove_tags(filter, prefix, tags)\r
136 +function! s:NM_tag(filter, tags)\r
137          let filter = len(a:filter) ? a:filter : [<SID>NM_search_thread_id()]\r
138          if !len(filter)\r
139                  throw 'Eeek! I couldn''t find the thead id!'\r
140          endif\r
141 -        call map(a:tags, 'a:prefix . v:val')\r
142          let args = ['tag']\r
143          call extend(args, a:tags)\r
144          call add(args, '--')\r
145 -- \r
146 1.7.3.2\r
147 \r