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 410F2431FBD
\r
6 for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:14 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 7IKskeKAT7Qm for <notmuch@notmuchmail.org>;
\r
16 Sun, 19 Aug 2012 18:53:12 -0700 (PDT)
\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu
\r
19 by olra.theworths.org (Postfix) with ESMTP id 87F16431FC3
\r
20 for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:08 -0700 (PDT)
\r
21 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])
\r
22 by fire-doxen-postvirus (Postfix) with ESMTP id C0E81328018
\r
23 for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:07 -0700 (PDT)
\r
24 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new
\r
25 Received: from finestructure.net (unknown [76.89.192.57])
\r
26 (Authenticated sender: jrollins)
\r
27 by fire-doxen-submit (Postfix) with ESMTP id B89122E50D82
\r
28 for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:05 -0700 (PDT)
\r
29 Received: by finestructure.net (Postfix, from userid 1000)
\r
30 id E312BCF3; Sun, 19 Aug 2012 18:53:03 -0700 (PDT)
\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>
\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
33 Subject: [PATCH 09/11] emacs: add ability to show recipients instead of author
\r
35 Date: Sun, 19 Aug 2012 18:52:48 -0700
\r
36 Message-Id: <1345427570-26518-10-git-send-email-jrollins@finestructure.net>
\r
37 X-Mailer: git-send-email 1.7.10.4
\r
38 In-Reply-To: <1345427570-26518-9-git-send-email-jrollins@finestructure.net>
\r
39 References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net>
\r
40 <1345427570-26518-2-git-send-email-jrollins@finestructure.net>
\r
41 <1345427570-26518-3-git-send-email-jrollins@finestructure.net>
\r
42 <1345427570-26518-4-git-send-email-jrollins@finestructure.net>
\r
43 <1345427570-26518-5-git-send-email-jrollins@finestructure.net>
\r
44 <1345427570-26518-6-git-send-email-jrollins@finestructure.net>
\r
45 <1345427570-26518-7-git-send-email-jrollins@finestructure.net>
\r
46 <1345427570-26518-8-git-send-email-jrollins@finestructure.net>
\r
47 <1345427570-26518-9-git-send-email-jrollins@finestructure.net>
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Mon, 20 Aug 2012 01:53:14 -0000
\r
62 A new boolean argument is added to notmuch-search to control whether
\r
63 thread authors or recipients are shown in the 'authors' field.
\r
65 emacs/notmuch-hello.el | 6 +++---
\r
66 emacs/notmuch.el | 40 +++++++++++++++++++++++++++++-----------
\r
67 2 files changed, 32 insertions(+), 14 deletions(-)
\r
69 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
70 index 684bedc..4615cf6 100644
\r
71 --- a/emacs/notmuch-hello.el
\r
72 +++ b/emacs/notmuch-hello.el
\r
74 (require 'notmuch-lib)
\r
75 (require 'notmuch-mua)
\r
77 -(declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))
\r
78 +(declare-function notmuch-search "notmuch" (query &optional oldest-first show-recipients target-thread target-line continuation))
\r
79 (declare-function notmuch-poll "notmuch" ())
\r
81 (defcustom notmuch-hello-recent-searches-max 10
\r
82 @@ -280,7 +280,7 @@ afterwards.")
\r
83 (setq search (notmuch-hello-trim search))
\r
84 (let ((history-delete-duplicates t))
\r
85 (add-to-history 'notmuch-search-history search)))
\r
86 - (notmuch-search search notmuch-search-oldest-first nil nil
\r
87 + (notmuch-search search notmuch-search-oldest-first nil nil nil
\r
88 #'notmuch-hello-search-continuation))
\r
90 (defun notmuch-hello-add-saved-search (widget)
\r
91 @@ -331,7 +331,7 @@ diagonal."
\r
92 (notmuch-search (widget-get widget
\r
93 :notmuch-search-terms)
\r
94 notmuch-search-oldest-first
\r
95 - nil nil #'notmuch-hello-search-continuation))
\r
96 + nil nil nil #'notmuch-hello-search-continuation))
\r
98 (defun notmuch-saved-search-count (search)
\r
99 (car (process-lines notmuch-command "count" search)))
\r
100 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
101 index 7b61e9b..d05b1e8 100644
\r
102 --- a/emacs/notmuch.el
\r
103 +++ b/emacs/notmuch.el
\r
104 @@ -254,6 +254,7 @@ For a mouse binding, return nil."
\r
105 (notmuch-common-do-stash (notmuch-search-find-thread-id)))
\r
107 (defvar notmuch-search-query-string)
\r
108 +(defvar notmuch-search-show-recipients)
\r
109 (defvar notmuch-search-target-thread)
\r
110 (defvar notmuch-search-target-line)
\r
111 (defvar notmuch-search-continuation)
\r
112 @@ -405,6 +406,7 @@ Complete list of currently available key bindings:
\r
113 (make-local-variable 'notmuch-search-oldest-first)
\r
114 (make-local-variable 'notmuch-search-target-thread)
\r
115 (make-local-variable 'notmuch-search-target-line)
\r
116 + (make-local-variable 'notmuch-search-show-recipients)
\r
117 (set (make-local-variable 'notmuch-search-continuation) nil)
\r
118 (set (make-local-variable 'scroll-preserve-screen-position) t)
\r
119 (add-to-invisibility-spec (cons 'ellipsis t))
\r
120 @@ -781,7 +783,10 @@ non-authors is found, assume that all of the authors match."
\r
121 'face 'notmuch-search-subject)))
\r
123 ((string-equal field "authors")
\r
124 - (notmuch-search-insert-authors format-string (plist-get result :authors)))
\r
125 + (notmuch-search-insert-authors format-string
\r
126 + (if notmuch-search-show-recipients
\r
127 + (plist-get result :recipients)
\r
128 + (plist-get result :authors))))
\r
130 ((string-equal field "tags")
\r
131 (let ((tags-str (mapconcat 'identity (plist-get result :tags) " ")))
\r
132 @@ -931,13 +936,16 @@ PROMPT is the string to prompt with."
\r
133 'notmuch-search-history nil nil)))))
\r
136 -(defun notmuch-search (&optional query oldest-first target-thread target-line continuation)
\r
137 +(defun notmuch-search (&optional query oldest-first show-recipients target-thread target-line continuation)
\r
138 "Run \"notmuch search\" with the given `query' and display results.
\r
140 If `query' is nil, it is read interactively from the minibuffer.
\r
141 Other optional parameters are used as follows:
\r
143 oldest-first: A Boolean controlling the sort order of returned threads
\r
144 + show-recipients: A Boolean controlling whether or not thread
\r
145 + recipients instead of authors are shown in the
\r
147 target-thread: A thread ID (without the thread: prefix) that will be made
\r
148 current if it appears in the search results.
\r
149 target-line: The line number to move to if the target thread does not
\r
150 @@ -952,25 +960,34 @@ Other optional parameters are used as follows:
\r
151 (set 'buffer-undo-list t)
\r
152 (set 'notmuch-search-query-string query)
\r
153 (set 'notmuch-search-oldest-first oldest-first)
\r
154 + (set 'notmuch-search-show-recipients show-recipients)
\r
155 (set 'notmuch-search-target-thread target-thread)
\r
156 (set 'notmuch-search-target-line target-line)
\r
157 (set 'notmuch-search-continuation continuation)
\r
158 (let ((proc (get-buffer-process (current-buffer)))
\r
160 + "notmuch-search" buffer
\r
161 + notmuch-command "search"
\r
164 + "--sort=oldest-first"
\r
165 + "--sort=newest-first")))
\r
166 (inhibit-read-only t))
\r
167 + (if show-recipients
\r
168 + (setq proc-args (append proc-args '("--include-recipients"))))
\r
170 (error "notmuch search process already running for query `%s'" query)
\r
173 (goto-char (point-min))
\r
175 - (let ((proc (start-process
\r
176 - "notmuch-search" buffer
\r
177 - notmuch-command "search"
\r
180 - "--sort=oldest-first"
\r
181 - "--sort=newest-first")
\r
184 + ;; start-process insists on non-nil string arguments.
\r
185 + ;; This is annoying for variable length argument lists.
\r
186 + ;; We use apply here so that we can construct the
\r
187 + ;; start-process argument list ahead of time (instead of
\r
188 + ;; at invocation) to avoid nils.
\r
189 + (proc (apply 'start-process (append proc-args (list query))))
\r
190 ;; Use a scratch buffer to accumulate partial output.
\r
191 ;; This buffer will be killed by the sentinel, which
\r
192 ;; should be called no matter how the process dies.
\r
193 @@ -995,11 +1012,12 @@ same relative position within the new buffer."
\r
195 (let ((target-line (line-number-at-pos))
\r
196 (oldest-first notmuch-search-oldest-first)
\r
197 + (show-recipients notmuch-search-show-recipients)
\r
198 (target-thread (notmuch-search-find-thread-id 'bare))
\r
199 (query notmuch-search-query-string)
\r
200 (continuation notmuch-search-continuation))
\r
201 (notmuch-kill-this-buffer)
\r
202 - (notmuch-search query oldest-first target-thread target-line continuation)
\r
203 + (notmuch-search query oldest-first show-recipients target-thread target-line continuation)
\r
204 (goto-char (point-min))))
\r
206 (defcustom notmuch-poll-script nil
\r