Announcing Astroid v0.6
[notmuch-archives.git] / d5 / e16f01145eb61115ea5b5f02597318a58e8309
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 D060D42116C\r
6         for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 02:35:12 -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 kgX1aT4OPvJs for <notmuch@notmuchmail.org>;\r
18         Sun, 12 Feb 2012 02:35:10 -0800 (PST)\r
19 Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
20  [74.125.82.41])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  51313421169    for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 02:35:07 -0800\r
23  (PST)\r
24 Received: by wgbdt11 with SMTP id dt11so1612923wgb.2\r
25         for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 02:35:06 -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=inBFoIN+YD3t3yAPlqbFNynCCbHazzvDwB5QcTZkDvI=;\r
29         b=eOKJXiuCBM7lRYK9xI2hP2CtW/N7KZaFA6+CxAH3NvxdVF+AYWHB+UpIgwu2CKqrly\r
30         mCFjqu6thEufJNTmFZcftkq1x44VTuyYKJrIablSN6USWZSPGAL47z0zswLOstT1Syka\r
31         OC01Z8hElGXBDC7Du1nxQZ1F6d2LpxwmBJlxc=\r
32 Received: by 10.180.86.105 with SMTP id o9mr18628016wiz.4.1329042906040;\r
33         Sun, 12 Feb 2012 02:35:06 -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  dr5sm35849431wib.0.2012.02.12.02.35.04 (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Sun, 12 Feb 2012 02:35:05 -0800 (PST)\r
38 From: Mark Walters <markwalters1009@gmail.com>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [RFC PATCH 2/3] emacs: changes to other files to support notmuch-pick\r
41 Date: Sun, 12 Feb 2012 10:36:04 +0000\r
42 Message-Id: <1329042965-3871-2-git-send-email-markwalters1009@gmail.com>\r
43 X-Mailer: git-send-email 1.7.2.3\r
44 In-Reply-To: <87d39k1gvi.fsf@qmul.ac.uk>\r
45 References: <87d39k1gvi.fsf@qmul.ac.uk>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Sun, 12 Feb 2012 10:35:13 -0000\r
59 \r
60 ---\r
61  emacs/Makefile.local   |    3 ++-\r
62  emacs/notmuch-hello.el |   10 ++++++++++\r
63  emacs/notmuch-query.el |    4 +++-\r
64  emacs/notmuch-show.el  |   19 +++++++++++++++----\r
65  emacs/notmuch.el       |    8 ++++++++\r
66  5 files changed, 38 insertions(+), 6 deletions(-)\r
67 \r
68 diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
69 index 4fee0e8..2922d9e 100644\r
70 --- a/emacs/Makefile.local\r
71 +++ b/emacs/Makefile.local\r
72 @@ -14,7 +14,8 @@ emacs_sources := \\r
73         $(dir)/notmuch-message.el \\r
74         $(dir)/notmuch-crypto.el \\r
75         $(dir)/coolj.el \\r
76 -       $(dir)/notmuch-print.el\r
77 +       $(dir)/notmuch-print.el \\r
78 +       $(dir)/notmuch-pick.el\r
79  \r
80  emacs_images := \\r
81         $(srcdir)/$(dir)/notmuch-logo.png\r
82 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
83 index d17a30f..6d28a7e 100644\r
84 --- a/emacs/notmuch-hello.el\r
85 +++ b/emacs/notmuch-hello.el\r
86 @@ -27,6 +27,7 @@\r
87  (require 'notmuch-mua)\r
88  \r
89  (declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))\r
90 +(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))\r
91  (declare-function notmuch-poll "notmuch" ())\r
92  \r
93  (defcustom notmuch-hello-recent-searches-max 10\r
94 @@ -181,6 +182,14 @@ International Bureau of Weights and Measures."\r
95    (notmuch-search search notmuch-search-oldest-first nil nil\r
96                   #'notmuch-hello-search-continuation))\r
97  \r
98 +(defun notmuch-hello-pick (&optional search)\r
99 +  (interactive)\r
100 +  (unless (null search)\r
101 +    (setq search (notmuch-hello-trim search))\r
102 +    (let ((history-delete-duplicates t))\r
103 +      (add-to-history 'notmuch-search-history search)))\r
104 +  (notmuch-pick search))\r
105 +\r
106  (defun notmuch-hello-add-saved-search (widget)\r
107    (interactive)\r
108    (let ((search (widget-value\r
109 @@ -345,6 +354,7 @@ should be. Returns a cons cell `(tags-per-line width)'."\r
110      (define-key map (kbd "<C-tab>") 'widget-backward)\r
111      (define-key map "m" 'notmuch-mua-new-mail)\r
112      (define-key map "s" 'notmuch-hello-search)\r
113 +    (define-key map "z" 'notmuch-hello-pick)\r
114      map)\r
115    "Keymap for \"notmuch hello\" buffers.")\r
116  (fset 'notmuch-hello-mode-map notmuch-hello-mode-map)\r
117 diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el\r
118 index d66baea..b3c91a3 100644\r
119 --- a/emacs/notmuch-query.el\r
120 +++ b/emacs/notmuch-query.el\r
121 @@ -22,7 +22,7 @@\r
122  (require 'notmuch-lib)\r
123  (require 'json)\r
124  \r
125 -(defun notmuch-query-get-threads (search-terms)\r
126 +(defun notmuch-query-get-threads (search-terms &rest extra-format)\r
127    "Return a list of threads of messages matching SEARCH-TERMS.\r
128  \r
129  A thread is a forest or list of trees. A tree is a two element\r
130 @@ -33,6 +33,8 @@ is a possibly empty forest of replies.\r
131          (json-object-type 'plist)\r
132          (json-array-type 'list)\r
133          (json-false 'nil))\r
134 +    (if extra-format\r
135 +       (setq args (append args extra-format)))\r
136      (if notmuch-show-process-crypto\r
137         (setq args (append args '("--decrypt"))))\r
138      (setq args (append args search-terms))\r
139 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
140 index 24fde05..825f7fe 100644\r
141 --- a/emacs/notmuch-show.el\r
142 +++ b/emacs/notmuch-show.el\r
143 @@ -42,6 +42,7 @@\r
144  (declare-function notmuch-search-next-thread "notmuch" nil)\r
145  (declare-function notmuch-search-show-thread "notmuch" nil)\r
146  (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))\r
147 +(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))\r
148  \r
149  (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
150    "Headers that should be shown in a message, in this order.\r
151 @@ -962,7 +963,7 @@ a corresponding notmuch search."\r
152                         'face goto-address-mail-face))))\r
153  \r
154  ;;;###autoload\r
155 -(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)\r
156 +(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch just-matches)\r
157    "Run \"notmuch show\" with the given thread ID and display results.\r
158  \r
159  The optional PARENT-BUFFER is the notmuch-search buffer from\r
160 @@ -986,9 +987,9 @@ buffer."\r
161    (let* ((process-crypto (if crypto-switch\r
162                              (not notmuch-crypto-process-mime)\r
163                            notmuch-crypto-process-mime)))\r
164 -    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))\r
165 +    (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto just-matches)))\r
166  \r
167 -(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto)\r
168 +(defun notmuch-show-worker (thread-id parent-buffer query-context buffer-name process-crypto &optional just-matches)\r
169    (let* ((buffer-name (generate-new-buffer-name\r
170                        (or buffer-name\r
171                            (concat "*notmuch-" thread-id "*"))))\r
172 @@ -1012,6 +1013,8 @@ buffer."\r
173              (args (if query-context\r
174                        (append (list "\'") basic-args (list "and (" query-context ")\'"))\r
175                      (append (list "\'") basic-args (list "\'")))))\r
176 +       (if just-matches\r
177 +           (setq args (append (list "--thread=none") args)))\r
178         (notmuch-show-insert-forest (notmuch-query-get-threads args))\r
179         ;; If the query context reduced the results to nothing, run\r
180         ;; the basic query.\r
181 @@ -1031,7 +1034,8 @@ buffer."\r
182      ;; Set the header line to the subject of the first open message.\r
183      (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject)))\r
184  \r
185 -    (notmuch-show-mark-read)))\r
186 +    (notmuch-show-mark-read)\r
187 +    buffer))\r
188  \r
189  (defun notmuch-show-refresh-view (&optional crypto-switch)\r
190    "Refresh the current view (with crypto switch if prefix given).\r
191 @@ -1073,6 +1077,8 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
192         (define-key map (kbd "<backtab>") 'notmuch-show-previous-button)\r
193         (define-key map (kbd "TAB") 'notmuch-show-next-button)\r
194         (define-key map "s" 'notmuch-search)\r
195 +       (define-key map "z" 'notmuch-pick)\r
196 +       (define-key map "Z" 'notmuch-show-pick-current-query)\r
197         (define-key map "m" 'notmuch-mua-new-mail)\r
198         (define-key map "f" 'notmuch-show-forward-message)\r
199         (define-key map "r" 'notmuch-show-reply-sender)\r
200 @@ -1476,6 +1482,11 @@ to show, nil otherwise."\r
201    (notmuch-show-mark-read)\r
202    (notmuch-show-message-adjust))\r
203  \r
204 +(defun notmuch-show-pick-current-query ()\r
205 +  "Call notmuch pick with the current query"\r
206 +  (interactive)\r
207 +  (notmuch-pick notmuch-show-thread-id notmuch-show-query-context))\r
208 +\r
209  (defun notmuch-show-view-raw-message ()\r
210    "View the file holding the current message."\r
211    (interactive)\r
212 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
213 index 8250961..e95842e 100644\r
214 --- a/emacs/notmuch.el\r
215 +++ b/emacs/notmuch.el\r
216 @@ -54,6 +54,7 @@\r
217  \r
218  (require 'notmuch-lib)\r
219  (require 'notmuch-show)\r
220 +(require 'notmuch-pick)\r
221  (require 'notmuch-mua)\r
222  (require 'notmuch-hello)\r
223  (require 'notmuch-maildir-fcc)\r
224 @@ -272,6 +273,8 @@ For a mouse binding, return nil."\r
225      (define-key map "R" 'notmuch-search-reply-to-thread)\r
226      (define-key map "m" 'notmuch-mua-new-mail)\r
227      (define-key map "s" 'notmuch-search)\r
228 +    (define-key map "z" 'notmuch-pick)\r
229 +    (define-key map "Z" 'notmuch-search-pick-current-query)\r
230      (define-key map "o" 'notmuch-search-toggle-order)\r
231      (define-key map "c" 'notmuch-search-stash-map)\r
232      (define-key map "=" 'notmuch-search-refresh-view)\r
233 @@ -1021,6 +1024,11 @@ same relative position within the new buffer."\r
234      (notmuch-search query oldest-first target-thread target-line continuation)\r
235      (goto-char (point-min))))\r
236  \r
237 +(defun notmuch-search-pick-current-query ()\r
238 +  "Call notmuch pick with the current query"\r
239 +  (interactive)\r
240 +  (notmuch-pick notmuch-search-query-string))\r
241 +\r
242  (defcustom notmuch-poll-script nil\r
243    "An external script to incorporate new mail into the notmuch database.\r
244  \r
245 -- \r
246 1.7.2.3\r
247 \r