--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 4F64B431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 10:49:07 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] 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 GFyqhS6Y0BRG for <notmuch@notmuchmail.org>;\r
+ Sun, 12 Feb 2012 10:49:06 -0800 (PST)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+ [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id EEED7421174\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
+Received: by mail-we0-f181.google.com with SMTP id p13so3496132wer.26\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=lAwVjTYKvJJpCqq8sV62WiDakJy5ni5otlUt7m6Kl5Y=;\r
+ b=gHz0oVt8jEM+Yd/CK+s3pKiNXB5I3y0Y502WYN5Nw+3gKSI34YLuNEPXmKzQAZ4ba9\r
+ Ojzj0MsOp40kZrVqr8/nSDpunf1r7vh137YtTK2Ne5E2SWk0SfBMjJfscToQtlqaAK1g\r
+ /9aKdUgMU1GcmtkYQ219iYsfuX1GMsX2WOk0w=\r
+Received: by 10.180.14.193 with SMTP id r1mr14030520wic.9.1329072544745;\r
+ Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223]) by mx.google.com with ESMTPS id\r
+ dr5sm39272463wib.0.2012.02.12.10.49.03 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 12 Feb 2012 10:49:04 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH v2 2/3] emacs: changes to other files to support\r
+ notmuch-pick\r
+Date: Sun, 12 Feb 2012 18:49:38 +0000\r
+Message-Id: <1329072579-27340-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\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: Sun, 12 Feb 2012 18:49:07 -0000\r
+\r
+---\r
+ emacs/Makefile.local | 3 ++-\r
+ emacs/notmuch-hello.el | 10 ++++++++++\r
+ emacs/notmuch-lib.el | 4 ++++\r
+ emacs/notmuch-query.el | 4 +++-\r
+ emacs/notmuch-show.el | 25 ++++++++++++++++++++++---\r
+ emacs/notmuch.el | 8 ++++++++\r
+ 6 files changed, 49 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+index 4fee0e8..2922d9e 100644\r
+--- a/emacs/Makefile.local\r
++++ b/emacs/Makefile.local\r
+@@ -14,7 +14,8 @@ emacs_sources := \\r
+ $(dir)/notmuch-message.el \\r
+ $(dir)/notmuch-crypto.el \\r
+ $(dir)/coolj.el \\r
+- $(dir)/notmuch-print.el\r
++ $(dir)/notmuch-print.el \\r
++ $(dir)/notmuch-pick.el\r
+ \r
+ emacs_images := \\r
+ $(srcdir)/$(dir)/notmuch-logo.png\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index d17a30f..6d28a7e 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -27,6 +27,7 @@\r
+ (require 'notmuch-mua)\r
+ \r
+ (declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))\r
++(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))\r
+ (declare-function notmuch-poll "notmuch" ())\r
+ \r
+ (defcustom notmuch-hello-recent-searches-max 10\r
+@@ -181,6 +182,14 @@ International Bureau of Weights and Measures."\r
+ (notmuch-search search notmuch-search-oldest-first nil nil\r
+ #'notmuch-hello-search-continuation))\r
+ \r
++(defun notmuch-hello-pick (&optional search)\r
++ (interactive)\r
++ (unless (null search)\r
++ (setq search (notmuch-hello-trim search))\r
++ (let ((history-delete-duplicates t))\r
++ (add-to-history 'notmuch-search-history search)))\r
++ (notmuch-pick search))\r
++\r
+ (defun notmuch-hello-add-saved-search (widget)\r
+ (interactive)\r
+ (let ((search (widget-value\r
+@@ -345,6 +354,7 @@ should be. Returns a cons cell `(tags-per-line width)'."\r
+ (define-key map (kbd "<C-tab>") 'widget-backward)\r
+ (define-key map "m" 'notmuch-mua-new-mail)\r
+ (define-key map "s" 'notmuch-hello-search)\r
++ (define-key map "z" 'notmuch-hello-pick)\r
+ map)\r
+ "Keymap for \"notmuch hello\" buffers.")\r
+ (fset 'notmuch-hello-mode-map notmuch-hello-mode-map)\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index d315f76..b88bb80 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -40,6 +40,10 @@\r
+ "Showing messages and threads."\r
+ :group 'notmuch)\r
+ \r
++(defgroup notmuch-pick nil\r
++ "Showing message and thread structure."\r
++ :group 'notmuch)\r
++\r
+ (defgroup notmuch-send nil\r
+ "Sending messages from Notmuch."\r
+ :group 'notmuch)\r
+diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el\r
+index d66baea..b3c91a3 100644\r
+--- a/emacs/notmuch-query.el\r
++++ b/emacs/notmuch-query.el\r
+@@ -22,7 +22,7 @@\r
+ (require 'notmuch-lib)\r
+ (require 'json)\r
+ \r
+-(defun notmuch-query-get-threads (search-terms)\r
++(defun notmuch-query-get-threads (search-terms &rest extra-format)\r
+ "Return a list of threads of messages matching SEARCH-TERMS.\r
+ \r
+ A thread is a forest or list of trees. A tree is a two element\r
+@@ -33,6 +33,8 @@ is a possibly empty forest of replies.\r
+ (json-object-type 'plist)\r
+ (json-array-type 'list)\r
+ (json-false 'nil))\r
++ (if extra-format\r
++ (setq args (append args extra-format)))\r
+ (if notmuch-show-process-crypto\r
+ (setq args (append args '("--decrypt"))))\r
+ (setq args (append args search-terms))\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 43408d9..1adf964 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -42,6 +42,7 @@\r
+ (declare-function notmuch-search-next-thread "notmuch" nil)\r
+ (declare-function notmuch-search-show-thread "notmuch" nil)\r
+ (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))\r
++(declare-function notmuch-pick "notmuch-pick" (query &optional query-context buffer-name))\r
+ \r
+ (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
+ "Headers that should be shown in a message, in this order.\r
+@@ -151,6 +152,12 @@ indentation."\r
+ (make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)\r
+ (put 'notmuch-show-elide-non-matching-messages 'permanent-local t)\r
+ \r
++;; This is very similar to the previous variable: they should be\r
++;; unified. MJW\r
++(defvar notmuch-show-just-matches nil)\r
++(make-variable-buffer-local 'notmuch-show-just-matches)\r
++(put 'notmuch-show-just-matches 'permanent-local t)\r
++\r
+ (defvar notmuch-show-indent-content t)\r
+ (make-variable-buffer-local 'notmuch-show-indent-content)\r
+ (put 'notmuch-show-indent-content 'permanent-local t)\r
+@@ -1013,7 +1020,7 @@ a corresponding notmuch search."\r
+ 'face goto-address-mail-face))))\r
+ \r
+ ;;;###autoload\r
+-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)\r
++(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name just-matches)\r
+ "Run \"notmuch show\" with the given thread ID and display results.\r
+ \r
+ The optional PARENT-BUFFER is the notmuch-search buffer from\r
+@@ -1046,8 +1053,11 @@ function is used."\r
+ \r
+ (setq notmuch-show-thread-id thread-id\r
+ notmuch-show-parent-buffer parent-buffer\r
+- notmuch-show-query-context query-context)\r
+- (notmuch-show-worker)))\r
++ notmuch-show-query-context query-context\r
++ notmuch-show-just-matches just-matches)\r
++\r
++ (notmuch-show-worker)\r
++ (current-buffer)))\r
+ \r
+ (defun notmuch-show-worker ()\r
+ (let ((inhibit-read-only t))\r
+@@ -1064,6 +1074,8 @@ function is used."\r
+ (append (list "\'") basic-args\r
+ (list "and (" notmuch-show-query-context ")\'"))\r
+ (append (list "\'") basic-args (list "\'")))))\r
++ (if notmuch-show-just-matches\r
++ (setq args (append (list "--thread=none") args)))\r
+ (notmuch-show-insert-forest (notmuch-query-get-threads args))\r
+ ;; If the query context reduced the results to nothing, run\r
+ ;; the basic query.\r
+@@ -1158,6 +1170,8 @@ buffer is stored and re-applied after the refresh."\r
+ (define-key map (kbd "<backtab>") 'notmuch-show-previous-button)\r
+ (define-key map (kbd "TAB") 'notmuch-show-next-button)\r
+ (define-key map "s" 'notmuch-search)\r
++ (define-key map "z" 'notmuch-pick)\r
++ (define-key map "Z" 'notmuch-show-pick-current-query)\r
+ (define-key map "m" 'notmuch-mua-new-mail)\r
+ (define-key map "f" 'notmuch-show-forward-message)\r
+ (define-key map "r" 'notmuch-show-reply-sender)\r
+@@ -1565,6 +1579,11 @@ to show, nil otherwise."\r
+ (notmuch-show-mark-read)\r
+ (notmuch-show-message-adjust))\r
+ \r
++(defun notmuch-show-pick-current-query ()\r
++ "Call notmuch pick with the current query"\r
++ (interactive)\r
++ (notmuch-pick notmuch-show-thread-id notmuch-show-query-context))\r
++\r
+ (defun notmuch-show-view-raw-message ()\r
+ "View the file holding the current message."\r
+ (interactive)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 5b4f1c5..43e77d0 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -54,6 +54,7 @@\r
+ \r
+ (require 'notmuch-lib)\r
+ (require 'notmuch-show)\r
++(require 'notmuch-pick)\r
+ (require 'notmuch-mua)\r
+ (require 'notmuch-hello)\r
+ (require 'notmuch-maildir-fcc)\r
+@@ -272,6 +273,8 @@ For a mouse binding, return nil."\r
+ (define-key map "R" 'notmuch-search-reply-to-thread)\r
+ (define-key map "m" 'notmuch-mua-new-mail)\r
+ (define-key map "s" 'notmuch-search)\r
++ (define-key map "z" 'notmuch-pick)\r
++ (define-key map "Z" 'notmuch-search-pick-current-query)\r
+ (define-key map "o" 'notmuch-search-toggle-order)\r
+ (define-key map "c" 'notmuch-search-stash-map)\r
+ (define-key map "=" 'notmuch-search-refresh-view)\r
+@@ -1021,6 +1024,11 @@ same relative position within the new buffer."\r
+ (notmuch-search query oldest-first target-thread target-line continuation)\r
+ (goto-char (point-min))))\r
+ \r
++(defun notmuch-search-pick-current-query ()\r
++ "Call notmuch pick with the current query"\r
++ (interactive)\r
++ (notmuch-pick notmuch-search-query-string))\r
++\r
+ (defcustom notmuch-poll-script nil\r
+ "An external script to incorporate new mail into the notmuch database.\r
+ \r
+-- \r
+1.7.2.3\r
+\r