[RFC PATCH v3 10/11] emacs: notmuch-show.el just show the actual matching messages

Mark Walters markwalters1009 at gmail.com
Sun Feb 12 17:20:14 PST 2012


Allow a parameter to notmuch-show to just show the matching
messages. This is very similar to
notmuch-show-elide-non-matching-messages but since it calls
notmuch-show.c with the --thread=none parameter it does not keep any
threading information.

In particular the sort order is different: the elide-non-matching
sorts by thread and just omits the non-matching messages, this option
sorts by message.

It is likely that the two should be unified.
---
 emacs/notmuch-show.el |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8a8acf6..1adf964 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -152,6 +152,12 @@ indentation."
 (make-variable-buffer-local 'notmuch-show-elide-non-matching-messages)
 (put 'notmuch-show-elide-non-matching-messages 'permanent-local t)
 
+;; This is very similar to the previous variable: they should be
+;; unified. MJW
+(defvar notmuch-show-just-matches nil)
+(make-variable-buffer-local 'notmuch-show-just-matches)
+(put 'notmuch-show-just-matches 'permanent-local t)
+
 (defvar notmuch-show-indent-content t)
 (make-variable-buffer-local 'notmuch-show-indent-content)
 (put 'notmuch-show-indent-content 'permanent-local t)
@@ -1014,7 +1020,7 @@ a corresponding notmuch search."
 			'face goto-address-mail-face))))
 
 ;;;###autoload
-(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
+(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name just-matches)
   "Run \"notmuch show\" with the given thread ID and display results.
 
 The optional PARENT-BUFFER is the notmuch-search buffer from
@@ -1047,7 +1053,9 @@ function is used."
 
     (setq notmuch-show-thread-id thread-id
 	  notmuch-show-parent-buffer parent-buffer
-	  notmuch-show-query-context query-context)
+	  notmuch-show-query-context query-context
+	  notmuch-show-just-matches just-matches)
+
     (notmuch-show-worker)
     (current-buffer)))
 
@@ -1066,6 +1074,8 @@ function is used."
 		       (append (list "\'") basic-args
 			       (list "and (" notmuch-show-query-context ")\'"))
 		     (append (list "\'") basic-args (list "\'")))))
+	(if notmuch-show-just-matches
+	    (setq args (append (list "--thread=none") args)))
 	(notmuch-show-insert-forest (notmuch-query-get-threads args))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
-- 
1.7.2.3



More information about the notmuch mailing list