--- /dev/null
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 410F2431FBD\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:14 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 7IKskeKAT7Qm for <notmuch@notmuchmail.org>;\r
+ Sun, 19 Aug 2012 18:53:12 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+ [131.215.239.19])\r
+ by olra.theworths.org (Postfix) with ESMTP id 87F16431FC3\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:08 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+ by fire-doxen-postvirus (Postfix) with ESMTP id C0E81328018\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:07 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.192.57])\r
+ (Authenticated sender: jrollins)\r
+ by fire-doxen-submit (Postfix) with ESMTP id B89122E50D82\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:05 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+ id E312BCF3; Sun, 19 Aug 2012 18:53:03 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 09/11] emacs: add ability to show recipients instead of author\r
+ in search\r
+Date: Sun, 19 Aug 2012 18:52:48 -0700\r
+Message-Id: <1345427570-26518-10-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1345427570-26518-9-git-send-email-jrollins@finestructure.net>\r
+References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-2-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-3-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-4-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-5-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-6-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-7-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-8-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-9-git-send-email-jrollins@finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 20 Aug 2012 01:53:14 -0000\r
+\r
+A new boolean argument is added to notmuch-search to control whether\r
+thread authors or recipients are shown in the 'authors' field.\r
+---\r
+ emacs/notmuch-hello.el | 6 +++---\r
+ emacs/notmuch.el | 40 +++++++++++++++++++++++++++++-----------\r
+ 2 files changed, 32 insertions(+), 14 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 684bedc..4615cf6 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -26,7 +26,7 @@\r
+ (require 'notmuch-lib)\r
+ (require 'notmuch-mua)\r
+ \r
+-(declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))\r
++(declare-function notmuch-search "notmuch" (query &optional oldest-first show-recipients target-thread target-line continuation))\r
+ (declare-function notmuch-poll "notmuch" ())\r
+ \r
+ (defcustom notmuch-hello-recent-searches-max 10\r
+@@ -280,7 +280,7 @@ afterwards.")\r
+ (setq search (notmuch-hello-trim search))\r
+ (let ((history-delete-duplicates t))\r
+ (add-to-history 'notmuch-search-history search)))\r
+- (notmuch-search search notmuch-search-oldest-first nil nil\r
++ (notmuch-search search notmuch-search-oldest-first nil nil nil\r
+ #'notmuch-hello-search-continuation))\r
+ \r
+ (defun notmuch-hello-add-saved-search (widget)\r
+@@ -331,7 +331,7 @@ diagonal."\r
+ (notmuch-search (widget-get widget\r
+ :notmuch-search-terms)\r
+ notmuch-search-oldest-first\r
+- nil nil #'notmuch-hello-search-continuation))\r
++ nil nil nil #'notmuch-hello-search-continuation))\r
+ \r
+ (defun notmuch-saved-search-count (search)\r
+ (car (process-lines notmuch-command "count" search)))\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 7b61e9b..d05b1e8 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -254,6 +254,7 @@ For a mouse binding, return nil."\r
+ (notmuch-common-do-stash (notmuch-search-find-thread-id)))\r
+ \r
+ (defvar notmuch-search-query-string)\r
++(defvar notmuch-search-show-recipients)\r
+ (defvar notmuch-search-target-thread)\r
+ (defvar notmuch-search-target-line)\r
+ (defvar notmuch-search-continuation)\r
+@@ -405,6 +406,7 @@ Complete list of currently available key bindings:\r
+ (make-local-variable 'notmuch-search-oldest-first)\r
+ (make-local-variable 'notmuch-search-target-thread)\r
+ (make-local-variable 'notmuch-search-target-line)\r
++ (make-local-variable 'notmuch-search-show-recipients)\r
+ (set (make-local-variable 'notmuch-search-continuation) nil)\r
+ (set (make-local-variable 'scroll-preserve-screen-position) t)\r
+ (add-to-invisibility-spec (cons 'ellipsis t))\r
+@@ -781,7 +783,10 @@ non-authors is found, assume that all of the authors match."\r
+ 'face 'notmuch-search-subject)))\r
+ \r
+ ((string-equal field "authors")\r
+- (notmuch-search-insert-authors format-string (plist-get result :authors)))\r
++ (notmuch-search-insert-authors format-string\r
++ (if notmuch-search-show-recipients\r
++ (plist-get result :recipients)\r
++ (plist-get result :authors))))\r
+ \r
+ ((string-equal field "tags")\r
+ (let ((tags-str (mapconcat 'identity (plist-get result :tags) " ")))\r
+@@ -931,13 +936,16 @@ PROMPT is the string to prompt with."\r
+ 'notmuch-search-history nil nil)))))\r
+ \r
+ ;;;###autoload\r
+-(defun notmuch-search (&optional query oldest-first target-thread target-line continuation)\r
++(defun notmuch-search (&optional query oldest-first show-recipients target-thread target-line continuation)\r
+ "Run \"notmuch search\" with the given `query' and display results.\r
+ \r
+ If `query' is nil, it is read interactively from the minibuffer.\r
+ Other optional parameters are used as follows:\r
+ \r
+ oldest-first: A Boolean controlling the sort order of returned threads\r
++ show-recipients: A Boolean controlling whether or not thread\r
++ recipients instead of authors are shown in the\r
++ 'authors' field.\r
+ target-thread: A thread ID (without the thread: prefix) that will be made\r
+ current if it appears in the search results.\r
+ target-line: The line number to move to if the target thread does not\r
+@@ -952,25 +960,34 @@ Other optional parameters are used as follows:\r
+ (set 'buffer-undo-list t)\r
+ (set 'notmuch-search-query-string query)\r
+ (set 'notmuch-search-oldest-first oldest-first)\r
++ (set 'notmuch-search-show-recipients show-recipients)\r
+ (set 'notmuch-search-target-thread target-thread)\r
+ (set 'notmuch-search-target-line target-line)\r
+ (set 'notmuch-search-continuation continuation)\r
+ (let ((proc (get-buffer-process (current-buffer)))\r
++ (proc-args (list\r
++ "notmuch-search" buffer\r
++ notmuch-command "search"\r
++ "--format=json"\r
++ (if oldest-first\r
++ "--sort=oldest-first"\r
++ "--sort=newest-first")))\r
+ (inhibit-read-only t))\r
++ (if show-recipients\r
++ (setq proc-args (append proc-args '("--include-recipients"))))\r
+ (if proc\r
+ (error "notmuch search process already running for query `%s'" query)\r
+ )\r
+ (erase-buffer)\r
+ (goto-char (point-min))\r
+ (save-excursion\r
+- (let ((proc (start-process\r
+- "notmuch-search" buffer\r
+- notmuch-command "search"\r
+- "--format=json"\r
+- (if oldest-first\r
+- "--sort=oldest-first"\r
+- "--sort=newest-first")\r
+- query))\r
++ (let (\r
++ ;; start-process insists on non-nil string arguments.\r
++ ;; This is annoying for variable length argument lists.\r
++ ;; We use apply here so that we can construct the\r
++ ;; start-process argument list ahead of time (instead of\r
++ ;; at invocation) to avoid nils.\r
++ (proc (apply 'start-process (append proc-args (list query))))\r
+ ;; Use a scratch buffer to accumulate partial output.\r
+ ;; This buffer will be killed by the sentinel, which\r
+ ;; should be called no matter how the process dies.\r
+@@ -995,11 +1012,12 @@ same relative position within the new buffer."\r
+ (interactive)\r
+ (let ((target-line (line-number-at-pos))\r
+ (oldest-first notmuch-search-oldest-first)\r
++ (show-recipients notmuch-search-show-recipients)\r
+ (target-thread (notmuch-search-find-thread-id 'bare))\r
+ (query notmuch-search-query-string)\r
+ (continuation notmuch-search-continuation))\r
+ (notmuch-kill-this-buffer)\r
+- (notmuch-search query oldest-first target-thread target-line continuation)\r
++ (notmuch-search query oldest-first show-recipients target-thread target-line continuation)\r
+ (goto-char (point-min))))\r
+ \r
+ (defcustom notmuch-poll-script nil\r
+-- \r
+1.7.10.4\r
+\r