database error
[notmuch-archives.git] / 0d / 12459c96d0564d12e0372092039f44b4501e2d
1 Return-Path: <jrollins@finestructure.net>\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 1405240F3E5\r
6         for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:29 -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: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 1uhlcanHSDCf for <notmuch@notmuchmail.org>;\r
16         Sat,  7 Jan 2012 14:28:26 -0800 (PST)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id 7199540EF0C\r
20         for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:24 -0800 (PST)\r
21 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by earth-doxen-postvirus (Postfix) with ESMTP id 2394566E00BD\r
23         for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:24 -0800 (PST)\r
24 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
25 Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com\r
26         [76.174.137.84]) (Authenticated sender: jrollins)\r
27         by earth-doxen-submit (Postfix) with ESMTP id 6716D66E012E\r
28         for <notmuch@notmuchmail.org>; Sat,  7 Jan 2012 14:28:21 -0800 (PST)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id CE75F52; Sat,  7 Jan 2012 14:28:20 -0800 (PST)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: [PATCH 1/4] emacs: new customization variable to exclude "deleted" messages from search\r
34 Date: Sat,  7 Jan 2012 14:28:11 -0800\r
35 Message-Id: <1325975294-646-2-git-send-email-jrollins@finestructure.net>\r
36 X-Mailer: git-send-email 1.7.7.3\r
37 In-Reply-To: <1325975294-646-1-git-send-email-jrollins@finestructure.net>\r
38 References: <1325975294-646-1-git-send-email-jrollins@finestructure.net>\r
39 MIME-Version: 1.0\r
40 Content-Type: text/plain; charset=UTF-8\r
41 Content-Transfer-Encoding: 8bit\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Sat, 07 Jan 2012 22:28:29 -0000\r
55 \r
56 The new customization variable, notmuch-search-exclude-deleted, when\r
57 set to t, will exclude any messages with the "deleted" tag from\r
58 searches.\r
59 \r
60 Additionally, specifying "tag:deleted" in the search directly will\r
61 override the exclusion and will included deleted messages in the\r
62 search results.\r
63 ---\r
64  emacs/notmuch.el                                   |    8 ++++\r
65  test/emacs                                         |   42 ++++++++++++++++++++\r
66  .../notmuch-search-tag-inbox-deleted-excluded      |   24 +++++++++++\r
67  3 files changed, 74 insertions(+), 0 deletions(-)\r
68  create mode 100644 test/emacs.expected-output/notmuch-search-tag-inbox-deleted-excluded\r
69 \r
70 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
71 index fde2377..c519687 100644\r
72 --- a/emacs/notmuch.el\r
73 +++ b/emacs/notmuch.el\r
74 @@ -905,6 +905,11 @@ PROMPT is the string to prompt with."\r
75        (read-from-minibuffer prompt nil keymap nil\r
76                             'notmuch-query-history nil nil))))\r
77  \r
78 +(defcustom notmuch-search-exclude-deleted nil\r
79 +  "Exclude deleted messages (with \"deleted\" tag) from search results."\r
80 +  :group 'notmuch\r
81 +  :type 'boolean)\r
82 +\r
83  ;;;###autoload\r
84  (defun notmuch-search (query &optional oldest-first target-thread target-line continuation)\r
85    "Run \"notmuch search\" with the given query string and display results.\r
86 @@ -927,6 +932,9 @@ The optional parameters are used as follows:\r
87      (set 'notmuch-search-target-thread target-thread)\r
88      (set 'notmuch-search-target-line target-line)\r
89      (set 'notmuch-search-continuation continuation)\r
90 +    (when (and notmuch-search-exclude-deleted\r
91 +              (not (string-match "tag:deleted[ )]*" query)))\r
92 +      (setq query (concat query " and not tag:deleted")))\r
93      (let ((proc (get-buffer-process (current-buffer)))\r
94           (inhibit-read-only t))\r
95        (if proc\r
96 diff --git a/test/emacs b/test/emacs\r
97 index a06c223..1d78fbe 100755\r
98 --- a/test/emacs\r
99 +++ b/test/emacs\r
100 @@ -35,6 +35,48 @@ test_emacs '(notmuch-search "tag:inbox")\r
101             (test-output)'\r
102  test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox\r
103  \r
104 +test_begin_subtest "Exclude \"deleted\" messages from search"\r
105 +notmuch tag +deleted id:1258506353-20352-1-git-send-email-stewart@flamingspork.com\r
106 +# we "delete" a second message that's part of a multi-message thread\r
107 +# to make sure the rest of the thread is still returned\r
108 +notmuch tag +deleted id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\r
109 +test_emacs '(let ((notmuch-search-exclude-deleted t))\r
110 +             (notmuch-search "tag:inbox")\r
111 +             (notmuch-test-wait)\r
112 +             (test-output))'\r
113 +notmuch tag -deleted id:1258506353-20352-1-git-send-email-stewart@flamingspork.com\r
114 +notmuch tag -deleted id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\r
115 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox-deleted-excluded\r
116 +\r
117 +test_begin_subtest "Exclude \"deleted\" messages from search, manual override"\r
118 +notmuch tag +deleted id:1258506353-20352-1-git-send-email-stewart@flamingspork.com\r
119 +notmuch tag +deleted id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\r
120 +cat <<EOF >EXPECTED\r
121 +  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (deleted inbox unread)\r
122 +  2009-11-17 [1/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (deleted inbox unread)\r
123 +End of search results.\r
124 +EOF\r
125 +test_emacs '(let ((notmuch-search-exclude-deleted t))\r
126 +             (notmuch-search "tag:inbox and tag:deleted")\r
127 +             (notmuch-test-wait)\r
128 +             (test-output))'\r
129 +notmuch tag -deleted id:1258506353-20352-1-git-send-email-stewart@flamingspork.com\r
130 +notmuch tag -deleted id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net\r
131 +test_expect_equal_file OUTPUT EXPECTED\r
132 +\r
133 +test_begin_subtest "Exclude \"deleted\" messages from search, but not \"deleted*\""\r
134 +notmuch tag +deleted-patch id:1258506353-20352-1-git-send-email-stewart@flamingspork.com\r
135 +cat <<EOF >EXPECTED\r
136 +  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (deleted-patch inbox unread)\r
137 +End of search results.\r
138 +EOF\r
139 +test_emacs '(let ((notmuch-search-exclude-deleted t))\r
140 +             (notmuch-search "tag:inbox and tag:deleted-patch")\r
141 +             (notmuch-test-wait)\r
142 +             (test-output))'\r
143 +notmuch tag -deleted-patch id:1258506353-20352-1-git-send-email-stewart@flamingspork.com\r
144 +test_expect_equal_file OUTPUT EXPECTED\r
145 +\r
146  test_begin_subtest "Navigation of notmuch-hello to search results"\r
147  test_emacs '(notmuch-hello)\r
148             (goto-char (point-min))\r
149 diff --git a/test/emacs.expected-output/notmuch-search-tag-inbox-deleted-excluded b/test/emacs.expected-output/notmuch-search-tag-inbox-deleted-excluded\r
150 new file mode 100644\r
151 index 0000000..39b4c51\r
152 --- /dev/null\r
153 +++ b/test/emacs.expected-output/notmuch-search-tag-inbox-deleted-excluded\r
154 @@ -0,0 +1,24 @@\r
155 +  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)\r
156 +  2010-12-16 [1/1]   Olivier Berger       Essai accentuĂ© (inbox unread)\r
157 +  2009-11-18 [1/1]   Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)\r
158 +  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)\r
159 +  2009-11-18 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)\r
160 +  2009-11-18 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)\r
161 +  2009-11-18 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)\r
162 +  2009-11-18 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)\r
163 +  2009-11-18 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)\r
164 +  2009-11-18 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)\r
165 +  2009-11-18 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)\r
166 +  2009-11-18 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)\r
167 +  2009-11-18 [4/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (deleted inbox unread)\r
168 +  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)\r
169 +  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)\r
170 +  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)\r
171 +  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)\r
172 +  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)\r
173 +  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before statting (inbox unread)\r
174 +  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox unread)\r
175 +  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)\r
176 +  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)\r
177 +  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)\r
178 +End of search results.\r
179 -- \r
180 1.7.7.3\r
181 \r