[PATCH] test/thread-order: more robust loop exit in case of broken input
[notmuch-archives.git] / b2 / ed1b396ca30f150b7b66359faff4a04a0cb0fa
1 Return-Path: <markwalters1009@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 4F64B431FAE\r
6         for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 10:49:07 -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.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id GFyqhS6Y0BRG for <notmuch@notmuchmail.org>;\r
18         Sun, 12 Feb 2012 10:49:06 -0800 (PST)\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
20         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id EEED7421174\r
23         for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
24 Received: by mail-we0-f181.google.com with SMTP id p13so3496132wer.26\r
25         for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=lAwVjTYKvJJpCqq8sV62WiDakJy5ni5otlUt7m6Kl5Y=;\r
29         b=gHz0oVt8jEM+Yd/CK+s3pKiNXB5I3y0Y502WYN5Nw+3gKSI34YLuNEPXmKzQAZ4ba9\r
30         Ojzj0MsOp40kZrVqr8/nSDpunf1r7vh137YtTK2Ne5E2SWk0SfBMjJfscToQtlqaAK1g\r
31         /9aKdUgMU1GcmtkYQ219iYsfuX1GMsX2WOk0w=\r
32 Received: by 10.180.14.193 with SMTP id r1mr14030520wic.9.1329072544745;\r
33         Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
34 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
35  [94.192.233.223])      by mx.google.com with ESMTPS id\r
36  dr5sm39272463wib.0.2012.02.12.10.49.03 (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
38 From: Mark Walters <markwalters1009@gmail.com>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [RFC PATCH v2 2/3] emacs: changes to other files to support\r
41         notmuch-pick\r
42 Date: Sun, 12 Feb 2012 18:49:38 +0000\r
43 Message-Id: <1329072579-27340-3-git-send-email-markwalters1009@gmail.com>\r
44 X-Mailer: git-send-email 1.7.2.3\r
45 In-Reply-To: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\r
46 References: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Sun, 12 Feb 2012 18:49:07 -0000\r
60 \r
61 ---\r
62  emacs/Makefile.local   |    3 ++-\r
63  emacs/notmuch-hello.el |   10 ++++++++++\r
64  emacs/notmuch-lib.el   |    4 ++++\r
65  emacs/notmuch-query.el |    4 +++-\r
66  emacs/notmuch-show.el  |   25 ++++++++++++++++++++++---\r
67  emacs/notmuch.el       |    8 ++++++++\r
68  6 files changed, 49 insertions(+), 5 deletions(-)\r
69 \r
70 diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
71 index 4fee0e8..2922d9e 100644\r
72 --- a/emacs/Makefile.local\r
73 +++ b/emacs/Makefile.local\r
74 @@ -14,7 +14,8 @@ emacs_sources := \\r
75         $(dir)/notmuch-message.el \\r
76         $(dir)/notmuch-crypto.el \\r
77         $(dir)/coolj.el \\r
78 -       $(dir)/notmuch-print.el\r
79 +       $(dir)/notmuch-print.el \\r
80 +       $(dir)/notmuch-pick.el\r
81  \r
82  emacs_images := \\r
83         $(srcdir)/$(dir)/notmuch-logo.png\r
84 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
85 index d17a30f..6d28a7e 100644\r
86 --- a/emacs/notmuch-hello.el\r
87 +++ b/emacs/notmuch-hello.el\r
88 @@ -27,6 +27,7 @@\r
89  (require 'notmuch-mua)\r
90  \r
91  (declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))\r
92 +(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))\r
93  (declare-function notmuch-poll "notmuch" ())\r
94  \r
95  (defcustom notmuch-hello-recent-searches-max 10\r
96 @@ -181,6 +182,14 @@ International Bureau of Weights and Measures."\r
97    (notmuch-search search notmuch-search-oldest-first nil nil\r
98                   #'notmuch-hello-search-continuation))\r
99  \r
100 +(defun notmuch-hello-pick (&optional search)\r
101 +  (interactive)\r
102 +  (unless (null search)\r
103 +    (setq search (notmuch-hello-trim search))\r
104 +    (let ((history-delete-duplicates t))\r
105 +      (add-to-history 'notmuch-search-history search)))\r
106 +  (notmuch-pick search))\r
107 +\r
108  (defun notmuch-hello-add-saved-search (widget)\r
109    (interactive)\r
110    (let ((search (widget-value\r
111 @@ -345,6 +354,7 @@ should be. Returns a cons cell `(tags-per-line width)'."\r
112      (define-key map (kbd "<C-tab>") 'widget-backward)\r
113      (define-key map "m" 'notmuch-mua-new-mail)\r
114      (define-key map "s" 'notmuch-hello-search)\r
115 +    (define-key map "z" 'notmuch-hello-pick)\r
116      map)\r
117    "Keymap for \"notmuch hello\" buffers.")\r
118  (fset 'notmuch-hello-mode-map notmuch-hello-mode-map)\r
119 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
120 index d315f76..b88bb80 100644\r
121 --- a/emacs/notmuch-lib.el\r
122 +++ b/emacs/notmuch-lib.el\r
123 @@ -40,6 +40,10 @@\r
124    "Showing messages and threads."\r
125    :group 'notmuch)\r
126  \r
127 +(defgroup notmuch-pick nil\r
128 +  "Showing message and thread structure."\r
129 +  :group 'notmuch)\r
130 +\r
131  (defgroup notmuch-send nil\r
132    "Sending messages from Notmuch."\r
133    :group 'notmuch)\r
134 diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el\r
135 index d66baea..b3c91a3 100644\r
136 --- a/emacs/notmuch-query.el\r
137 +++ b/emacs/notmuch-query.el\r
138 @@ -22,7 +22,7 @@\r
139  (require 'notmuch-lib)\r
140  (require 'json)\r
141  \r
142 -(defun notmuch-query-get-threads (search-terms)\r
143 +(defun notmuch-query-get-threads (search-terms &rest extra-format)\r
144    "Return a list of threads of messages matching SEARCH-TERMS.\r
145  \r
146  A thread is a forest or list of trees. A tree is a two element\r
147 @@ -33,6 +33,8 @@ is a possibly empty forest of replies.\r
148          (json-object-type 'plist)\r
149          (json-array-type 'list)\r
150          (json-false 'nil))\r
151 +    (if extra-format\r
152 +       (setq args (append args extra-format)))\r
153      (if notmuch-show-process-crypto\r
154         (setq args (append args '("--decrypt"))))\r
155      (setq args (append args search-terms))\r
156 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
157 index 43408d9..1adf964 100644\r
158 --- a/emacs/notmuch-show.el\r
159 +++ b/emacs/notmuch-show.el\r
160 @@ -42,6 +42,7 @@\r
161  (declare-function notmuch-search-next-thread "notmuch" nil)\r
162  (declare-function notmuch-search-show-thread "notmuch" nil)\r
163  (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))\r
164 +(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))\r
165  \r
166  (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
167    "Headers that should be shown in a message, in this order.\r
168 @@ -151,6 +152,12 @@ indentation."\r
169  (make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)\r
170  (put 'notmuch-show-elide-non-matching-messages 'permanent-local t)\r
171  \r
172 +;; This is very similar to the previous variable: they should be\r
173 +;; unified. MJW\r
174 +(defvar notmuch-show-just-matches nil)\r
175 +(make-variable-buffer-local 'notmuch-show-just-matches)\r
176 +(put 'notmuch-show-just-matches 'permanent-local t)\r
177 +\r
178  (defvar notmuch-show-indent-content t)\r
179  (make-variable-buffer-local 'notmuch-show-indent-content)\r
180  (put 'notmuch-show-indent-content 'permanent-local t)\r
181 @@ -1013,7 +1020,7 @@ a corresponding notmuch search."\r
182                         'face goto-address-mail-face))))\r
183  \r
184  ;;;###autoload\r
185 -(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)\r
186 +(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name just-matches)\r
187    "Run \"notmuch show\" with the given thread ID and display results.\r
188  \r
189  The optional PARENT-BUFFER is the notmuch-search buffer from\r
190 @@ -1046,8 +1053,11 @@ function is used."\r
191  \r
192      (setq notmuch-show-thread-id thread-id\r
193           notmuch-show-parent-buffer parent-buffer\r
194 -         notmuch-show-query-context query-context)\r
195 -    (notmuch-show-worker)))\r
196 +         notmuch-show-query-context query-context\r
197 +         notmuch-show-just-matches just-matches)\r
198 +\r
199 +    (notmuch-show-worker)\r
200 +    (current-buffer)))\r
201  \r
202  (defun notmuch-show-worker ()\r
203    (let ((inhibit-read-only t))\r
204 @@ -1064,6 +1074,8 @@ function is used."\r
205                        (append (list "\'") basic-args\r
206                                (list "and (" notmuch-show-query-context ")\'"))\r
207                      (append (list "\'") basic-args (list "\'")))))\r
208 +       (if notmuch-show-just-matches\r
209 +           (setq args (append (list "--thread=none") args)))\r
210         (notmuch-show-insert-forest (notmuch-query-get-threads args))\r
211         ;; If the query context reduced the results to nothing, run\r
212         ;; the basic query.\r
213 @@ -1158,6 +1170,8 @@ buffer is stored and re-applied after the refresh."\r
214         (define-key map (kbd "<backtab>") 'notmuch-show-previous-button)\r
215         (define-key map (kbd "TAB") 'notmuch-show-next-button)\r
216         (define-key map "s" 'notmuch-search)\r
217 +       (define-key map "z" 'notmuch-pick)\r
218 +       (define-key map "Z" 'notmuch-show-pick-current-query)\r
219         (define-key map "m" 'notmuch-mua-new-mail)\r
220         (define-key map "f" 'notmuch-show-forward-message)\r
221         (define-key map "r" 'notmuch-show-reply-sender)\r
222 @@ -1565,6 +1579,11 @@ to show, nil otherwise."\r
223    (notmuch-show-mark-read)\r
224    (notmuch-show-message-adjust))\r
225  \r
226 +(defun notmuch-show-pick-current-query ()\r
227 +  "Call notmuch pick with the current query"\r
228 +  (interactive)\r
229 +  (notmuch-pick notmuch-show-thread-id notmuch-show-query-context))\r
230 +\r
231  (defun notmuch-show-view-raw-message ()\r
232    "View the file holding the current message."\r
233    (interactive)\r
234 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
235 index 5b4f1c5..43e77d0 100644\r
236 --- a/emacs/notmuch.el\r
237 +++ b/emacs/notmuch.el\r
238 @@ -54,6 +54,7 @@\r
239  \r
240  (require 'notmuch-lib)\r
241  (require 'notmuch-show)\r
242 +(require 'notmuch-pick)\r
243  (require 'notmuch-mua)\r
244  (require 'notmuch-hello)\r
245  (require 'notmuch-maildir-fcc)\r
246 @@ -272,6 +273,8 @@ For a mouse binding, return nil."\r
247      (define-key map "R" 'notmuch-search-reply-to-thread)\r
248      (define-key map "m" 'notmuch-mua-new-mail)\r
249      (define-key map "s" 'notmuch-search)\r
250 +    (define-key map "z" 'notmuch-pick)\r
251 +    (define-key map "Z" 'notmuch-search-pick-current-query)\r
252      (define-key map "o" 'notmuch-search-toggle-order)\r
253      (define-key map "c" 'notmuch-search-stash-map)\r
254      (define-key map "=" 'notmuch-search-refresh-view)\r
255 @@ -1021,6 +1024,11 @@ same relative position within the new buffer."\r
256      (notmuch-search query oldest-first target-thread target-line continuation)\r
257      (goto-char (point-min))))\r
258  \r
259 +(defun notmuch-search-pick-current-query ()\r
260 +  "Call notmuch pick with the current query"\r
261 +  (interactive)\r
262 +  (notmuch-pick notmuch-search-query-string))\r
263 +\r
264  (defcustom notmuch-poll-script nil\r
265    "An external script to incorporate new mail into the notmuch database.\r
266  \r
267 -- \r
268 1.7.2.3\r
269 \r