unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: add new option notmuch-search-exclude
@ 2021-11-28 20:02 Mohsin Kaleem
  2021-12-24  0:33 ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2021-11-28 20:02 UTC (permalink / raw)
  To: notmuch; +Cc: Mohsin Kaleem

The new notmuch-search-exclude option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude
have also been added that toggle the value of notmuch-search-exclude for
the search in the current search or tree buffer. It's bound to "i" in
the respective keymaps for these modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this
  + include notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

If there was a reasoning behind these not persisting the value of these
variables then we should revert it before merging and discuss whether
it's worth persisting notmuch-search-exclude.

[1]: id:87ilxlxsng.fsf@kisara.moe
---
 emacs/notmuch-jump.el | 11 ++++++----
 emacs/notmuch-lib.el  | 10 +++++++++
 emacs/notmuch-tree.el | 40 ++++++++++++++++++++++++---------
 emacs/notmuch.el      | 51 +++++++++++++++++++++++++++++++++----------
 4 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..e98c9c1d 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		 (cl-case (plist-get saved-search :sort-order)
 		   (newest-first nil)
 		   (oldest-first t)
-		   (otherwise (default-value 'notmuch-search-oldest-first)))))
+		   (otherwise (default-value 'notmuch-search-oldest-first))))
+		(exclude (default-value 'notmuch-search-exclude)))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
-			  (lambda () (notmuch-tree query)))
+			  (lambda () (notmuch-tree query nil nil nil nil nil nil
+					      oldest-first exclude)))
 			 ((eq (plist-get saved-search :search-type) 'unthreaded)
-			  (lambda () (notmuch-unthreaded query)))
+			  (lambda () (notmuch-unthreaded query nil nil nil nil
+						    oldest-first exclude)))
 			 (t
-			  (lambda () (notmuch-search query oldest-first)))))
+			  (lambda () (notmuch-search query oldest-first exclude)))))
 		  action-map)))))
     (setq action-map (nreverse action-map))
     (if action-map
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 45817e13..a0b780fd 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,6 +105,16 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
+(defcustom notmuch-search-exclude t
+  "Hide mail tagged with a excluded tag.
+
+Excluded tags are defined in the users configuration file under
+the search section. When this variable is true, any mail with
+such a tag will not be shown in the search output."
+  :type 'boolean
+  :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-exclude)
+
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 7fa73d40..7e85dc51 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -363,6 +363,7 @@ then NAME behaves like CMD."
     (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
+    (define-key map "i" 'notmuch-tree-toggle-exclude)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
     (define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
     (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -578,7 +579,9 @@ NOT change the database."
   "Call notmuch search with the current query."
   (interactive)
   (notmuch-tree-close-message-window)
-  (notmuch-search (notmuch-tree-get-query)))
+  (notmuch-search (notmuch-tree-get-query)
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -791,7 +794,8 @@ nil otherwise."
 			 target
 			 nil
 			 unthreaded
-			 notmuch-search-oldest-first)))
+			 notmuch-search-oldest-first
+			 notmuch-search-exclude)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1108,7 +1112,8 @@ Complete list of currently available key bindings:
 					 results-buf)))))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
-					open-target unthreaded oldest-first)
+					open-target unthreaded oldest-first
+					exclude)
   "Insert the tree view of the search in the current buffer.
 
 This is is a helper function for notmuch-tree. The arguments are
@@ -1117,6 +1122,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
+  (setq notmuch-search-exclude exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1136,14 +1142,15 @@ the same as for the function notmuch-tree."
 			      (and query-context
 				   (concat " and (" query-context ")"))))
 	 (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
-	 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+	 (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+	 (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
     (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
       (setq search-args basic-query))
     (notmuch-tag-clear-cache)
     (let ((proc (notmuch-start-notmuch
 		 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
 		 "show" "--body=false" "--format=sexp" "--format-version=5"
-		 sort-arg message-arg search-args))
+		 sort-arg message-arg exclude-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
 	  ;; should be called no matter how the process dies.
@@ -1170,8 +1177,18 @@ default sort order is defined by `notmuch-search-oldest-first'."
   (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-tree-refresh-view))
 
+(defun notmuch-tree-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-tree-refresh-view))
+
 (defun notmuch-tree (&optional query query-context target buffer-name
-			       open-target unthreaded parent-buffer oldest-first)
+			       open-target unthreaded parent-buffer
+			       oldest-first exclude)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1200,17 +1217,19 @@ The arguments are:
     (pop-to-buffer-same-window buffer))
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
-  (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+  (notmuch-tree-worker query query-context target open-target
+		       unthreaded oldest-first exclude)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target)
+				     open-target oldest-first exclude)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
   (interactive)
-  (notmuch-tree query query-context target buffer-name open-target t))
+  (notmuch-tree query query-context target buffer-name open-target
+		t nil oldest-first exclude))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1244,7 +1263,8 @@ search results and that are also tagged with the given TAG."
 		  nil
 		  notmuch-tree-unthreaded
 		  nil
-		  notmuch-search-oldest-first)))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude)))
 
 ;;; _
 
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index fa061693..8d14fee3 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -178,6 +178,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "i" 'notmuch-search-toggle-exclude)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -537,12 +538,18 @@ thread."
 (defun notmuch-tree-from-search-current-query ()
   "Tree view of current query."
   (interactive)
-  (notmuch-tree notmuch-search-query-string))
+  (notmuch-tree notmuch-search-query-string
+		nil nil nil nil nil nil
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
   (interactive)
-  (notmuch-unthreaded notmuch-search-query-string))
+  (notmuch-unthreaded notmuch-search-query-string
+		      nil nil nil nil
+		      notmuch-search-oldest-first
+		      notmuch-search-exclude))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -551,7 +558,9 @@ thread."
 		notmuch-search-query-string
 		nil
 		(notmuch-prettify-subject (notmuch-search-find-subject))
-		t nil (current-buffer)))
+		t nil (current-buffer)
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -978,14 +987,15 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line
-				 no-display)
+(defun notmuch-search (&optional query oldest-first exclude target-thread
+				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
+  EXCLUDE: A boolean controlling whether to omit threads with excluded tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1000,9 +1010,10 @@ the configured default sort order."
    (list
     ;; Prompt for a query
     nil
-    ;; Use the default search order (if we're doing a search from a
-    ;; search buffer, ignore any buffer-local overrides)
-    (default-value 'notmuch-search-oldest-first)))
+    ;; Use the default search order and exclude value (if we're doing a
+    ;; search from a search buffer, ignore any buffer-local overrides)
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1016,6 +1027,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
+    (setq notmuch-search-exclude exclude)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1029,6 +1041,9 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
+		     (if exclude
+			 "--exclude=true"
+		       "--exclude=false")
 		     query)))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
@@ -1050,11 +1065,21 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
+		  notmuch-search-exclude
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
   (goto-char (point-min)))
 
+(defun notmuch-search-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -1083,7 +1108,8 @@ current search results AND the additional query string provided."
     (notmuch-search (if (string= grouped-original-query "*")
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
-		    notmuch-search-oldest-first)))
+		    notmuch-search-oldest-first
+		    notmuch-search-exclude)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1094,13 +1120,16 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Filter by tag: "
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
-		  notmuch-search-oldest-first))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
   (interactive
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
-  (notmuch-search (concat "tag:" tag)))
+  (notmuch-search (concat "tag:" tag)
+		  (default-value 'notmuch-search-oldest-first)
+		  (default-value 'notmuch-search-exclude)))
 
 ;;;###autoload
 (defun notmuch ()
-- 
2.32.0

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2021-11-28 20:02 [PATCH] emacs: add new option notmuch-search-exclude Mohsin Kaleem
@ 2021-12-24  0:33 ` David Bremner
  2022-03-22 13:27   ` Mohsin Kaleem
  0 siblings, 1 reply; 45+ messages in thread
From: David Bremner @ 2021-12-24  0:33 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

> The new notmuch-search-exclude option allows users to configure whether
> to show or hide excluded messages (as determined by search.exclude_tags
> in the local config file). It defaults to true for now to maintain
> backwards-compatibility with how notmuch-{search,tree} already worked.

Thanks, this seems like a nice feature.

>
> New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude
> have also been added that toggle the value of notmuch-search-exclude for
> the search in the current search or tree buffer. It's bound to "i" in
> the respective keymaps for these modes.

Seems reasonable, since 'e' is already taken in tree mode. Can you
update the file devel/emacs-keybindings.org so we don't lose track of
the bindings. Also, per the contributing guide [1], please add some brief
documentation to the emacs docs in doc/notmuch-emacs.rst

> Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
> which didn't pass through the buffer local value of
> notmuch-search-oldest-first (and now notmuch-search-exclude).
> Examples of where I've done this
>   + include notmuch-jump-search
>   + notmuch-tree-from-search-current-query
>   + notmuch-unthreaded-from-search-current-query
>   + notmuch-tree-from-search-thread
>
> If there was a reasoning behind these not persisting the value of these
> variables then we should revert it before merging and discuss whether
> it's worth persisting notmuch-search-exclude.

Whether or not this is the right thing to do, something seems to have
broken the test suite. Perhaps after you fix the test suite, the answer
will be more clear? Or perhaps not, then we can revisit the question.

Also, we need at least one new test (ideally one per mode). There should
be some tests you can crib from in T310-emacs.sh and T450-emacs-show.sh.
In particular it is perfectly acceptable to call the toggle function
directly rather than trying to fake keystrokes.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2021-12-24  0:33 ` David Bremner
@ 2022-03-22 13:27   ` Mohsin Kaleem
  2022-03-22 19:21     ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-03-22 13:27 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

David Bremner <david@tethera.net> writes:

> Can you update the file devel/emacs-keybindings.org so we don't lose
> track of the bindings. Also, per the contributing guide [1], please
> add some brief documentation to the emacs docs in
> doc/notmuch-emacs.rst

Done.

> Also, we need at least one new test (ideally one per mode). There should
> be some tests you can crib from in T310-emacs.sh and T450-emacs-show.sh.

I'm more than happy to add some new tests but at least for me the test
suite appears to be failing on the master branch. I think it'd be easier
to wait until the existing tests are fixed before adding or changing new
ones.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-add-new-option-notmuch-search-exclude.patch --]
[-- Type: text/x-patch, Size: 14659 bytes --]

From 1872120821ccad5d23ab48d128d8d77efd85055d Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sat, 27 Nov 2021 18:58:43 +0000
Subject: [PATCH 1/2] emacs: add new option notmuch-search-exclude

The new notmuch-search-exclude option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude
have also been added that toggle the value of notmuch-search-exclude for
the search in the current search or tree buffer. It's bound to "i" in
the respective keymaps for these modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this
  + include notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

If there was a reasoning behind these not persisting the value of these
variables then we should revert it before merging and discuss whether
it's worth persisting notmuch-search-exclude.

[1]: id:87ilxlxsng.fsf@kisara.moe
---
 emacs/notmuch-jump.el | 11 ++++++----
 emacs/notmuch-lib.el  | 10 +++++++++
 emacs/notmuch-tree.el | 40 ++++++++++++++++++++++++---------
 emacs/notmuch.el      | 51 +++++++++++++++++++++++++++++++++----------
 4 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..e98c9c1d 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		 (cl-case (plist-get saved-search :sort-order)
 		   (newest-first nil)
 		   (oldest-first t)
-		   (otherwise (default-value 'notmuch-search-oldest-first)))))
+		   (otherwise (default-value 'notmuch-search-oldest-first))))
+		(exclude (default-value 'notmuch-search-exclude)))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
-			  (lambda () (notmuch-tree query)))
+			  (lambda () (notmuch-tree query nil nil nil nil nil nil
+					      oldest-first exclude)))
 			 ((eq (plist-get saved-search :search-type) 'unthreaded)
-			  (lambda () (notmuch-unthreaded query)))
+			  (lambda () (notmuch-unthreaded query nil nil nil nil
+						    oldest-first exclude)))
 			 (t
-			  (lambda () (notmuch-search query oldest-first)))))
+			  (lambda () (notmuch-search query oldest-first exclude)))))
 		  action-map)))))
     (setq action-map (nreverse action-map))
     (if action-map
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 6fc71cc7..9a0e470e 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,6 +105,16 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
+(defcustom notmuch-search-exclude t
+  "Hide mail tagged with a excluded tag.
+
+Excluded tags are defined in the users configuration file under
+the search section. When this variable is true, any mail with
+such a tag will not be shown in the search output."
+  :type 'boolean
+  :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-exclude)
+
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 303c6fad..e4d9ae44 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -363,6 +363,7 @@ then NAME behaves like CMD."
     (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
+    (define-key map "i" 'notmuch-tree-toggle-exclude)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
     (define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
     (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -578,7 +579,9 @@ NOT change the database."
   "Call notmuch search with the current query."
   (interactive)
   (notmuch-tree-close-message-window)
-  (notmuch-search (notmuch-tree-get-query)))
+  (notmuch-search (notmuch-tree-get-query)
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -791,7 +794,8 @@ nil otherwise."
 			 target
 			 nil
 			 unthreaded
-			 notmuch-search-oldest-first)))
+			 notmuch-search-oldest-first
+			 notmuch-search-exclude)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1108,7 +1112,8 @@ Complete list of currently available key bindings:
 					 results-buf)))))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
-					open-target unthreaded oldest-first)
+					open-target unthreaded oldest-first
+					exclude)
   "Insert the tree view of the search in the current buffer.
 
 This is is a helper function for notmuch-tree. The arguments are
@@ -1117,6 +1122,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
+  (setq notmuch-search-exclude exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1136,14 +1142,15 @@ the same as for the function notmuch-tree."
 			      (and query-context
 				   (concat " and (" query-context ")"))))
 	 (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
-	 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+	 (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+	 (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
     (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
       (setq search-args basic-query))
     (notmuch-tag-clear-cache)
     (let ((proc (notmuch-start-notmuch
 		 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
 		 "show" "--body=false" "--format=sexp" "--format-version=5"
-		 sort-arg message-arg search-args))
+		 sort-arg message-arg exclude-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
 	  ;; should be called no matter how the process dies.
@@ -1170,8 +1177,18 @@ default sort order is defined by `notmuch-search-oldest-first'."
   (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-tree-refresh-view))
 
+(defun notmuch-tree-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-tree-refresh-view))
+
 (defun notmuch-tree (&optional query query-context target buffer-name
-			       open-target unthreaded parent-buffer oldest-first)
+			       open-target unthreaded parent-buffer
+			       oldest-first exclude)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1200,17 +1217,19 @@ The arguments are:
     (pop-to-buffer-same-window buffer))
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
-  (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+  (notmuch-tree-worker query query-context target open-target
+		       unthreaded oldest-first exclude)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target)
+				     open-target oldest-first exclude)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
   (interactive)
-  (notmuch-tree query query-context target buffer-name open-target t))
+  (notmuch-tree query query-context target buffer-name open-target
+		t nil oldest-first exclude))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1244,7 +1263,8 @@ search results and that are also tagged with the given TAG."
 		  nil
 		  notmuch-tree-unthreaded
 		  nil
-		  notmuch-search-oldest-first)))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude)))
 
 ;;; _
 
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index c9cf80dc..a42cb576 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -178,6 +178,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "i" 'notmuch-search-toggle-exclude)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -537,12 +538,18 @@ thread."
 (defun notmuch-tree-from-search-current-query ()
   "Tree view of current query."
   (interactive)
-  (notmuch-tree notmuch-search-query-string))
+  (notmuch-tree notmuch-search-query-string
+		nil nil nil nil nil nil
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
   (interactive)
-  (notmuch-unthreaded notmuch-search-query-string))
+  (notmuch-unthreaded notmuch-search-query-string
+		      nil nil nil nil
+		      notmuch-search-oldest-first
+		      notmuch-search-exclude))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -551,7 +558,9 @@ thread."
 		notmuch-search-query-string
 		nil
 		(notmuch-prettify-subject (notmuch-search-find-subject))
-		t nil (current-buffer)))
+		t nil (current-buffer)
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -1021,14 +1030,15 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line
-				 no-display)
+(defun notmuch-search (&optional query oldest-first exclude target-thread
+				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
+  EXCLUDE: A boolean controlling whether to omit threads with excluded tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1043,9 +1053,10 @@ the configured default sort order."
    (list
     ;; Prompt for a query
     nil
-    ;; Use the default search order (if we're doing a search from a
-    ;; search buffer, ignore any buffer-local overrides)
-    (default-value 'notmuch-search-oldest-first)))
+    ;; Use the default search order and exclude value (if we're doing a
+    ;; search from a search buffer, ignore any buffer-local overrides)
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1059,6 +1070,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
+    (setq notmuch-search-exclude exclude)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1072,6 +1084,9 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
+		     (if exclude
+			 "--exclude=true"
+		       "--exclude=false")
 		     query)))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
@@ -1092,11 +1107,21 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
+		  notmuch-search-exclude
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
   (goto-char (point-min)))
 
+(defun notmuch-search-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -1125,7 +1150,8 @@ current search results AND the additional query string provided."
     (notmuch-search (if (string= grouped-original-query "*")
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
-		    notmuch-search-oldest-first)))
+		    notmuch-search-oldest-first
+		    notmuch-search-exclude)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1136,13 +1162,16 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Filter by tag: "
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
-		  notmuch-search-oldest-first))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
   (interactive
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
-  (notmuch-search (concat "tag:" tag)))
+  (notmuch-search (concat "tag:" tag)
+		  (default-value 'notmuch-search-oldest-first)
+		  (default-value 'notmuch-search-exclude)))
 
 ;;;###autoload
 (defun notmuch ()
-- 
2.35.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-docs-Update-with-notmuch-toggle-exclude.patch --]
[-- Type: text/x-patch, Size: 2450 bytes --]

From 57c13040b305d26f80321c2b435b950ee5a16a4a Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Tue, 22 Mar 2022 13:04:14 +0000
Subject: [PATCH 2/2] docs: Update with notmuch-*-toggle-exclude

---
 devel/emacs-keybindings.org | 2 +-
 doc/notmuch-emacs.rst       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index 00977bc3..d0ec2633 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -9,7 +9,7 @@
 | f            |                                        | notmuch-show-forward-message                          | notmuch-show-forward-message            |
 | g            |                                        |                                                       |                                         |
 | h            |                                        | notmuch-show-toggle-visibility-headers                |                                         |
-| i            |                                        |                                                       |                                         |
+| i            | notmuch-search-toggle-exclude          |                                                       | notmuch-tree-toggle-exclude             |
 | j            | notmuch-jump-search                    | notmuch-jump-search                                   | notmuch-jump-search                     |
 | k            | notmuch-tag-jump                       | notmuch-tag-jump                                      | notmuch-tag-jump                        |
 | l            | notmuch-search-filter                  | notmuch-show-filter-thread                            | notmuch-tree-filter                     |
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 41f62390..dacc5b60 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -162,6 +162,9 @@ menu of results that the user can explore further by pressing
 ``g`` ``=``
     Refresh the buffer
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
+
 ``?``
     Display full set of key bindings
 
@@ -321,6 +324,8 @@ tags.
 ``t`` ``notmuch-tree-filter-by-tag``
    Filter the current search results based on an additional tag
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
 
 ``g`` ``=``
     Refresh the buffer
-- 
2.35.1


[-- Attachment #4: Type: text/plain, Size: 19 bytes --]


-- 
Mohsin Kaleem

[-- Attachment #5: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-22 13:27   ` Mohsin Kaleem
@ 2022-03-22 19:21     ` David Bremner
  2022-03-22 19:38       ` Mohsin Kaleem
  0 siblings, 1 reply; 45+ messages in thread
From: David Bremner @ 2022-03-22 19:21 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

>
> I'm more than happy to add some new tests but at least for me the test
> suite appears to be failing on the master branch. I think it'd be easier
> to wait until the existing tests are fixed before adding or changing new
> ones.
>
Can you be more specific about what tests are failing? Currently I know
that the latest gmime broke smime.4

For the moment, you can use the following to skip that test

% make NOTMUCH_SKIP_TESTS=smime.4 test

(in general a space separated list of tests to skip is supported; see
test/README)

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-22 19:21     ` David Bremner
@ 2022-03-22 19:38       ` Mohsin Kaleem
  2022-03-22 19:59         ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-03-22 19:38 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

David Bremner <david@tethera.net> writes:

> Can you be more specific about what tests are failing?

Pretty much all of them, although I'm beginning to suspect it may be an
environment issue on my part.

I've attached the output of running `make test` in the root of the
project from master, do you have any idea why so much seems to be
failing. Some python tests fail with no module named pytest but I do
have it installed, others seem to be failing because they cannot find
(or maybe create) a database file. I thought it might be because the
directory for the database doesn't exist so I made it manually yet the
tests are still failing :/.


[-- Attachment #2: test.log --]
[-- Type: text/plain, Size: 17638 bytes --]

Missing sphinx or makeinfo, not building info pages
Use "make V=1" to see the details for passing and known broken tests.
INFO: using 2m timeout for tests
INFO: running tests with GNU parallel

T030-config: Testing "notmuch config"
 BROKEN Round trip config item with leading spaces
 BROKEN Round trip config item with leading tab

T050-new: Testing "notmuch new" in several variations
 BROKEN RFC822 group names are indexed
 BROKEN Long directory names don't cause rescan
add_file: A Xapian exception occurred
A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.
Note: A fatal error was encountered: A Xapian exception occurred
add_file: A Xapian exception occurred
A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.
Note: A fatal error was encountered: A Xapian exception occurred
Skipping due to missing sfsexp library
 missing prerequisites: dtach(1)
 SKIP   Show message: json, inline attachment filename
 missing prerequisites: dtach(1)
 SKIP   Show message: sexp, inline attachment filename
 missing prerequisites: dtach(1)
 SKIP   all tests in T310-emacs
 missing prerequisites: dtach(1)
 SKIP   all tests in T315-emacs-tagging
 missing prerequisites: dtach(1)
 SKIP   all tests in T330-emacs-subject-to-filename

T055-path-config: Testing Configuration of mail-root and database path
 FAIL   count (XDG)
	--- T055-path-config.41.expected	2022-03-22 19:30:33.438149848 +0000
	+++ T055-path-config.41.output	2022-03-22 19:30:33.438149848 +0000
	@@ -1 +1 @@
	-52
	+
Error: could not locate database.
 FAIL   count+tag (XDG)
	--- T055-path-config.42.expected	2022-03-22 19:30:33.458150410 +0000
	+++ T055-path-config.42.output	2022-03-22 19:30:33.458150410 +0000
	@@ -1 +1 @@
	-52
	+
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   address (XDG)
	--- T055-path-config.43.EXPECTED	2022-03-22 19:30:33.471484118 +0000
	+++ T055-path-config.43.OUTPUT	2022-03-22 19:30:33.474817545 +0000
	@@ -1,2 +0,0 @@
	-Carl Worth <cworth@cworth.org>
	-notmuch@notmuchmail.org
Error: could not locate database.
 FAIL   dump (XDG)
	--- T055-path-config.44.EXPECTED	2022-03-22 19:30:33.488151254 +0000
	+++ T055-path-config.44.OUTPUT	2022-03-22 19:30:33.491484680 +0000
	@@ -1,3 +0,0 @@
	-#notmuch-dump batch-tag:3 config,properties,tags
	-+attachment +inbox +signed +unread -- id:20091118005829.GB25380@dottiness.seas.harvard.edu
	-+attachment +inbox +signed +unread -- id:20091118010116.GC25380@dottiness.seas.harvard.edu
Error: could not locate database.
 FAIL   dump + tag + restore (XDG)
	Missing or zero length file: EXPECTED
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   reindex (XDG)
	Missing or zero length file: EXPECTED
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   use existing database (XDG)
	--- T055-path-config.45.expected	2022-03-22 19:30:33.544819514 +0000
	+++ T055-path-config.45.output	2022-03-22 19:30:33.544819514 +0000
	@@ -1 +1 @@
	-No new mail.
	+
Error: could not locate database.
 FAIL   create database (XDG)
	--- T055-path-config.46.expected	2022-03-22 19:30:33.561486649 +0000
	+++ T055-path-config.46.output	2022-03-22 19:30:33.561486649 +0000
	@@ -1 +1 @@
	-52
	+
Error: could not locate database.
Error: could not locate database.
 FAIL   detect new files (XDG)
	--- T055-path-config.47.expected	2022-03-22 19:30:33.581487212 +0000
	+++ T055-path-config.47.output	2022-03-22 19:30:33.581487212 +0000
	@@ -1 +1 @@
	-54
	+
Error: could not locate database.
Error: could not locate database.
 FAIL   Show a raw message (XDG)
	Missing or zero length file: OUTPUT
Error: could not locate database.
Error: could not locate database.
 FAIL   reply (XDG)
	--- T055-path-config.48.EXPECTED	2022-03-22 19:30:33.614821483 +0000
	+++ T055-path-config.48.OUTPUT	2022-03-22 19:30:33.618154910 +0000
	@@ -1,8 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-Subject: Re: notmuch-reply-test
	-To: Sender <sender@example.com>
	-In-Reply-To: <msg-014@notmuch-test-suite>
	-References: <msg-014@notmuch-test-suite>
	-
	-On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
	-> basic reply test
Error: could not locate database.
Error: could not locate database.
 FAIL   insert+search (XDG)
	Missing or zero length file: 
Error: could not locate database.
Error: could not locate database.
 FAIL   compact+search (XDG)
	Missing or zero length file: EXPECTED
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   upgrade backup (XDG)
	--- T055-path-config.49.expected	2022-03-22 19:30:33.724824577 +0000
	+++ T055-path-config.49.output	2022-03-22 19:30:33.724824577 +0000
	@@ -1 +1 @@
	-Welcome to a new version of notmuch! Your database will now be upgraded.
	+
Error: could not locate database.
 FAIL   Set config value in database (XDG)
	--- T055-path-config.52.expected	2022-03-22 19:30:33.848161379 +0000
	+++ T055-path-config.52.output	2022-03-22 19:30:33.848161379 +0000
	@@ -1 +1 @@
	-5563+
	++
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
 FAIL   Config list (XDG)
	--- T055-path-config.53.EXPECTED	2022-03-22 19:30:33.864828515 +0000
	+++ T055-path-config.53.OUTPUT	2022-03-22 19:30:33.868161942 +0000
	@@ -3,8 +3,6 @@
	 built_with.retry_lock=something
	 built_with.sexp_queries=something
	 database.autocommit=8000
	-database.backup_dir
	-database.hook_dir
	 database.mail_root=MAIL_DIR
	 database.path
	 maildir.synchronize_flags=true
 FAIL   Config list from python (XDG)
	--- T055-path-config.54.EXPECTED	2022-03-22 19:30:33.958164473 +0000
	+++ T055-path-config.54.OUTPUT	2022-03-22 19:30:33.958164473 +0000
	@@ -1,10 +0,0 @@
	-database.autocommit
	-database.backup_dir
	-database.hook_dir
	-database.mail_root
	-database.path
	-maildir.synchronize_flags
	-new.tags
	-user.name
	-user.other_email
	-user.primary_email
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/mohkale/.cache/emacs/straight/repos/notmuch/bindings/python-cffi/build/stage/notmuch2/_database.py", line 160, in __init__
    raise errors.NotmuchError(ret, msg)
notmuch2.NoDatabaseError: Error: could not locate database.

 FAIL   Set shadowed config value in database (XDG)
	--- T055-path-config.55.expected	2022-03-22 19:30:34.051500431 +0000
	+++ T055-path-config.55.output	2022-03-22 19:30:34.051500431 +0000
	@@ -1 +1 @@
	-7235+
	++
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
 FAIL   'to' header does not crash (python-cffi) (XDG)
	--- T055-path-config.56.EXPECTED	2022-03-22 19:30:34.148169817 +0000
	+++ T055-path-config.56.OUTPUT	2022-03-22 19:30:34.148169817 +0000
	@@ -1 +0,0 @@
	-notmuch@notmuchmail.org
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/mohkale/.cache/emacs/straight/repos/notmuch/bindings/python-cffi/build/stage/notmuch2/_database.py", line 160, in __init__
    raise errors.NotmuchError(ret, msg)
notmuch2.NoDatabaseError: Error: could not locate database.

 FAIL   count (XDG+profile)
	--- T055-path-config.57.expected	2022-03-22 19:30:34.544847641 +0000
	+++ T055-path-config.57.output	2022-03-22 19:30:34.544847641 +0000
	@@ -1 +1 @@
	-52
	+
Error: could not locate database.
 FAIL   count+tag (XDG+profile)
	--- T055-path-config.58.expected	2022-03-22 19:30:34.568181631 +0000
	+++ T055-path-config.58.output	2022-03-22 19:30:34.568181631 +0000
	@@ -1 +1 @@
	-52
	+
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   address (XDG+profile)
	--- T055-path-config.59.EXPECTED	2022-03-22 19:30:34.584848766 +0000
	+++ T055-path-config.59.OUTPUT	2022-03-22 19:30:34.584848766 +0000
	@@ -1,2 +0,0 @@
	-Carl Worth <cworth@cworth.org>
	-notmuch@notmuchmail.org
Error: could not locate database.
 FAIL   dump (XDG+profile)
	--- T055-path-config.60.EXPECTED	2022-03-22 19:30:34.601515902 +0000
	+++ T055-path-config.60.OUTPUT	2022-03-22 19:30:34.601515902 +0000
	@@ -1,3 +0,0 @@
	-#notmuch-dump batch-tag:3 config,properties,tags
	-+attachment +inbox +signed +unread -- id:20091118005829.GB25380@dottiness.seas.harvard.edu
	-+attachment +inbox +signed +unread -- id:20091118010116.GC25380@dottiness.seas.harvard.edu
Error: could not locate database.
 FAIL   dump + tag + restore (XDG+profile)
	Missing or zero length file: EXPECTED
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   reindex (XDG+profile)
	Missing or zero length file: EXPECTED
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   use existing database (XDG+profile)
	--- T055-path-config.61.expected	2022-03-22 19:30:34.658184162 +0000
	+++ T055-path-config.61.output	2022-03-22 19:30:34.658184162 +0000
	@@ -1 +1 @@
	-No new mail.
	+
Error: could not locate database.
 FAIL   create database (XDG+profile)
	--- T055-path-config.62.expected	2022-03-22 19:30:34.678184725 +0000
	+++ T055-path-config.62.output	2022-03-22 19:30:34.678184725 +0000
	@@ -1 +1 @@
	-52
	+
Error: could not locate database.
Error: could not locate database.
 FAIL   detect new files (XDG+profile)
	--- T055-path-config.63.expected	2022-03-22 19:30:34.701518715 +0000
	+++ T055-path-config.63.output	2022-03-22 19:30:34.701518715 +0000
	@@ -1 +1 @@
	-54
	+
Error: could not locate database.
Error: could not locate database.
 FAIL   Show a raw message (XDG+profile)
	Missing or zero length file: OUTPUT
Error: could not locate database.
Error: could not locate database.
 FAIL   reply (XDG+profile)
	--- T055-path-config.64.EXPECTED	2022-03-22 19:30:34.751520121 +0000
	+++ T055-path-config.64.OUTPUT	2022-03-22 19:30:34.754853548 +0000
	@@ -1,8 +0,0 @@
	-From: Notmuch Test Suite <test_suite@notmuchmail.org>
	-Subject: Re: notmuch-reply-test
	-To: Sender <sender@example.com>
	-In-Reply-To: <msg-019@notmuch-test-suite>
	-References: <msg-019@notmuch-test-suite>
	-
	-On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
	-> basic reply test
Error: could not locate database.
Error: could not locate database.
 FAIL   insert+search (XDG+profile)
	Missing or zero length file: 
Error: could not locate database.
Error: could not locate database.
 FAIL   compact+search (XDG+profile)
	Missing or zero length file: EXPECTED
Error: could not locate database.
Error: could not locate database.
Error: could not locate database.
 FAIL   upgrade backup (XDG+profile)
	--- T055-path-config.65.expected	2022-03-22 19:30:34.911524621 +0000
	+++ T055-path-config.65.output	2022-03-22 19:30:34.911524621 +0000
	@@ -1 +1 @@
	-Welcome to a new version of notmuch! Your database will now be upgraded.
	+
Error: could not locate database.
 FAIL   Set config value in database (XDG+profile)
	--- T055-path-config.68.expected	2022-03-22 19:30:35.038194851 +0000
	+++ T055-path-config.68.output	2022-03-22 19:30:35.038194851 +0000
	@@ -1 +1 @@
	-15394+
	++
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
 FAIL   Config list (XDG+profile)
	--- T055-path-config.69.EXPECTED	2022-03-22 19:30:35.054861986 +0000
	+++ T055-path-config.69.OUTPUT	2022-03-22 19:30:35.054861986 +0000
	@@ -3,8 +3,6 @@
	 built_with.retry_lock=something
	 built_with.sexp_queries=something
	 database.autocommit=8000
	-database.backup_dir
	-database.hook_dir
	 database.mail_root=MAIL_DIR
	 database.path
	 maildir.synchronize_flags=true
 FAIL   Config list from python (XDG+profile)
	--- T055-path-config.70.EXPECTED	2022-03-22 19:30:35.144864518 +0000
	+++ T055-path-config.70.OUTPUT	2022-03-22 19:30:35.148197945 +0000
	@@ -1,10 +0,0 @@
	-database.autocommit
	-database.backup_dir
	-database.hook_dir
	-database.mail_root
	-database.path
	-maildir.synchronize_flags
	-new.tags
	-user.name
	-user.other_email
	-user.primary_email
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/mohkale/.cache/emacs/straight/repos/notmuch/bindings/python-cffi/build/stage/notmuch2/_database.py", line 160, in __init__
    raise errors.NotmuchError(ret, msg)
notmuch2.NoDatabaseError: Error: could not locate database.

 FAIL   Set shadowed config value in database (XDG+profile)
	--- T055-path-config.71.expected	2022-03-22 19:30:35.261534466 +0000
	+++ T055-path-config.71.output	2022-03-22 19:30:35.261534466 +0000
	@@ -1 +1 @@
	-17086+
	++
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
notmuch config: Illegal argument for function
Cannot reopen closed or nonexistent database
 FAIL   'to' header does not crash (python-cffi) (XDG+profile)
	--- T055-path-config.72.EXPECTED	2022-03-22 19:30:35.364870706 +0000
	+++ T055-path-config.72.OUTPUT	2022-03-22 19:30:35.368204134 +0000
	@@ -1 +0,0 @@
	-notmuch@notmuchmail.org
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/mohkale/.cache/emacs/straight/repos/notmuch/bindings/python-cffi/build/stage/notmuch2/_database.py", line 160, in __init__
    raise errors.NotmuchError(ret, msg)
notmuch2.NoDatabaseError: Error: could not locate database.

 missing prerequisites: dtach(1)
 SKIP   all tests in T350-crypto
 missing prerequisites: dtach(1)
 SKIP   all tests in T320-emacs-large-search-buffer
 missing prerequisites: dtach(1)
 SKIP   all tests in T355-smime
 missing prerequisites: dtach(1)
 SKIP   all tests in T357-index-decryption
 missing prerequisites: dtach(1)
 SKIP   all tests in T358-emacs-protected-headers

T391-python-cffi: Testing python bindings (pytest)
 FAIL   python cffi tests (NOTMUCH_CONFIG set)
	(cd /home/mohkale/.cache/emacs/straight/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/.cache/emacs/straight/repos/notmuch/test/tmp.T391-python-cffi/test.output)
/usr/bin/python3: No module named pytest
 FAIL   python cffi tests (NOTMUCH_CONFIG unset)
	(cd /home/mohkale/.cache/emacs/straight/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/.cache/emacs/straight/repos/notmuch/test/tmp.T391-python-cffi/test.output)
/usr/bin/python3: No module named pytest
 missing prerequisites: dtach(1)
 SKIP   emacs test function sanity
 missing prerequisites: dtach(1)
 SKIP   all tests in T430-emacs-address-cleaning
 missing prerequisites: dtach(1)
 SKIP   all tests in T440-emacs-hello
 missing prerequisites: dtach(1)
 SKIP   all tests in T450-emacs-show
 missing prerequisites: dtach(1)
 SKIP   all tests in T455-emacs-charsets
 missing prerequisites: dtach(1)
 SKIP   all tests in T460-emacs-tree
 missing prerequisites: dtach(1)
 SKIP   all tests in T465-emacs-unthreaded
 missing prerequisites: dtach(1)
 SKIP   reply to ghost (tree view)
 missing prerequisites: dtach(1)
 SKIP   reply to ghost (RT/tree view)
 missing prerequisites: dtach(1)
 SKIP   trusting reply-to (tree view)

T560-lib-error: Testing error reporting for library
 FAIL   Open null pointer
	--- T560-lib-error.2.EXPECTED	2022-03-22 19:30:49.525269225 +0000
	+++ T560-lib-error.2.OUTPUT	2022-03-22 19:30:49.528602652 +0000
	@@ -1,3 +1,2 @@
	 == stdout ==
	 == stderr ==
	-Error: could not locate database.
test1.c: In function 'main':
test1.c:7:5: warning: 'notmuch_database_open' is deprecated: function deprecated as of libnotmuch 5.4 [-Wdeprecated-declarations]
    7 |     stat = notmuch_database_open (NULL, 0, 0);
      |     ^~~~
In file included from test1.c:2:
/home/mohkale/.cache/emacs/straight/repos/notmuch/lib/notmuch.h:332:1: note: declared here
  332 | notmuch_database_open (const char *path,
      | ^~~~~~~~~~~~~~~~~~~~~
 FAIL   create NULL path
	--- T560-lib-error.6.EXPECTED	2022-03-22 19:30:50.155286965 +0000
	+++ T560-lib-error.6.OUTPUT	2022-03-22 19:30:50.155286965 +0000
	@@ -1,3 +1,3 @@
	 == stdout ==
	 == stderr ==
	-Error: could not locate database.
	+Error: Cannot open database at /home/mohkale/.local/share/notmuch/default: No such file or directory.

T592-thread-breakage: Testing thread breakage during reindexing
 BROKEN No ghosts should remain after deletion of second message
 missing prerequisites: dtach(1)
 SKIP   all tests in T630-emacs-draft

T670-duplicate-mid: Testing duplicate message ids
 BROKEN First subject preserved in notmuch-show (json)
 BROKEN Regexp search for second subject
 missing prerequisites: dtach(1)
 SKIP   all tests in T720-emacs-attachment-warnings
 missing prerequisites: dtach(1)
 SKIP   all tests in T730-emacs-forwarding

Notmuch test suite complete.
1324/1369 tests passed.
7 broken tests failed as expected.
42 tests failed.
-4 tests skipped.
All tests in 18 files skipped.
ERROR: parallel test suite returned error code 3

[-- Attachment #3: Type: text/plain, Size: 19 bytes --]


-- 
Mohsin Kaleem

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-22 19:38       ` Mohsin Kaleem
@ 2022-03-22 19:59         ` David Bremner
  2022-03-22 20:07           ` Mohsin Kaleem
  0 siblings, 1 reply; 45+ messages in thread
From: David Bremner @ 2022-03-22 19:59 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

> David Bremner <david@tethera.net> writes:
>
>> Can you be more specific about what tests are failing?
>
> Pretty much all of them, although I'm beginning to suspect it may be an
> environment issue on my part.
>
> I've attached the output of running `make test` in the root of the
> project from master, do you have any idea why so much seems to be
> failing. Some python tests fail with no module named pytest but I do
> have it installed, others seem to be failing because they cannot find
> (or maybe create) a database file. I thought it might be because the
> directory for the database doesn't exist so I made it manually yet the
> tests are still failing :/.

The test suite creates many databases, so manual creation should not be needed.q

Running the tests under .cache is a bit unusual, but it seems to work ok
for me. This makes me think the problem is some environment variable. 

It's just a guess, but do you by chance override XDG_DATA_HOME? I can
imagine that causing problems for the test suite.

d


^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-22 19:59         ` David Bremner
@ 2022-03-22 20:07           ` Mohsin Kaleem
  2022-03-22 20:19             ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-03-22 20:07 UTC (permalink / raw)
  To: David Bremner, notmuch

David Bremner <david@tethera.net> writes:

> It's just a guess, but do you by chance override XDG_DATA_HOME? I can
> imagine that causing problems for the test suite.

I do export an environment variable $XDG_DATA_HOME, but it points to the
default location "/home/mohkale/.local/share" so I'm not sure why that
would be causing this to fail.

I tried running `XDG_DATA_HOME= make test` and it's still failing. I
also tried moving my notmuch repository copy outside of any XDG*
directories but the tests are still failing :-(.

-- 
Mohsin Kaleem

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-22 20:07           ` Mohsin Kaleem
@ 2022-03-22 20:19             ` David Bremner
  2022-03-22 20:27               ` Mohsin Kaleem
  0 siblings, 1 reply; 45+ messages in thread
From: David Bremner @ 2022-03-22 20:19 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

> David Bremner <david@tethera.net> writes:
>
>> It's just a guess, but do you by chance override XDG_DATA_HOME? I can
>> imagine that causing problems for the test suite.
>
> I do export an environment variable $XDG_DATA_HOME, but it points to the
> default location "/home/mohkale/.local/share" so I'm not sure why that
> would be causing this to fail.
>
> I tried running `XDG_DATA_HOME= make test` and it's still failing. I
> also tried moving my notmuch repository copy outside of any XDG*
> directories but the tests are still failing :-(.
>
> -- 
> Mohsin Kaleem

Try adding a line
"unset XDG_DATA_HOME"

after

unset XDG_CONFIG_HOME

on line 108 of test/test-lib.sh

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-22 20:19             ` David Bremner
@ 2022-03-22 20:27               ` Mohsin Kaleem
  2022-03-25 19:36                 ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-03-22 20:27 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

David Bremner <david@tethera.net> writes:

> Try adding a line
> "unset XDG_DATA_HOME"
>
> after
>
> unset XDG_CONFIG_HOME
>
> on line 108 of test/test-lib.sh

Doesn't seem to be such a line in test/test-lib.sh, but I added it to
test/test-vars.sh and we're down from 42 failing tests to 4 :-).


[-- Attachment #2: test.log --]
[-- Type: text/plain, Size: 5232 bytes --]

Missing sphinx or makeinfo, not building info pages
Use "make V=1" to see the details for passing and known broken tests.
INFO: using 2m timeout for tests
INFO: running tests with GNU parallel

T030-config: Testing "notmuch config"
 BROKEN Round trip config item with leading spaces
 BROKEN Round trip config item with leading tab

T050-new: Testing "notmuch new" in several variations
 BROKEN RFC822 group names are indexed
 BROKEN Long directory names don't cause rescan
add_file: A Xapian exception occurred
A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.
Note: A fatal error was encountered: A Xapian exception occurred
add_file: A Xapian exception occurred
A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.
Note: A fatal error was encountered: A Xapian exception occurred
Skipping due to missing sfsexp library
 missing prerequisites: dtach(1)
 SKIP   Show message: json, inline attachment filename
 missing prerequisites: dtach(1)
 SKIP   Show message: sexp, inline attachment filename
 missing prerequisites: dtach(1)
 SKIP   all tests in T310-emacs
 missing prerequisites: dtach(1)
 SKIP   all tests in T315-emacs-tagging
 missing prerequisites: dtach(1)
 SKIP   all tests in T330-emacs-subject-to-filename
 missing prerequisites: dtach(1)
 SKIP   all tests in T320-emacs-large-search-buffer
 missing prerequisites: dtach(1)
 SKIP   all tests in T350-crypto
 missing prerequisites: dtach(1)
 SKIP   all tests in T355-smime
 missing prerequisites: dtach(1)
 SKIP   all tests in T357-index-decryption
 missing prerequisites: dtach(1)
 SKIP   all tests in T358-emacs-protected-headers

T391-python-cffi: Testing python bindings (pytest)
 FAIL   python cffi tests (NOTMUCH_CONFIG set)
	(cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output)
/usr/bin/python3: No module named pytest
 FAIL   python cffi tests (NOTMUCH_CONFIG unset)
	(cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output)
/usr/bin/python3: No module named pytest
 missing prerequisites: dtach(1)
 SKIP   emacs test function sanity
 missing prerequisites: dtach(1)
 SKIP   all tests in T430-emacs-address-cleaning
 missing prerequisites: dtach(1)
 SKIP   all tests in T440-emacs-hello
 missing prerequisites: dtach(1)
 SKIP   all tests in T450-emacs-show
 missing prerequisites: dtach(1)
 SKIP   all tests in T455-emacs-charsets
 missing prerequisites: dtach(1)
 SKIP   all tests in T460-emacs-tree
 missing prerequisites: dtach(1)
 SKIP   all tests in T465-emacs-unthreaded
 missing prerequisites: dtach(1)
 SKIP   reply to ghost (tree view)
 missing prerequisites: dtach(1)
 SKIP   reply to ghost (RT/tree view)
 missing prerequisites: dtach(1)
 SKIP   trusting reply-to (tree view)

T560-lib-error: Testing error reporting for library
 FAIL   Open null pointer
	--- T560-lib-error.2.EXPECTED	2022-03-22 20:25:30.496475869 +0000
	+++ T560-lib-error.2.OUTPUT	2022-03-22 20:25:30.496475869 +0000
	@@ -1,3 +1,2 @@
	 == stdout ==
	 == stderr ==
	-Error: could not locate database.
test1.c: In function 'main':
test1.c:7:5: warning: 'notmuch_database_open' is deprecated: function deprecated as of libnotmuch 5.4 [-Wdeprecated-declarations]
    7 |     stat = notmuch_database_open (NULL, 0, 0);
      |     ^~~~
In file included from test1.c:2:
/home/mohkale/prog/repos/notmuch/lib/notmuch.h:332:1: note: declared here
  332 | notmuch_database_open (const char *path,
      | ^~~~~~~~~~~~~~~~~~~~~
 FAIL   create NULL path
	--- T560-lib-error.6.EXPECTED	2022-03-22 20:25:31.093160154 +0000
	+++ T560-lib-error.6.OUTPUT	2022-03-22 20:25:31.093160154 +0000
	@@ -1,3 +1,3 @@
	 == stdout ==
	 == stderr ==
	-Error: could not locate database.
	+Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such file or directory.

T592-thread-breakage: Testing thread breakage during reindexing
 BROKEN No ghosts should remain after deletion of second message
 missing prerequisites: dtach(1)
 SKIP   all tests in T630-emacs-draft

T670-duplicate-mid: Testing duplicate message ids
 BROKEN First subject preserved in notmuch-show (json)
 BROKEN Regexp search for second subject
 missing prerequisites: dtach(1)
 SKIP   all tests in T720-emacs-attachment-warnings
 missing prerequisites: dtach(1)
 SKIP   all tests in T730-emacs-forwarding

Notmuch test suite complete.
1362/1379 tests passed.
7 broken tests failed as expected.
4 tests failed.
6 tests skipped.
All tests in 18 files skipped.
ERROR: parallel test suite returned error code 2

[-- Attachment #3: Type: text/plain, Size: 19 bytes --]


-- 
Mohsin Kaleem

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-22 20:27               ` Mohsin Kaleem
@ 2022-03-25 19:36                 ` David Bremner
  2022-07-24 20:59                   ` Mohsin Kaleem
  0 siblings, 1 reply; 45+ messages in thread
From: David Bremner @ 2022-03-25 19:36 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

> David Bremner <david@tethera.net> writes:
>
>> Try adding a line
>> "unset XDG_DATA_HOME"
>>
>> after
>>
>> unset XDG_CONFIG_HOME
>>
>> on line 108 of test/test-lib.sh
>
> Doesn't seem to be such a line in test/test-lib.sh, but I added it to
> test/test-vars.sh and we're down from 42 failing tests to 4 :-).

Ah right, I was looking at an old version.

>
> T391-python-cffi: Testing python bindings (pytest)
>  FAIL   python cffi tests (NOTMUCH_CONFIG set)
> 	(cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output)
> /usr/bin/python3: No module named pytest
>  FAIL   python cffi tests (NOTMUCH_CONFIG unset)
> 	(cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output)

So does "python3 -m pytest" work for you? Assuming yes, is there some
special environment needed? We don't explicitly unset PYTHONPATH in
T391, so in if you need PYTHONPATH to locate pytest, that should work
here as well. What output do you get from "python3 -c 'import pytest;
print(pytest.__file__)'"

> T560-lib-error: Testing error reporting for library
>  FAIL   Open null pointer
> 	--- T560-lib-error.2.EXPECTED	2022-03-22 20:25:30.496475869 +0000
> 	+++ T560-lib-error.2.OUTPUT	2022-03-22 20:25:30.496475869 +0000
> 	@@ -1,3 +1,2 @@
> 	 == stdout ==
> 	 == stderr ==
> 	-Error: could not locate database.
> test1.c: In function 'main':
> test1.c:7:5: warning: 'notmuch_database_open' is deprecated: function deprecated as of libnotmuch 5.4 [-Wdeprecated-declarations]
>     7 |     stat = notmuch_database_open (NULL, 0, 0);
>       |     ^~~~
> In file included from test1.c:2:
> /home/mohkale/prog/repos/notmuch/lib/notmuch.h:332:1: note: declared here
>   332 | notmuch_database_open (const char *path,
>       | ^~~~~~~~~~~~~~~~~~~~~
>  FAIL   create NULL path
> 	--- T560-lib-error.6.EXPECTED	2022-03-22 20:25:31.093160154 +0000
> 	+++ T560-lib-error.6.OUTPUT	2022-03-22 20:25:31.093160154 +0000
> 	@@ -1,3 +1,3 @@
> 	 == stdout ==
> 	 == stderr ==
> 	-Error: could not locate database.
> 	+Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such file or directory.

I can duplicate this if I have a setting for MAILDIR in the environment.

I will send a patch clearing XDG_DATA_HOME and MAILDIR, but for now you
could add "unset MAILDIR" to test/test-vars.sh

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-03-25 19:36                 ` David Bremner
@ 2022-07-24 20:59                   ` Mohsin Kaleem
  2022-07-30 14:02                     ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-07-24 20:59 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 3221 bytes --]

David Bremner <david@tethera.net> writes:

Hi, firstly sorry for taking so long to come back to this. I honestly
have tried to fix this multiple times since my last message but kept
getting confused or misdirected by how the tests are setup so I gave up
and decided to come back to it later. Today I finally just sped through
everything and think I have everything ready.

> So does "python3 -m pytest" work for you? Assuming yes, is there some
> special environment needed? We don't explicitly unset PYTHONPATH in
> T391, so in if you need PYTHONPATH to locate pytest, that should work
> here as well. What output do you get from "python3 -c 'import pytest;
> print(pytest.__file__)'"

I ended up just installing pytest with my system package manager. I have
no idea why but notmuch could not use the pytest installation under my
home directory.

To briefly summarize the changes since my last message:

* I've added notmuch-hello support as well. Basically just added a new
configurable option to `notmuch-saved-searches` for configuring the
exclude value. This involved some mild refactoring of
notmuch-hello-widget-search.

* Updated the interactive spec of `notmuch-tree` and `notmuch-unthreaded` so
it sources the default value of `notmuch-search-oldest-first` and
`notmuch-search-exclude`. The `notmuch-search` command respected these
variables already but these commands didn't (not sure why).

* I fixed 2 broken test-cases. These were T310-emacs.60 and
T460-emacs-tree.11. The former just didn't include the new option in the
expected argv list. The later was because we now persist the value of
notmuch-search-oldest-first where previously we defaulted it to nil when
switching from a search to tree buffer. The ordering of the messages has
changes so the test failed. I added a new expected-output file with the
new ordering and everything is fixed now.

* I added a new test suite test/T461-emacs-search-exclude.sh which
contains test cases for the new features. Note this only extends to the
exclude option and it persisting between switches between the different
view types. I initially wanted to keep the existing suites like T310
and add some deleted messages to the corpora but because of the way the
existing tests were setup they could or could not ended up outputting
the deleted messages and having to recalculate the expected-output for
them proved too much of a hassle. The new test suite is designed from
the outset with some deleted and non-deleted messages and covers how
their inclusion in the output changes in a few different scenarios.
Note: this suite isn't fully comprehensive. It doesn't cover any of the
unthreaded commands, or configuring notmuch-hello with entries deviating
from the default. It does cover the core functionality of not showing
excluded mail, toggling the inclusion of such mail and switching between
notmuch-search and notmuch-tree buffers (and vice versa). I've left the
remaining tests as something to come back to later but would prefer
leaving them as something to add in a follow up PR if possible.

Note: Some of the test cases are still failing: Specifically 4 of them,
but their failing on the master branch as well so I believe their
unrelated to this PR.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-add-new-option-notmuch-search-exclude.patch --]
[-- Type: text/x-patch, Size: 14661 bytes --]

From 1872120821ccad5d23ab48d128d8d77efd85055d Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sat, 27 Nov 2021 18:58:43 +0000
Subject: [PATCH 01/11] emacs: add new option notmuch-search-exclude

The new notmuch-search-exclude option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude
have also been added that toggle the value of notmuch-search-exclude for
the search in the current search or tree buffer. It's bound to "i" in
the respective keymaps for these modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this
  + include notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

If there was a reasoning behind these not persisting the value of these
variables then we should revert it before merging and discuss whether
it's worth persisting notmuch-search-exclude.

[1]: id:87ilxlxsng.fsf@kisara.moe
---
 emacs/notmuch-jump.el | 11 ++++++----
 emacs/notmuch-lib.el  | 10 +++++++++
 emacs/notmuch-tree.el | 40 ++++++++++++++++++++++++---------
 emacs/notmuch.el      | 51 +++++++++++++++++++++++++++++++++----------
 4 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..e98c9c1d 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		 (cl-case (plist-get saved-search :sort-order)
 		   (newest-first nil)
 		   (oldest-first t)
-		   (otherwise (default-value 'notmuch-search-oldest-first)))))
+		   (otherwise (default-value 'notmuch-search-oldest-first))))
+		(exclude (default-value 'notmuch-search-exclude)))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
-			  (lambda () (notmuch-tree query)))
+			  (lambda () (notmuch-tree query nil nil nil nil nil nil
+					      oldest-first exclude)))
 			 ((eq (plist-get saved-search :search-type) 'unthreaded)
-			  (lambda () (notmuch-unthreaded query)))
+			  (lambda () (notmuch-unthreaded query nil nil nil nil
+						    oldest-first exclude)))
 			 (t
-			  (lambda () (notmuch-search query oldest-first)))))
+			  (lambda () (notmuch-search query oldest-first exclude)))))
 		  action-map)))))
     (setq action-map (nreverse action-map))
     (if action-map
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 6fc71cc7..9a0e470e 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,6 +105,16 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
+(defcustom notmuch-search-exclude t
+  "Hide mail tagged with a excluded tag.
+
+Excluded tags are defined in the users configuration file under
+the search section. When this variable is true, any mail with
+such a tag will not be shown in the search output."
+  :type 'boolean
+  :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-exclude)
+
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 303c6fad..e4d9ae44 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -363,6 +363,7 @@ then NAME behaves like CMD."
     (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
+    (define-key map "i" 'notmuch-tree-toggle-exclude)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
     (define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
     (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -578,7 +579,9 @@ NOT change the database."
   "Call notmuch search with the current query."
   (interactive)
   (notmuch-tree-close-message-window)
-  (notmuch-search (notmuch-tree-get-query)))
+  (notmuch-search (notmuch-tree-get-query)
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -791,7 +794,8 @@ nil otherwise."
 			 target
 			 nil
 			 unthreaded
-			 notmuch-search-oldest-first)))
+			 notmuch-search-oldest-first
+			 notmuch-search-exclude)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1108,7 +1112,8 @@ Complete list of currently available key bindings:
 					 results-buf)))))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
-					open-target unthreaded oldest-first)
+					open-target unthreaded oldest-first
+					exclude)
   "Insert the tree view of the search in the current buffer.
 
 This is is a helper function for notmuch-tree. The arguments are
@@ -1117,6 +1122,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
+  (setq notmuch-search-exclude exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1136,14 +1142,15 @@ the same as for the function notmuch-tree."
 			      (and query-context
 				   (concat " and (" query-context ")"))))
 	 (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
-	 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+	 (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+	 (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
     (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
       (setq search-args basic-query))
     (notmuch-tag-clear-cache)
     (let ((proc (notmuch-start-notmuch
 		 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
 		 "show" "--body=false" "--format=sexp" "--format-version=5"
-		 sort-arg message-arg search-args))
+		 sort-arg message-arg exclude-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
 	  ;; should be called no matter how the process dies.
@@ -1170,8 +1177,18 @@ default sort order is defined by `notmuch-search-oldest-first'."
   (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-tree-refresh-view))
 
+(defun notmuch-tree-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-tree-refresh-view))
+
 (defun notmuch-tree (&optional query query-context target buffer-name
-			       open-target unthreaded parent-buffer oldest-first)
+			       open-target unthreaded parent-buffer
+			       oldest-first exclude)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1200,17 +1217,19 @@ The arguments are:
     (pop-to-buffer-same-window buffer))
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
-  (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+  (notmuch-tree-worker query query-context target open-target
+		       unthreaded oldest-first exclude)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target)
+				     open-target oldest-first exclude)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
   (interactive)
-  (notmuch-tree query query-context target buffer-name open-target t))
+  (notmuch-tree query query-context target buffer-name open-target
+		t nil oldest-first exclude))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1244,7 +1263,8 @@ search results and that are also tagged with the given TAG."
 		  nil
 		  notmuch-tree-unthreaded
 		  nil
-		  notmuch-search-oldest-first)))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude)))
 
 ;;; _
 
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index c9cf80dc..a42cb576 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -178,6 +178,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "i" 'notmuch-search-toggle-exclude)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -537,12 +538,18 @@ thread."
 (defun notmuch-tree-from-search-current-query ()
   "Tree view of current query."
   (interactive)
-  (notmuch-tree notmuch-search-query-string))
+  (notmuch-tree notmuch-search-query-string
+		nil nil nil nil nil nil
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
   (interactive)
-  (notmuch-unthreaded notmuch-search-query-string))
+  (notmuch-unthreaded notmuch-search-query-string
+		      nil nil nil nil
+		      notmuch-search-oldest-first
+		      notmuch-search-exclude))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -551,7 +558,9 @@ thread."
 		notmuch-search-query-string
 		nil
 		(notmuch-prettify-subject (notmuch-search-find-subject))
-		t nil (current-buffer)))
+		t nil (current-buffer)
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -1021,14 +1030,15 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line
-				 no-display)
+(defun notmuch-search (&optional query oldest-first exclude target-thread
+				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
+  EXCLUDE: A boolean controlling whether to omit threads with excluded tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1043,9 +1053,10 @@ the configured default sort order."
    (list
     ;; Prompt for a query
     nil
-    ;; Use the default search order (if we're doing a search from a
-    ;; search buffer, ignore any buffer-local overrides)
-    (default-value 'notmuch-search-oldest-first)))
+    ;; Use the default search order and exclude value (if we're doing a
+    ;; search from a search buffer, ignore any buffer-local overrides)
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1059,6 +1070,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
+    (setq notmuch-search-exclude exclude)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1072,6 +1084,9 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
+		     (if exclude
+			 "--exclude=true"
+		       "--exclude=false")
 		     query)))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
@@ -1092,11 +1107,21 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
+		  notmuch-search-exclude
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
   (goto-char (point-min)))
 
+(defun notmuch-search-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -1125,7 +1150,8 @@ current search results AND the additional query string provided."
     (notmuch-search (if (string= grouped-original-query "*")
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
-		    notmuch-search-oldest-first)))
+		    notmuch-search-oldest-first
+		    notmuch-search-exclude)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1136,13 +1162,16 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Filter by tag: "
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
-		  notmuch-search-oldest-first))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
   (interactive
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
-  (notmuch-search (concat "tag:" tag)))
+  (notmuch-search (concat "tag:" tag)
+		  (default-value 'notmuch-search-oldest-first)
+		  (default-value 'notmuch-search-exclude)))
 
 ;;;###autoload
 (defun notmuch ()
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-docs-Update-with-notmuch-toggle-exclude.patch --]
[-- Type: text/x-patch, Size: 2452 bytes --]

From 57c13040b305d26f80321c2b435b950ee5a16a4a Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Tue, 22 Mar 2022 13:04:14 +0000
Subject: [PATCH 02/11] docs: Update with notmuch-*-toggle-exclude

---
 devel/emacs-keybindings.org | 2 +-
 doc/notmuch-emacs.rst       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index 00977bc3..d0ec2633 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -9,7 +9,7 @@
 | f            |                                        | notmuch-show-forward-message                          | notmuch-show-forward-message            |
 | g            |                                        |                                                       |                                         |
 | h            |                                        | notmuch-show-toggle-visibility-headers                |                                         |
-| i            |                                        |                                                       |                                         |
+| i            | notmuch-search-toggle-exclude          |                                                       | notmuch-tree-toggle-exclude             |
 | j            | notmuch-jump-search                    | notmuch-jump-search                                   | notmuch-jump-search                     |
 | k            | notmuch-tag-jump                       | notmuch-tag-jump                                      | notmuch-tag-jump                        |
 | l            | notmuch-search-filter                  | notmuch-show-filter-thread                            | notmuch-tree-filter                     |
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 41f62390..dacc5b60 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -162,6 +162,9 @@ menu of results that the user can explore further by pressing
 ``g`` ``=``
     Refresh the buffer
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
+
 ``?``
     Display full set of key bindings
 
@@ -321,6 +324,8 @@ tags.
 ``t`` ``notmuch-tree-filter-by-tag``
    Filter the current search results based on an additional tag
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
 
 ``g`` ``=``
     Refresh the buffer
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-emacs-add-new-option-notmuch-search-exclude.patch --]
[-- Type: text/x-patch, Size: 14661 bytes --]

From 9eb028463bfd6000f3e9da2d46f7a2118bea6f93 Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sat, 27 Nov 2021 18:58:43 +0000
Subject: [PATCH 03/11] emacs: add new option notmuch-search-exclude

The new notmuch-search-exclude option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude
have also been added that toggle the value of notmuch-search-exclude for
the search in the current search or tree buffer. It's bound to "i" in
the respective keymaps for these modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this
  + include notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

If there was a reasoning behind these not persisting the value of these
variables then we should revert it before merging and discuss whether
it's worth persisting notmuch-search-exclude.

[1]: id:87ilxlxsng.fsf@kisara.moe
---
 emacs/notmuch-jump.el | 11 ++++++----
 emacs/notmuch-lib.el  | 10 +++++++++
 emacs/notmuch-tree.el | 40 ++++++++++++++++++++++++---------
 emacs/notmuch.el      | 51 +++++++++++++++++++++++++++++++++----------
 4 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..e98c9c1d 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		 (cl-case (plist-get saved-search :sort-order)
 		   (newest-first nil)
 		   (oldest-first t)
-		   (otherwise (default-value 'notmuch-search-oldest-first)))))
+		   (otherwise (default-value 'notmuch-search-oldest-first))))
+		(exclude (default-value 'notmuch-search-exclude)))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
-			  (lambda () (notmuch-tree query)))
+			  (lambda () (notmuch-tree query nil nil nil nil nil nil
+					      oldest-first exclude)))
 			 ((eq (plist-get saved-search :search-type) 'unthreaded)
-			  (lambda () (notmuch-unthreaded query)))
+			  (lambda () (notmuch-unthreaded query nil nil nil nil
+						    oldest-first exclude)))
 			 (t
-			  (lambda () (notmuch-search query oldest-first)))))
+			  (lambda () (notmuch-search query oldest-first exclude)))))
 		  action-map)))))
     (setq action-map (nreverse action-map))
     (if action-map
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 1e631d0e..d5682ebe 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,6 +105,16 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
+(defcustom notmuch-search-exclude t
+  "Hide mail tagged with a excluded tag.
+
+Excluded tags are defined in the users configuration file under
+the search section. When this variable is true, any mail with
+such a tag will not be shown in the search output."
+  :type 'boolean
+  :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-exclude)
+
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 303c6fad..e4d9ae44 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -363,6 +363,7 @@ then NAME behaves like CMD."
     (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
+    (define-key map "i" 'notmuch-tree-toggle-exclude)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
     (define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
     (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -578,7 +579,9 @@ NOT change the database."
   "Call notmuch search with the current query."
   (interactive)
   (notmuch-tree-close-message-window)
-  (notmuch-search (notmuch-tree-get-query)))
+  (notmuch-search (notmuch-tree-get-query)
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -791,7 +794,8 @@ nil otherwise."
 			 target
 			 nil
 			 unthreaded
-			 notmuch-search-oldest-first)))
+			 notmuch-search-oldest-first
+			 notmuch-search-exclude)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1108,7 +1112,8 @@ Complete list of currently available key bindings:
 					 results-buf)))))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
-					open-target unthreaded oldest-first)
+					open-target unthreaded oldest-first
+					exclude)
   "Insert the tree view of the search in the current buffer.
 
 This is is a helper function for notmuch-tree. The arguments are
@@ -1117,6 +1122,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
+  (setq notmuch-search-exclude exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1136,14 +1142,15 @@ the same as for the function notmuch-tree."
 			      (and query-context
 				   (concat " and (" query-context ")"))))
 	 (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
-	 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+	 (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+	 (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
     (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
       (setq search-args basic-query))
     (notmuch-tag-clear-cache)
     (let ((proc (notmuch-start-notmuch
 		 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
 		 "show" "--body=false" "--format=sexp" "--format-version=5"
-		 sort-arg message-arg search-args))
+		 sort-arg message-arg exclude-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
 	  ;; should be called no matter how the process dies.
@@ -1170,8 +1177,18 @@ default sort order is defined by `notmuch-search-oldest-first'."
   (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-tree-refresh-view))
 
+(defun notmuch-tree-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-tree-refresh-view))
+
 (defun notmuch-tree (&optional query query-context target buffer-name
-			       open-target unthreaded parent-buffer oldest-first)
+			       open-target unthreaded parent-buffer
+			       oldest-first exclude)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1200,17 +1217,19 @@ The arguments are:
     (pop-to-buffer-same-window buffer))
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
-  (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+  (notmuch-tree-worker query query-context target open-target
+		       unthreaded oldest-first exclude)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target)
+				     open-target oldest-first exclude)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
   (interactive)
-  (notmuch-tree query query-context target buffer-name open-target t))
+  (notmuch-tree query query-context target buffer-name open-target
+		t nil oldest-first exclude))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1244,7 +1263,8 @@ search results and that are also tagged with the given TAG."
 		  nil
 		  notmuch-tree-unthreaded
 		  nil
-		  notmuch-search-oldest-first)))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude)))
 
 ;;; _
 
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index c9cf80dc..a42cb576 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -178,6 +178,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "i" 'notmuch-search-toggle-exclude)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -537,12 +538,18 @@ thread."
 (defun notmuch-tree-from-search-current-query ()
   "Tree view of current query."
   (interactive)
-  (notmuch-tree notmuch-search-query-string))
+  (notmuch-tree notmuch-search-query-string
+		nil nil nil nil nil nil
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
   (interactive)
-  (notmuch-unthreaded notmuch-search-query-string))
+  (notmuch-unthreaded notmuch-search-query-string
+		      nil nil nil nil
+		      notmuch-search-oldest-first
+		      notmuch-search-exclude))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -551,7 +558,9 @@ thread."
 		notmuch-search-query-string
 		nil
 		(notmuch-prettify-subject (notmuch-search-find-subject))
-		t nil (current-buffer)))
+		t nil (current-buffer)
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -1021,14 +1030,15 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line
-				 no-display)
+(defun notmuch-search (&optional query oldest-first exclude target-thread
+				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
+  EXCLUDE: A boolean controlling whether to omit threads with excluded tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1043,9 +1053,10 @@ the configured default sort order."
    (list
     ;; Prompt for a query
     nil
-    ;; Use the default search order (if we're doing a search from a
-    ;; search buffer, ignore any buffer-local overrides)
-    (default-value 'notmuch-search-oldest-first)))
+    ;; Use the default search order and exclude value (if we're doing a
+    ;; search from a search buffer, ignore any buffer-local overrides)
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1059,6 +1070,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
+    (setq notmuch-search-exclude exclude)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1072,6 +1084,9 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
+		     (if exclude
+			 "--exclude=true"
+		       "--exclude=false")
 		     query)))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
@@ -1092,11 +1107,21 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
+		  notmuch-search-exclude
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
   (goto-char (point-min)))
 
+(defun notmuch-search-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -1125,7 +1150,8 @@ current search results AND the additional query string provided."
     (notmuch-search (if (string= grouped-original-query "*")
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
-		    notmuch-search-oldest-first)))
+		    notmuch-search-oldest-first
+		    notmuch-search-exclude)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1136,13 +1162,16 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Filter by tag: "
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
-		  notmuch-search-oldest-first))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
   (interactive
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
-  (notmuch-search (concat "tag:" tag)))
+  (notmuch-search (concat "tag:" tag)
+		  (default-value 'notmuch-search-oldest-first)
+		  (default-value 'notmuch-search-exclude)))
 
 ;;;###autoload
 (defun notmuch ()
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-docs-Update-with-notmuch-toggle-exclude.patch --]
[-- Type: text/x-patch, Size: 2452 bytes --]

From c957b208612beb54a3b4225f990729b4cdb7ca6e Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Tue, 22 Mar 2022 13:04:14 +0000
Subject: [PATCH 04/11] docs: Update with notmuch-*-toggle-exclude

---
 devel/emacs-keybindings.org | 2 +-
 doc/notmuch-emacs.rst       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index 00977bc3..d0ec2633 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -9,7 +9,7 @@
 | f            |                                        | notmuch-show-forward-message                          | notmuch-show-forward-message            |
 | g            |                                        |                                                       |                                         |
 | h            |                                        | notmuch-show-toggle-visibility-headers                |                                         |
-| i            |                                        |                                                       |                                         |
+| i            | notmuch-search-toggle-exclude          |                                                       | notmuch-tree-toggle-exclude             |
 | j            | notmuch-jump-search                    | notmuch-jump-search                                   | notmuch-jump-search                     |
 | k            | notmuch-tag-jump                       | notmuch-tag-jump                                      | notmuch-tag-jump                        |
 | l            | notmuch-search-filter                  | notmuch-show-filter-thread                            | notmuch-tree-filter                     |
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 78528785..0323b56b 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -201,6 +201,9 @@ menu of results that the user can explore further by pressing
 ``g`` ``=``
     Refresh the buffer
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
+
 ``?``
     Display full set of key bindings
 
@@ -384,6 +387,8 @@ tags.
 ``t`` ``notmuch-tree-filter-by-tag``
    Filter the current search results based on an additional tag
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
 
 ``g`` ``=``
     Refresh the buffer
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-test-Fix-Search-handles-subprocess-error-exit-codes.patch --]
[-- Type: text/x-patch, Size: 1006 bytes --]

From e9ce2bf2eaf2aabba3faee2e128bbf95329eb602 Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sun, 24 Jul 2022 16:30:58 +0100
Subject: [PATCH 05/11] test: Fix Search handles subprocess error exit codes

Add in a new option --exclude which wasn't previously passed to the subprocess.
---
 test/T310-emacs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 9d0df187..b89a100e 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -1030,7 +1030,7 @@ End of search results.
 YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
 === ERROR ===
 YYY/notmuch_fail exited with status 1
-command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
+command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox
 exit status: 1"
 
 test_begin_subtest "Search handles subprocess warnings"
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-test-Fix-Navigation-of-notmuch-hello-to-search-resul.patch --]
[-- Type: text/x-patch, Size: 1453 bytes --]

From dbccbadc5ebed5e990aeae11a3efeea5e4017273 Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sun, 24 Jul 2022 16:55:49 +0100
Subject: [PATCH 06/11] test: Fix Navigation of notmuch-hello to search results

Using the widget properly applies the notmuch-search-exclude and
notmuch-search-oldest-first options. Since the latter is now passed when
switching between notmuch-search and notmuch-tree buffers it broke the
ordering of output this test expected. I did consider just updating the
output file to match what's being outputted but for some reason it
wasn't being very deterministic (changed after every test-run) so I
instead opted to use a search method which didn't populate either of the
previous options.
---
 test/T460-emacs-tree.sh | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 0f23b418..6958073e 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -91,10 +91,7 @@ output=$(notmuch search --output=messages 'tag:test_thread_tag')
 test_expect_equal "$output" ""
 
 test_begin_subtest "Navigation of notmuch-hello to search results"
-test_emacs '(notmuch-hello)
-	    (goto-char (point-min))
-	    (re-search-forward "inbox")
-	    (widget-button-press (1- (point)))
+test_emacs '(notmuch-search "tag:inbox")
 	    (notmuch-test-wait)
 	    (notmuch-tree-from-search-current-query)
 	    (notmuch-test-wait)
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-feat-Allow-exclude-configuration-in-notmuch-hello.patch --]
[-- Type: text/x-patch, Size: 3573 bytes --]

From 723d9f217ad10206470f3b0a06572438f92af982 Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sun, 24 Jul 2022 19:18:08 +0100
Subject: [PATCH 07/11] feat: Allow :exclude configuration in notmuch-hello

---
 emacs/notmuch-hello.el | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 4662e704..810f094e 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -143,6 +143,10 @@ a plist. Supported properties are
   :sort-order      Specify the sort order to be used for the search.
                    Possible values are `oldest-first', `newest-first'
                    or nil. Nil means use the default sort order.
+  :excluded        Whether to include mail with excluded tags in the
+                   search. Possible values are `include', `exclude',
+                   or nil. Nil means use the default value of
+                   `notmuch-search-exclude'.
   :search-type     Specify whether to run the search in search-mode,
                    tree mode or unthreaded mode. Set to `tree' to
                    specify tree mode, 'unthreaded to specify
@@ -484,19 +488,19 @@ diagonal."
 	     append (notmuch-hello-reflect-generate-row ncols nrows row list))))
 
 (defun notmuch-hello-widget-search (widget &rest _ignore)
-  (cl-case (widget-get widget :notmuch-search-type)
-   (tree
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
-      (notmuch-tree (widget-get widget :notmuch-search-terms)
-		    nil nil n nil nil nil
-		    (widget-get widget :notmuch-search-oldest-first))))
-   (unthreaded
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget)
-						"unthreaded" t)))
-      (notmuch-unthreaded (widget-get widget :notmuch-search-terms) nil nil n)))
-   (t
-    (notmuch-search (widget-get widget :notmuch-search-terms)
-		    (widget-get widget :notmuch-search-oldest-first)))))
+  (let ((search-terms (widget-get widget :notmuch-search-terms))
+	(oldest-first (widget-get widget :notmuch-search-oldest-first))
+	(exclude (widget-get widget :notmuch-search-exclude)))
+    (cl-case (widget-get widget :notmuch-search-type)
+      (tree
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
+	 (notmuch-tree search-terms nil nil n nil nil nil oldest-first exclude)))
+      (unthreaded
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget)
+						   "unthreaded" t)))
+	 (notmuch-unthreaded search-terms nil nil n nil oldest-first search-exclude)))
+      (t
+       (notmuch-search search-terms oldest-first exclude)))))
 
 (defun notmuch-saved-search-count (search)
   (car (notmuch--process-lines notmuch-command "count" search)))
@@ -643,6 +647,10 @@ with `notmuch-hello-query-counts'."
 				     (newest-first nil)
 				     (oldest-first t)
 				     (otherwise notmuch-search-oldest-first)))
+		     (exclude (cl-case (plist-get elem :excluded)
+				(exclude t)
+				(include nil)
+				(otherwise notmuch-search-exclude)))
 		     (search-type (plist-get elem :search-type))
 		     (msg-count (plist-get elem :count)))
 		(widget-insert (format "%8s "
@@ -652,6 +660,7 @@ with `notmuch-hello-query-counts'."
 			       :notmuch-search-terms query
 			       :notmuch-search-oldest-first oldest-first
 			       :notmuch-search-type search-type
+			       :notmuch-search-exclude exclude
 			       name)
 		(setq column-indent
 		      (1+ (max 0 (- column-width (length name)))))))
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-Revert-test-Fix-Navigation-of-notmuch-hello-to-searc.patch --]
[-- Type: text/x-patch, Size: 1018 bytes --]

From ef6b6553334eb06c25e2c0b9a7aa5d733a97aa2c Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sun, 24 Jul 2022 19:55:18 +0100
Subject: [PATCH 08/11] Revert "test: Fix Navigation of notmuch-hello to search
 results"

This reverts commit dbccbadc5ebed5e990aeae11a3efeea5e4017273.
---
 test/T460-emacs-tree.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 6958073e..0f23b418 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -91,7 +91,10 @@ output=$(notmuch search --output=messages 'tag:test_thread_tag')
 test_expect_equal "$output" ""
 
 test_begin_subtest "Navigation of notmuch-hello to search results"
-test_emacs '(notmuch-search "tag:inbox")
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
 	    (notmuch-test-wait)
 	    (notmuch-tree-from-search-current-query)
 	    (notmuch-test-wait)
-- 
2.37.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-feat-Add-more-interactive-specs.patch --]
[-- Type: text/x-patch, Size: 1701 bytes --]

From ad6bb0fbb18bb8be59e242842ccd7ea85e8c9a3e Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sun, 24 Jul 2022 20:18:10 +0100
Subject: [PATCH 09/11] feat: Add more interactive specs

---
 emacs/notmuch-tree.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 50b9645e..6c8b7bc0 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1202,7 +1202,15 @@ The arguments are:
       it is nil \"*notmuch-tree\" followed by QUERY is used.
   OPEN-TARGET: If TRUE open the target message in the message pane.
   UNTHREADED: If TRUE only show matching messages in an unthreaded view."
-  (interactive)
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
   (unless query
     (setq query (notmuch-read-query (concat "Notmuch "
 					    (if unthreaded "unthreaded " "tree ")
@@ -1226,7 +1234,15 @@ The arguments are:
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
-  (interactive)
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
   (notmuch-tree query query-context target buffer-name open-target
 		t nil oldest-first exclude))
 
-- 
2.37.1


[-- Attachment #11: 0010-test-Add-test-cases-for-new-exclude-option.patch --]
[-- Type: text/x-patch, Size: 23959 bytes --]

From 34fdf187e24ac9e1b39db277ec261ab2a4ee82f0 Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sun, 24 Jul 2022 20:20:23 +0100
Subject: [PATCH 10/11] test: Add test cases for new exclude option

---
 test/T461-emacs-search-exclude.sh             | 99 +++++++++++++++++++
 .../notmuch-search-tag-inbox-with-excluded    | 25 +++++
 .../notmuch-search-tag-inbox-without-excluded | 21 ++++
 .../notmuch-tree-tag-inbox-with-excluded      | 53 ++++++++++
 .../notmuch-tree-tag-inbox-without-excluded   | 49 +++++++++
 5 files changed, 247 insertions(+)
 create mode 100755 test/T461-emacs-search-exclude.sh
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded

diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exclude.sh
new file mode 100755
index 00000000..bf558847
--- /dev/null
+++ b/test/T461-emacs-search-exclude.sh
@@ -0,0 +1,99 @@
+#!/usr/bin/env bash
+
+test_description="exclude options persist between Emacs search and tree modes"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
+
+test_require_emacs
+add_email_corpus
+notmuch config set search.exclude_tags deleted
+notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
+
+# Basic test cases just asserting exclude option is working and consistent.
+
+test_begin_subtest "Search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-exclude)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Tree search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in tree search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-exclude)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+# Choice of showing excluded mail persists when switching between tree and search
+# buffers.
+
+test_begin_subtest "Value of exclude from search persists into tree search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-exclude)
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of exclude from tree persists into search search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-exclude)
+	    (notmuch-test-wait)
+	    (notmuch-search-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+# TODO: Add test cases for unthreaded conversions as well.
+
+test_done
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
new file mode 100644
index 00000000..ce1d7118
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
@@ -0,0 +1,25 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before statting (deleted inbox unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18 [1/1]   Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
new file mode 100644
index 00000000..8a874320
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
@@ -0,0 +1,21 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
new file mode 100644
index 00000000..5c6b2d7a
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (deleted inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
new file mode 100644
index 00000000..55806d18
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
@@ -0,0 +1,49 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
-- 
2.37.1


[-- Attachment #12: 0011-test-Fix-Navigation-of-notmuch-hello-to-search-resul.patch --]
[-- Type: text/x-patch, Size: 8189 bytes --]

From 62da435dd021f74c2f7e5b87239c8bb8e8f92feb Mon Sep 17 00:00:00 2001
From: Mohsin Kaleem <mohkale@kisara.moe>
Date: Sun, 24 Jul 2022 20:41:06 +0100
Subject: [PATCH 11/11] test: Fix Navigation of notmuch-hello to search results

The default value of oldest-first is true so the oldest mail is shown
first by default. This test case used the tree-from-search function
which now persists this value of true (previously always defaulting to
nil in its place) which produced a different tree output where the
oldest-mail is sorted first despite previously being sorted last. Fixed
by adding in this output as a separate file and comparing against it
instead.
---
 test/T460-emacs-tree.sh                       |  2 +-
 .../notmuch-tree-tag-inbox-oldest-first       | 53 +++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first

diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 0f23b418..00812407 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -100,7 +100,7 @@ test_emacs '(notmuch-hello)
 	    (notmuch-test-wait)
 	    (test-output)
 	    (delete-other-windows)'
-test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-oldest-first OUTPUT
 
 test_begin_subtest "Tree view of a single thread (from search)"
 test_emacs '(notmuch-hello)
diff --git a/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
new file mode 100644
index 00000000..588fc583
--- /dev/null
+++ b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
-- 
2.37.1


[-- Attachment #13: Type: text/plain, Size: 19 bytes --]


-- 
Mohsin Kaleem

[-- Attachment #14: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-07-24 20:59                   ` Mohsin Kaleem
@ 2022-07-30 14:02                     ` David Bremner
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
                                         ` (2 more replies)
  0 siblings, 3 replies; 45+ messages in thread
From: David Bremner @ 2022-07-30 14:02 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

> David Bremner <david@tethera.net> writes:
>
> Hi, firstly sorry for taking so long to come back to this. I honestly
> have tried to fix this multiple times since my last message but kept
> getting confused or misdirected by how the tests are setup so I gave up
> and decided to come back to it later. Today I finally just sped through
> everything and think I have everything ready.
>

I think the patch series needs a bit of cleanup still. The first two
patches occur twice and then a later patch is reverted (so presumably
those two can be dropped as well).

If possible, please use git send-email to send one-patch-per-message, it
makes reviewing in notmuch-emacs much easier for me.

You may also want to rebase against master before resending, since I
have just a applied some changes to the emacs UI code that might collide
with yours.

d

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH 1/9] emacs: add new option notmuch-search-exclude
  2022-07-30 14:02                     ` David Bremner
@ 2022-08-07 14:57                       ` Mohsin Kaleem
  2022-08-07 14:57                         ` [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude Mohsin Kaleem
                                           ` (7 more replies)
  2022-08-07 15:00                       ` [PATCH] emacs: add new option notmuch-search-exclude Mohsin Kaleem
  2023-04-16 13:18                       ` [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded mohkale
  2 siblings, 8 replies; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

The new notmuch-search-exclude option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude
have also been added that toggle the value of notmuch-search-exclude for
the search in the current search or tree buffer. It's bound to "i" in
the respective keymaps for these modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this
  + include notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

If there was a reasoning behind these not persisting the value of these
variables then we should revert it before merging and discuss whether
it's worth persisting notmuch-search-exclude.

[1]: id:87ilxlxsng.fsf@kisara.moe
---
 emacs/notmuch-jump.el | 11 ++++++----
 emacs/notmuch-lib.el  | 10 +++++++++
 emacs/notmuch-tree.el | 40 ++++++++++++++++++++++++---------
 emacs/notmuch.el      | 51 +++++++++++++++++++++++++++++++++----------
 4 files changed, 87 insertions(+), 25 deletions(-)

diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..e98c9c1d 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		 (cl-case (plist-get saved-search :sort-order)
 		   (newest-first nil)
 		   (oldest-first t)
-		   (otherwise (default-value 'notmuch-search-oldest-first)))))
+		   (otherwise (default-value 'notmuch-search-oldest-first))))
+		(exclude (default-value 'notmuch-search-exclude)))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
-			  (lambda () (notmuch-tree query)))
+			  (lambda () (notmuch-tree query nil nil nil nil nil nil
+					      oldest-first exclude)))
 			 ((eq (plist-get saved-search :search-type) 'unthreaded)
-			  (lambda () (notmuch-unthreaded query)))
+			  (lambda () (notmuch-unthreaded query nil nil nil nil
+						    oldest-first exclude)))
 			 (t
-			  (lambda () (notmuch-search query oldest-first)))))
+			  (lambda () (notmuch-search query oldest-first exclude)))))
 		  action-map)))))
     (setq action-map (nreverse action-map))
     (if action-map
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 84ba8c5e..96795054 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,6 +105,16 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
+(defcustom notmuch-search-exclude t
+  "Hide mail tagged with a excluded tag.
+
+Excluded tags are defined in the users configuration file under
+the search section. When this variable is true, any mail with
+such a tag will not be shown in the search output."
+  :type 'boolean
+  :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-exclude)
+
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index f63ac9a5..9ed8a3d9 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -375,6 +375,7 @@ then NAME behaves like CMD."
     (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
+    (define-key map "i" 'notmuch-tree-toggle-exclude)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
     (define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
     (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -590,7 +591,9 @@ NOT change the database."
   "Call notmuch search with the current query."
   (interactive)
   (notmuch-tree-close-message-window)
-  (notmuch-search (notmuch-tree-get-query)))
+  (notmuch-search (notmuch-tree-get-query)
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -803,7 +806,8 @@ nil otherwise."
 			 target
 			 nil
 			 unthreaded
-			 notmuch-search-oldest-first)))
+			 notmuch-search-oldest-first
+			 notmuch-search-exclude)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1120,7 +1124,8 @@ Complete list of currently available key bindings:
 					 results-buf)))))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
-					open-target unthreaded oldest-first)
+					open-target unthreaded oldest-first
+					exclude)
   "Insert the tree view of the search in the current buffer.
 
 This is is a helper function for notmuch-tree. The arguments are
@@ -1129,6 +1134,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
+  (setq notmuch-search-exclude exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1148,14 +1154,15 @@ the same as for the function notmuch-tree."
 			      (and query-context
 				   (concat " and (" query-context ")"))))
 	 (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
-	 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+	 (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+	 (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
     (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
       (setq search-args basic-query))
     (notmuch-tag-clear-cache)
     (let ((proc (notmuch-start-notmuch
 		 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
 		 "show" "--body=false" "--format=sexp" "--format-version=5"
-		 sort-arg message-arg search-args))
+		 sort-arg message-arg exclude-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
 	  ;; should be called no matter how the process dies.
@@ -1182,8 +1189,18 @@ default sort order is defined by `notmuch-search-oldest-first'."
   (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-tree-refresh-view))
 
+(defun notmuch-tree-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-tree-refresh-view))
+
 (defun notmuch-tree (&optional query query-context target buffer-name
-			       open-target unthreaded parent-buffer oldest-first)
+			       open-target unthreaded parent-buffer
+			       oldest-first exclude)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1212,17 +1229,19 @@ The arguments are:
     (pop-to-buffer-same-window buffer))
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
-  (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+  (notmuch-tree-worker query query-context target open-target
+		       unthreaded oldest-first exclude)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target)
+				     open-target oldest-first exclude)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
   (interactive)
-  (notmuch-tree query query-context target buffer-name open-target t))
+  (notmuch-tree query query-context target buffer-name open-target
+		t nil oldest-first exclude))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1256,7 +1275,8 @@ search results and that are also tagged with the given TAG."
 		  nil
 		  notmuch-tree-unthreaded
 		  nil
-		  notmuch-search-oldest-first)))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude)))
 
 ;;; _
 
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5cb7acd2..0158e20a 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -187,6 +187,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "i" 'notmuch-search-toggle-exclude)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -549,12 +550,18 @@ Return non-nil on success."
 (defun notmuch-tree-from-search-current-query ()
   "Tree view of current query."
   (interactive)
-  (notmuch-tree notmuch-search-query-string))
+  (notmuch-tree notmuch-search-query-string
+		nil nil nil nil nil nil
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
   (interactive)
-  (notmuch-unthreaded notmuch-search-query-string))
+  (notmuch-unthreaded notmuch-search-query-string
+		      nil nil nil nil
+		      notmuch-search-oldest-first
+		      notmuch-search-exclude))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -563,7 +570,9 @@ Return non-nil on success."
 		notmuch-search-query-string
 		nil
 		(notmuch-prettify-subject (notmuch-search-find-subject))
-		t nil (current-buffer)))
+		t nil (current-buffer)
+		notmuch-search-oldest-first
+		notmuch-search-exclude))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -1033,14 +1042,15 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line
-				 no-display)
+(defun notmuch-search (&optional query oldest-first exclude target-thread
+				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
+  EXCLUDE: A boolean controlling whether to omit threads with excluded tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1055,9 +1065,10 @@ the configured default sort order."
    (list
     ;; Prompt for a query
     nil
-    ;; Use the default search order (if we're doing a search from a
-    ;; search buffer, ignore any buffer-local overrides)
-    (default-value 'notmuch-search-oldest-first)))
+    ;; Use the default search order and exclude value (if we're doing a
+    ;; search from a search buffer, ignore any buffer-local overrides)
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1071,6 +1082,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
+    (setq notmuch-search-exclude exclude)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1084,6 +1096,9 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
+		     (if exclude
+			 "--exclude=true"
+		       "--exclude=false")
 		     query)))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
@@ -1104,11 +1119,21 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
+		  notmuch-search-exclude
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
   (goto-char (point-min)))
 
+(defun notmuch-search-toggle-exclude ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-exclude'."
+  (interactive)
+  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -1137,7 +1162,8 @@ current search results AND the additional query string provided."
     (notmuch-search (if (string= grouped-original-query "*")
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
-		    notmuch-search-oldest-first)))
+		    notmuch-search-oldest-first
+		    notmuch-search-exclude)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1148,13 +1174,16 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Filter by tag: "
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
-		  notmuch-search-oldest-first))
+		  notmuch-search-oldest-first
+		  notmuch-search-exclude))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
   (interactive
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
-  (notmuch-search (concat "tag:" tag)))
+  (notmuch-search (concat "tag:" tag)
+		  (default-value 'notmuch-search-oldest-first)
+		  (default-value 'notmuch-search-exclude)))
 
 ;;;###autoload
 (defun notmuch ()
-- 
2.37.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  2022-08-12 10:42                           ` David Bremner
  2022-08-07 14:57                         ` [PATCH 3/9] test: Fix Search handles subprocess error exit codes Mohsin Kaleem
                                           ` (6 subsequent siblings)
  7 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

---
 devel/emacs-keybindings.org | 2 +-
 doc/notmuch-emacs.rst       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index ad7f72ef..be6b2481 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -9,7 +9,7 @@
 | f            |                                        | notmuch-show-forward-message                          | notmuch-show-forward-message            |
 | g            |                                        |                                                       |                                         |
 | h            |                                        | notmuch-show-toggle-visibility-headers                |                                         |
-| i            |                                        |                                                       |                                         |
+| i            | notmuch-search-toggle-exclude          |                                                       | notmuch-tree-toggle-exclude             |
 | j            | notmuch-jump-search                    | notmuch-jump-search                                   | notmuch-jump-search                     |
 | k            | notmuch-tag-jump                       | notmuch-tag-jump                                      | notmuch-tag-jump                        |
 | l            | notmuch-search-filter                  | notmuch-show-filter-thread                            | notmuch-tree-filter                     |
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index e69bd23d..647e0c40 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -212,6 +212,9 @@ menu of results that the user can explore further by pressing
 ``g`` ``=``
     Refresh the buffer
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
+
 ``?``
     Display full set of key bindings
 
@@ -468,6 +471,8 @@ tags.
 ``t`` ``notmuch-tree-filter-by-tag``
    Filter the current search results based on an additional tag
 
+``i``
+    Toggle whether to show messages with excluded tags in search results.
 
 ``g`` ``=``
     Refresh the buffer
-- 
2.37.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 3/9] test: Fix Search handles subprocess error exit codes
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
  2022-08-07 14:57                         ` [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  2022-08-07 14:57                         ` [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello Mohsin Kaleem
                                           ` (5 subsequent siblings)
  7 siblings, 0 replies; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

Add in a new option --exclude which wasn't previously passed to the subprocess.
---
 test/T310-emacs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 9d0df187..b89a100e 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -1030,7 +1030,7 @@ End of search results.
 YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
 === ERROR ===
 YYY/notmuch_fail exited with status 1
-command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
+command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox
 exit status: 1"
 
 test_begin_subtest "Search handles subprocess warnings"
-- 
2.37.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
  2022-08-07 14:57                         ` [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude Mohsin Kaleem
  2022-08-07 14:57                         ` [PATCH 3/9] test: Fix Search handles subprocess error exit codes Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  2022-08-12 10:46                           ` David Bremner
  2022-08-07 14:57                         ` [PATCH 5/9] feat: Add more interactive specs Mohsin Kaleem
                                           ` (4 subsequent siblings)
  7 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

---
 emacs/notmuch-hello.el | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 4662e704..810f094e 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -143,6 +143,10 @@ a plist. Supported properties are
   :sort-order      Specify the sort order to be used for the search.
                    Possible values are `oldest-first', `newest-first'
                    or nil. Nil means use the default sort order.
+  :excluded        Whether to include mail with excluded tags in the
+                   search. Possible values are `include', `exclude',
+                   or nil. Nil means use the default value of
+                   `notmuch-search-exclude'.
   :search-type     Specify whether to run the search in search-mode,
                    tree mode or unthreaded mode. Set to `tree' to
                    specify tree mode, 'unthreaded to specify
@@ -484,19 +488,19 @@ diagonal."
 	     append (notmuch-hello-reflect-generate-row ncols nrows row list))))
 
 (defun notmuch-hello-widget-search (widget &rest _ignore)
-  (cl-case (widget-get widget :notmuch-search-type)
-   (tree
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
-      (notmuch-tree (widget-get widget :notmuch-search-terms)
-		    nil nil n nil nil nil
-		    (widget-get widget :notmuch-search-oldest-first))))
-   (unthreaded
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget)
-						"unthreaded" t)))
-      (notmuch-unthreaded (widget-get widget :notmuch-search-terms) nil nil n)))
-   (t
-    (notmuch-search (widget-get widget :notmuch-search-terms)
-		    (widget-get widget :notmuch-search-oldest-first)))))
+  (let ((search-terms (widget-get widget :notmuch-search-terms))
+	(oldest-first (widget-get widget :notmuch-search-oldest-first))
+	(exclude (widget-get widget :notmuch-search-exclude)))
+    (cl-case (widget-get widget :notmuch-search-type)
+      (tree
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
+	 (notmuch-tree search-terms nil nil n nil nil nil oldest-first exclude)))
+      (unthreaded
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget)
+						   "unthreaded" t)))
+	 (notmuch-unthreaded search-terms nil nil n nil oldest-first search-exclude)))
+      (t
+       (notmuch-search search-terms oldest-first exclude)))))
 
 (defun notmuch-saved-search-count (search)
   (car (notmuch--process-lines notmuch-command "count" search)))
@@ -643,6 +647,10 @@ with `notmuch-hello-query-counts'."
 				     (newest-first nil)
 				     (oldest-first t)
 				     (otherwise notmuch-search-oldest-first)))
+		     (exclude (cl-case (plist-get elem :excluded)
+				(exclude t)
+				(include nil)
+				(otherwise notmuch-search-exclude)))
 		     (search-type (plist-get elem :search-type))
 		     (msg-count (plist-get elem :count)))
 		(widget-insert (format "%8s "
@@ -652,6 +660,7 @@ with `notmuch-hello-query-counts'."
 			       :notmuch-search-terms query
 			       :notmuch-search-oldest-first oldest-first
 			       :notmuch-search-type search-type
+			       :notmuch-search-exclude exclude
 			       name)
 		(setq column-indent
 		      (1+ (max 0 (- column-width (length name)))))))
-- 
2.37.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 5/9] feat: Add more interactive specs
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
                                           ` (2 preceding siblings ...)
  2022-08-07 14:57                         ` [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  2022-08-12 10:48                           ` David Bremner
  2022-08-07 14:57                         ` [PATCH 6/9] test: Add test cases for new exclude option Mohsin Kaleem
                                           ` (3 subsequent siblings)
  7 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

---
 emacs/notmuch-tree.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 9ed8a3d9..5f999424 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1215,7 +1215,15 @@ The arguments are:
       it is nil \"*notmuch-tree\" followed by QUERY is used.
   OPEN-TARGET: If TRUE open the target message in the message pane.
   UNTHREADED: If TRUE only show matching messages in an unthreaded view."
-  (interactive)
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
   (unless query
     (setq query (notmuch-read-query (concat "Notmuch "
 					    (if unthreaded "unthreaded " "tree ")
@@ -1239,7 +1247,15 @@ The arguments are:
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
-  (interactive)
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-exclude)))
   (notmuch-tree query query-context target buffer-name open-target
 		t nil oldest-first exclude))
 
-- 
2.37.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 6/9] test: Add test cases for new exclude option
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
                                           ` (3 preceding siblings ...)
  2022-08-07 14:57                         ` [PATCH 5/9] feat: Add more interactive specs Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  2022-08-08 18:56                           ` Tomi Ollila
  2022-08-12 10:49                           ` David Bremner
  2022-08-07 14:57                         ` [PATCH 7/9] test: Fix Navigation of notmuch-hello to search results Mohsin Kaleem
                                           ` (2 subsequent siblings)
  7 siblings, 2 replies; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

---
 test/T461-emacs-search-exclude.sh             | 99 +++++++++++++++++++
 .../notmuch-search-tag-inbox-with-excluded    | 25 +++++
 .../notmuch-search-tag-inbox-without-excluded | 21 ++++
 .../notmuch-tree-tag-inbox-with-excluded      | 53 ++++++++++
 .../notmuch-tree-tag-inbox-without-excluded   | 49 +++++++++
 5 files changed, 247 insertions(+)
 create mode 100755 test/T461-emacs-search-exclude.sh
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded

diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exclude.sh
new file mode 100755
index 00000000..bf558847
--- /dev/null
+++ b/test/T461-emacs-search-exclude.sh
@@ -0,0 +1,99 @@
+#!/usr/bin/env bash
+
+test_description="exclude options persist between Emacs search and tree modes"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
+
+test_require_emacs
+add_email_corpus
+notmuch config set search.exclude_tags deleted
+notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
+
+# Basic test cases just asserting exclude option is working and consistent.
+
+test_begin_subtest "Search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-exclude)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Tree search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in tree search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-exclude)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+# Choice of showing excluded mail persists when switching between tree and search
+# buffers.
+
+test_begin_subtest "Value of exclude from search persists into tree search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-exclude)
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of exclude from tree persists into search search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-exclude)
+	    (notmuch-test-wait)
+	    (notmuch-search-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+# TODO: Add test cases for unthreaded conversions as well.
+
+test_done
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
new file mode 100644
index 00000000..ce1d7118
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
@@ -0,0 +1,25 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before statting (deleted inbox unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18 [1/1]   Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
new file mode 100644
index 00000000..8a874320
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
@@ -0,0 +1,21 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
new file mode 100644
index 00000000..5c6b2d7a
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (deleted inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
new file mode 100644
index 00000000..55806d18
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
@@ -0,0 +1,49 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
-- 
2.37.1
\r

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 7/9] test: Fix Navigation of notmuch-hello to search results
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
                                           ` (4 preceding siblings ...)
  2022-08-07 14:57                         ` [PATCH 6/9] test: Add test cases for new exclude option Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  2022-08-12 10:51                           ` David Bremner
  2022-08-07 14:57                         ` [PATCH 8/9] review: Rename variables to better express intention Mohsin Kaleem
  2022-08-07 14:57                         ` [PATCH 9/9] build: Fix declare-function calls for updated functions Mohsin Kaleem
  7 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

The default value of oldest-first is true so the oldest mail is shown
first by default. This test case used the tree-from-search function
which now persists this value of true (previously always defaulting to
nil in its place) which produced a different tree output where the
oldest-mail is sorted first despite previously being sorted last. Fixed
by adding in this output as a separate file and comparing against it
instead.
---
 test/T460-emacs-tree.sh                       |  2 +-
 .../notmuch-tree-tag-inbox-oldest-first       | 53 +++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first

diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 3a1c449e..b540c555 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -100,7 +100,7 @@ test_emacs '(notmuch-hello)
 	    (notmuch-test-wait)
 	    (test-output)
 	    (delete-other-windows)'
-test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-oldest-first OUTPUT
 
 test_begin_subtest "Tree view of a single thread (from search)"
 test_emacs '(notmuch-hello)
diff --git a/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
new file mode 100644
index 00000000..588fc583
--- /dev/null
+++ b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
-- 
2.37.1
\r

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 8/9] review: Rename variables to better express intention
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
                                           ` (5 preceding siblings ...)
  2022-08-07 14:57                         ` [PATCH 7/9] test: Fix Navigation of notmuch-hello to search results Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  2022-08-12 10:55                           ` David Bremner
  2022-08-07 14:57                         ` [PATCH 9/9] build: Fix declare-function calls for updated functions Mohsin Kaleem
  7 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

---
 emacs/notmuch-hello.el | 18 +++++++++---------
 emacs/notmuch-jump.el  |  2 +-
 emacs/notmuch-lib.el   |  4 ++--
 emacs/notmuch-tree.el  | 24 ++++++++++++------------
 emacs/notmuch.el       | 29 +++++++++++++++--------------
 5 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 810f094e..39ba2537 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -143,10 +143,10 @@ a plist. Supported properties are
   :sort-order      Specify the sort order to be used for the search.
                    Possible values are `oldest-first', `newest-first'
                    or nil. Nil means use the default sort order.
-  :excluded        Whether to include mail with excluded tags in the
-                   search. Possible values are `include', `exclude',
+  :excluded        Whether to show mail with excluded tags in the
+                   search. Possible values are `hide', `show',
                    or nil. Nil means use the default value of
-                   `notmuch-search-exclude'.
+                   `notmuch-search-hide-excluded'.
   :search-type     Specify whether to run the search in search-mode,
                    tree mode or unthreaded mode. Set to `tree' to
                    specify tree mode, 'unthreaded to specify
@@ -490,7 +490,7 @@ diagonal."
 (defun notmuch-hello-widget-search (widget &rest _ignore)
   (let ((search-terms (widget-get widget :notmuch-search-terms))
 	(oldest-first (widget-get widget :notmuch-search-oldest-first))
-	(exclude (widget-get widget :notmuch-search-exclude)))
+	(exclude (widget-get widget :notmuch-search-hide-excluded)))
     (cl-case (widget-get widget :notmuch-search-type)
       (tree
        (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
@@ -498,7 +498,7 @@ diagonal."
       (unthreaded
        (let ((n (notmuch-search-format-buffer-name (widget-value widget)
 						   "unthreaded" t)))
-	 (notmuch-unthreaded search-terms nil nil n nil oldest-first search-exclude)))
+	 (notmuch-unthreaded search-terms nil nil n nil oldest-first exclude)))
       (t
        (notmuch-search search-terms oldest-first exclude)))))
 
@@ -648,9 +648,9 @@ with `notmuch-hello-query-counts'."
 				     (oldest-first t)
 				     (otherwise notmuch-search-oldest-first)))
 		     (exclude (cl-case (plist-get elem :excluded)
-				(exclude t)
-				(include nil)
-				(otherwise notmuch-search-exclude)))
+				(hide t)
+				(show nil)
+				(otherwise notmuch-search-hide-excluded)))
 		     (search-type (plist-get elem :search-type))
 		     (msg-count (plist-get elem :count)))
 		(widget-insert (format "%8s "
@@ -660,7 +660,7 @@ with `notmuch-hello-query-counts'."
 			       :notmuch-search-terms query
 			       :notmuch-search-oldest-first oldest-first
 			       :notmuch-search-type search-type
-			       :notmuch-search-exclude exclude
+			       :notmuch-search-hide-excluded exclude
 			       name)
 		(setq column-indent
 		      (1+ (max 0 (- column-width (length name)))))))
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index e98c9c1d..53496e5c 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -51,7 +51,7 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		   (newest-first nil)
 		   (oldest-first t)
 		   (otherwise (default-value 'notmuch-search-oldest-first))))
-		(exclude (default-value 'notmuch-search-exclude)))
+		(exclude (default-value 'notmuch-search-hide-excluded)))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 96795054..d0205d0e 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,7 +105,7 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
-(defcustom notmuch-search-exclude t
+(defcustom notmuch-search-hide-excluded t
   "Hide mail tagged with a excluded tag.
 
 Excluded tags are defined in the users configuration file under
@@ -113,7 +113,7 @@ the search section. When this variable is true, any mail with
 such a tag will not be shown in the search output."
   :type 'boolean
   :group 'notmuch-search)
-(make-variable-buffer-local 'notmuch-search-exclude)
+(make-variable-buffer-local 'notmuch-search-hide-excluded)
 
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 5f999424..6d19b9ed 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -593,7 +593,7 @@ NOT change the database."
   (notmuch-tree-close-message-window)
   (notmuch-search (notmuch-tree-get-query)
 		  notmuch-search-oldest-first
-		  notmuch-search-exclude))
+		  notmuch-search-hide-excluded))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -807,7 +807,7 @@ nil otherwise."
 			 nil
 			 unthreaded
 			 notmuch-search-oldest-first
-			 notmuch-search-exclude)))
+			 notmuch-search-hide-excluded)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1134,7 +1134,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
-  (setq notmuch-search-exclude exclude)
+  (setq notmuch-search-hide-excluded exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1193,14 +1193,14 @@ default sort order is defined by `notmuch-search-oldest-first'."
   "Toggle whether to hide excluded messages.
 
 This command toggles whether to hide excluded messages for the current
-search. The default value for this is defined by `notmuch-search-exclude'."
+search. The default value for this is defined by `notmuch-search-hide-excluded'."
   (interactive)
-  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (setq notmuch-search-hide-excluded (not notmuch-search-hide-excluded))
   (notmuch-tree-refresh-view))
 
 (defun notmuch-tree (&optional query query-context target buffer-name
 			       open-target unthreaded parent-buffer
-			       oldest-first exclude)
+			       oldest-first hide-excluded)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1223,7 +1223,7 @@ The arguments are:
     nil nil nil nil nil nil
     ;; Populate these from the default value of these options.
     (default-value 'notmuch-search-oldest-first)
-    (default-value 'notmuch-search-exclude)))
+    (default-value 'notmuch-search-hide-excluded)))
   (unless query
     (setq query (notmuch-read-query (concat "Notmuch "
 					    (if unthreaded "unthreaded " "tree ")
@@ -1238,12 +1238,12 @@ The arguments are:
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
   (notmuch-tree-worker query query-context target open-target
-		       unthreaded oldest-first exclude)
+		       unthreaded oldest-first hide-excluded)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target oldest-first exclude)
+				     open-target oldest-first hide-excluded)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
@@ -1255,9 +1255,9 @@ See function NOTMUCH-TREE for documentation of the arguments"
     nil nil nil nil
     ;; Populate these from the default value of these options.
     (default-value 'notmuch-search-oldest-first)
-    (default-value 'notmuch-search-exclude)))
+    (default-value 'notmuch-search-hide-excluded)))
   (notmuch-tree query query-context target buffer-name open-target
-		t nil oldest-first exclude))
+		t nil oldest-first hide-excluded))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1292,7 +1292,7 @@ search results and that are also tagged with the given TAG."
 		  notmuch-tree-unthreaded
 		  nil
 		  notmuch-search-oldest-first
-		  notmuch-search-exclude)))
+		  notmuch-search-hide-excluded)))
 
 ;;; _
 
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 0158e20a..8dee623b 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -553,7 +553,7 @@ Return non-nil on success."
   (notmuch-tree notmuch-search-query-string
 		nil nil nil nil nil nil
 		notmuch-search-oldest-first
-		notmuch-search-exclude))
+		notmuch-search-hide-excluded))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
@@ -561,7 +561,7 @@ Return non-nil on success."
   (notmuch-unthreaded notmuch-search-query-string
 		      nil nil nil nil
 		      notmuch-search-oldest-first
-		      notmuch-search-exclude))
+		      notmuch-search-hide-excluded))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -572,7 +572,7 @@ Return non-nil on success."
 		(notmuch-prettify-subject (notmuch-search-find-subject))
 		t nil (current-buffer)
 		notmuch-search-oldest-first
-		notmuch-search-exclude))
+		notmuch-search-hide-excluded))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -1042,7 +1042,7 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first exclude target-thread
+(defun notmuch-search (&optional query oldest-first hide-excluded target-thread
 				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
@@ -1050,7 +1050,8 @@ If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
-  EXCLUDE: A boolean controlling whether to omit threads with excluded tags.
+  HIDE-EXCLUDED: A boolean controlling whether to omit threads with excluded
+                 tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1068,7 +1069,7 @@ the configured default sort order."
     ;; Use the default search order and exclude value (if we're doing a
     ;; search from a search buffer, ignore any buffer-local overrides)
     (default-value 'notmuch-search-oldest-first)
-    (default-value 'notmuch-search-exclude)))
+    (default-value 'notmuch-search-hide-excluded)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1082,7 +1083,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
-    (setq notmuch-search-exclude exclude)
+    (setq notmuch-search-hide-excluded hide-excluded)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1096,7 +1097,7 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
-		     (if exclude
+		     (if hide-excluded
 			 "--exclude=true"
 		       "--exclude=false")
 		     query)))
@@ -1119,7 +1120,7 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
-		  notmuch-search-exclude
+		  notmuch-search-hide-excluded
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
@@ -1129,9 +1130,9 @@ same relative position within the new buffer."
   "Toggle whether to hide excluded messages.
 
 This command toggles whether to hide excluded messages for the current
-search. The default value for this is defined by `notmuch-search-exclude'."
+search. The default value for this is defined by `notmuch-search-hide-excluded'."
   (interactive)
-  (setq notmuch-search-exclude (not notmuch-search-exclude))
+  (setq notmuch-search-hide-excluded (not notmuch-search-hide-excluded))
   (notmuch-search-refresh-view))
 
 (defun notmuch-search-toggle-order ()
@@ -1163,7 +1164,7 @@ current search results AND the additional query string provided."
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
 		    notmuch-search-oldest-first
-		    notmuch-search-exclude)))
+		    notmuch-search-hide-excluded)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1175,7 +1176,7 @@ search results and that are also tagged with the given TAG."
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
 		  notmuch-search-oldest-first
-		  notmuch-search-exclude))
+		  notmuch-search-hide-excluded))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
@@ -1183,7 +1184,7 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
   (notmuch-search (concat "tag:" tag)
 		  (default-value 'notmuch-search-oldest-first)
-		  (default-value 'notmuch-search-exclude)))
+		  (default-value 'notmuch-search-hide-excluded)))
 
 ;;;###autoload
 (defun notmuch ()
-- 
2.37.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH 9/9] build: Fix declare-function calls for updated functions
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
                                           ` (6 preceding siblings ...)
  2022-08-07 14:57                         ` [PATCH 8/9] review: Rename variables to better express intention Mohsin Kaleem
@ 2022-08-07 14:57                         ` Mohsin Kaleem
  7 siblings, 0 replies; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 14:57 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Mohsin Kaleem

---
 emacs/notmuch-hello.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 39ba2537..6d4197dd 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -33,10 +33,11 @@
 (declare-function notmuch-poll "notmuch-lib" ())
 (declare-function notmuch-tree "notmuch-tree"
 		  (&optional query query-context target buffer-name
-			     open-target unthreaded parent-buffer oldest-first))
+			     open-target unthreaded parent-buffer
+			     oldest-first hide-excluded))
 (declare-function notmuch-unthreaded "notmuch-tree"
 		  (&optional query query-context target buffer-name
-			     open-target))
+			     open-target oldest-first hide-excluded))
 
 
 ;;; Options
-- 
2.37.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-07-30 14:02                     ` David Bremner
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
@ 2022-08-07 15:00                       ` Mohsin Kaleem
  2022-08-12 11:12                         ` David Bremner
  2023-04-16 13:18                       ` [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded mohkale
  2 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-07 15:00 UTC (permalink / raw)
  To: David Bremner, notmuch

David Bremner <david@tethera.net> writes:

Hi, thanks for all the advice :-). I'm still quite unfamiliar with
mailing-list based workflows so I keep developing like I'm on GitHub.

> I think the patch series needs a bit of cleanup still. The first two
> patches occur twice and then a later patch is reverted (so presumably
> those two can be dropped as well).
>
> You may also want to rebase against master before resending, since I
> have just a applied some changes to the emacs UI code that might collide
> with yours.

I'm not sure what you mean by the first two patches occur twice, could
you clarify so I can fix the issue? I've dropped the reverted patch and
rebased on top of master so you shouldn't have any issues applying the
patch series now.

> If possible, please use git send-email to send one-patch-per-message, it
> makes reviewing in notmuch-emacs much easier for me.

I just used git send-email to send the patch series (I assume it'll be
sent separately). I'd like to ask:
+ How do you manage git and email workflows like this for reference?
I haven't found any documentation about it when searching.
+ Is there a way to do this with notmuch involved (ideally through emacs
and Magit)?

-- 
Mohsin Kaleem

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 6/9] test: Add test cases for new exclude option
  2022-08-07 14:57                         ` [PATCH 6/9] test: Add test cases for new exclude option Mohsin Kaleem
@ 2022-08-08 18:56                           ` Tomi Ollila
  2022-08-08 19:20                             ` Mohsin Kaleem
  2022-08-12 10:49                           ` David Bremner
  1 sibling, 1 reply; 45+ messages in thread
From: Tomi Ollila @ 2022-08-08 18:56 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

On Sun, Aug 07 2022, Mohsin Kaleem wrote:

> ---
>  test/T461-emacs-search-exclude.sh             | 99 +++++++++++++++++++
>  .../notmuch-search-tag-inbox-with-excluded    | 25 +++++
>  .../notmuch-search-tag-inbox-without-excluded | 21 ++++
>  .../notmuch-tree-tag-inbox-with-excluded      | 53 ++++++++++
>  .../notmuch-tree-tag-inbox-without-excluded   | 49 +++++++++
>  5 files changed, 247 insertions(+)
>  create mode 100755 test/T461-emacs-search-exclude.sh
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
>
> diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exclude.sh
> new file mode 100755
> index 00000000..bf558847
> --- /dev/null
> +++ b/test/T461-emacs-search-exclude.sh
> @@ -0,0 +1,99 @@
> +#!/usr/bin/env bash
> +
> +test_description="exclude options persist between Emacs search and tree modes"
> +. $(dirname "$0")/test-lib.sh || exit 1
> +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
> +
> +EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
> +
> +test_require_emacs
> +add_email_corpus
> +notmuch config set search.exclude_tags deleted
> +notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
> +
> +# Basic test cases just asserting exclude option is working and consistent.
> +
> +test_begin_subtest "Search doesn't contain excluded mail by default"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +	    (test-output)
> +	    (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
> +
> +test_begin_subtest "Toggling exclude in search will show excluded mail"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +      (notmuch-search-toggle-exclude)

It looks like tab width was not 8 when these (notmuch-search-toggle-exclude)
were added, accidentally indented w/ leading space, not tab ;/

(ditto for all other (notmuch-search-toggle-exclude), rest of the content
removed.)

> +	    (notmuch-test-wait)

Otherwise, in this large set of changes, I could not see anything alarming,
but I did not test (I even don't know how, as I don't have excludes...)

Tomi

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 6/9] test: Add test cases for new exclude option
  2022-08-08 18:56                           ` Tomi Ollila
@ 2022-08-08 19:20                             ` Mohsin Kaleem
  0 siblings, 0 replies; 45+ messages in thread
From: Mohsin Kaleem @ 2022-08-08 19:20 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

> It looks like tab width was not 8 when these (notmuch-search-toggle-exclude)
> were added, accidentally indented w/ leading space, not tab ;/
>
> (ditto for all other (notmuch-search-toggle-exclude), rest of the content
> removed.)

Ah, good job spotting this. My tab width defaults to 2 in sh-script
files. I've fixed this now, but now sure what to do next. Should I
generate a new patch series and send them all again, generate a new
patch series and just send the modified patch, or is there some other
convention for next steps?

> Otherwise, in this large set of changes, I could not see anything alarming,
> but I did not test (I even don't know how, as I don't have excludes...)

An easy way to test would be to set some excluded tags :-).

    notmuch config set search.exclude_tags foo

Then:
1. Go to your inbox in Emacs.
2. Tag some mail with foo.
3. Run `M-x notmuch-refresh-this-buffer` and the mail you tagged should
   no longer be shown.
4. Hit the i key and it will be shown again.
5. Hit i again and it will be hidden.
6. Hit i again to re-show it and go ahead and remove the foo tag
7. Run `M-x notmuch-refresh-this-buffer` or hit i as much as you like,
   the mail should now always be shown since its no longer excluded.

-- 
Mohsin Kaleem

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude
  2022-08-07 14:57                         ` [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude Mohsin Kaleem
@ 2022-08-12 10:42                           ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2022-08-12 10:42 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch; +Cc: Mohsin Kaleem

Mohsin Kaleem <mohkale@kisara.moe> writes:

> ---
>  devel/emacs-keybindings.org | 2 +-
>  doc/notmuch-emacs.rst       | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)

apologies, but this patch will need to be rebased on top of master, as
I've just changed that section of the emacs manual. For now I'm just
skipping it.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello
  2022-08-07 14:57                         ` [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello Mohsin Kaleem
@ 2022-08-12 10:46                           ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2022-08-12 10:46 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch; +Cc: Mohsin Kaleem

Mohsin Kaleem <mohkale@kisara.moe> writes:

> ---
>  emacs/notmuch-hello.el | 35 ++++++++++++++++++++++-------------
>  1 file changed, 22 insertions(+), 13 deletions(-)

I would suggest describing this change as a change to
notmuch-saved-searches; that variable is used other places in notmuch as
well (mainly notmuch-jump.el)

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 5/9] feat: Add more interactive specs
  2022-08-07 14:57                         ` [PATCH 5/9] feat: Add more interactive specs Mohsin Kaleem
@ 2022-08-12 10:48                           ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2022-08-12 10:48 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch; +Cc: Mohsin Kaleem


This needs a better commit message. Both the subject (what is actually
happening) and the body (more detail about what, and some explanation
about why).

I'd suggest sticking to emacs: as a tag for the subject, but this is
less important than the other two issues I mentioned.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 6/9] test: Add test cases for new exclude option
  2022-08-07 14:57                         ` [PATCH 6/9] test: Add test cases for new exclude option Mohsin Kaleem
  2022-08-08 18:56                           ` Tomi Ollila
@ 2022-08-12 10:49                           ` David Bremner
  1 sibling, 0 replies; 45+ messages in thread
From: David Bremner @ 2022-08-12 10:49 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch; +Cc: Mohsin Kaleem

Mohsin Kaleem <mohkale@kisara.moe> writes:

This should mention emacs in the commit message. test/emacs: is the
usual convention.

> ---
>  test/T461-emacs-search-exclude.sh             | 99 +++++++++++++++++++
>  .../notmuch-search-tag-inbox-with-excluded    | 25 +++++
>  .../notmuch-search-tag-inbox-without-excluded | 21 ++++
>  .../notmuch-tree-tag-inbox-with-excluded      | 53 ++++++++++
>  .../notmuch-tree-tag-inbox-without-excluded   | 49 +++++++++
>  5 files changed, 247 insertions(+)
>  create mode 100755 test/T461-emacs-search-exclude.sh
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
>  create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
>
> diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exclude.sh
> new file mode 100755
> index 00000000..bf558847
> --- /dev/null
> +++ b/test/T461-emacs-search-exclude.sh
> @@ -0,0 +1,99 @@
> +#!/usr/bin/env bash
> +
> +test_description="exclude options persist between Emacs search and tree modes"
> +. $(dirname "$0")/test-lib.sh || exit 1
> +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
> +
> +EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
> +
> +test_require_emacs
> +add_email_corpus
> +notmuch config set search.exclude_tags deleted
> +notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
> +
> +# Basic test cases just asserting exclude option is working and consistent.
> +
> +test_begin_subtest "Search doesn't contain excluded mail by default"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +	    (test-output)
> +	    (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
> +
> +test_begin_subtest "Toggling exclude in search will show excluded mail"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +      (notmuch-search-toggle-exclude)
> +	    (notmuch-test-wait)
> +	    (test-output)
> +	    (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
> +
> +test_begin_subtest "Tree search doesn't contain excluded mail by default"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +	    (notmuch-tree-from-search-current-query)
> +	    (notmuch-test-wait)
> +	    (test-output)
> +	    (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
> +
> +test_begin_subtest "Toggling exclude in tree search will show excluded mail"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +	    (notmuch-tree-from-search-current-query)
> +	    (notmuch-test-wait)
> +      (notmuch-tree-toggle-exclude)
> +	    (notmuch-test-wait)
> +	    (test-output)
> +	    (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
> +
> +# Choice of showing excluded mail persists when switching between tree and search
> +# buffers.
> +
> +test_begin_subtest "Value of exclude from search persists into tree search"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +      (notmuch-search-toggle-exclude)
> +	    (notmuch-test-wait)
> +	    (notmuch-tree-from-search-current-query)
> +	    (notmuch-test-wait)
> +	    (test-output)
> +	    (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
> +
> +test_begin_subtest "Value of exclude from tree persists into search search"
> +test_emacs '(notmuch-hello)
> +	    (goto-char (point-min))
> +	    (re-search-forward "inbox")
> +	    (widget-button-press (1- (point)))
> +	    (notmuch-test-wait)
> +	    (notmuch-tree-from-search-current-query)
> +	    (notmuch-test-wait)
> +      (notmuch-tree-toggle-exclude)
> +	    (notmuch-test-wait)
> +	    (notmuch-search-from-tree-current-query)
> +	    (notmuch-test-wait)
> +	    (test-output)
> +	    (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
> +
> +# TODO: Add test cases for unthreaded conversions as well.
> +
> +test_done
> diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
> new file mode 100644
> index 00000000..ce1d7118
> --- /dev/null
> +++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
> @@ -0,0 +1,25 @@
> +  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
> +  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
> +  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
> +  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
> +  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
> +  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
> +  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
> +  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
> +  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
> +  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
> +  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
> +  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
> +  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
> +  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (deleted inbox unread)
> +  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
> +  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before statting (deleted inbox unread)
> +  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
> +  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
> +  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
> +  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
> +  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
> +  2009-11-18 [1/1]   Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
> +  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
> +  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
> +End of search results.
> diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
> new file mode 100644
> index 00000000..8a874320
> --- /dev/null
> +++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
> @@ -0,0 +1,21 @@
> +  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
> +  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
> +  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
> +  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
> +  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
> +  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
> +  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
> +  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
> +  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
> +  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
> +  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
> +  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
> +  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
> +  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
> +  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
> +  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
> +  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
> +  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
> +  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
> +  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
> +End of search results.
> diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
> new file mode 100644
> index 00000000..5c6b2d7a
> --- /dev/null
> +++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
> @@ -0,0 +1,53 @@
> +  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
> +  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
> +  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
> +  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
> +  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
> +  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
> +  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
> +  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
> +  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
> +  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
> +  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
> +  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
> +  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
> +  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
> +  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
> +  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
> +  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
> +  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
> +  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
> +  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
> +  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
> +  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
> +  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
> +  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (deleted inbox unread)
> +  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
> +  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (deleted inbox unread)
> +  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
> +  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
> +  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
> +  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
> +  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
> +  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
> +  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
> +  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
> +  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
> +  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
> +  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
> +  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
> +End of search results.
> diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
> new file mode 100644
> index 00000000..55806d18
> --- /dev/null
> +++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
> @@ -0,0 +1,49 @@
> +  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
> +  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
> +  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
> +  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
> +  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
> +  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
> +  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
> +  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
> +  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
> +  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
> +  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
> +  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
> +  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
> +  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
> +  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
> +  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
> +  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
> +  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
> +  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
> +  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
> +  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
> +  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
> +  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
> +  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
> +  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
> +  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
> +  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
> +  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
> +  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
> +  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
> +  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
> +  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
> +  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
> +  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
> +  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
> +  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
> +  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
> +End of search results.
> -- 
> 2.37.1\r

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 7/9] test: Fix Navigation of notmuch-hello to search results
  2022-08-07 14:57                         ` [PATCH 7/9] test: Fix Navigation of notmuch-hello to search results Mohsin Kaleem
@ 2022-08-12 10:51                           ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2022-08-12 10:51 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch; +Cc: Mohsin Kaleem

Mohsin Kaleem <mohkale@kisara.moe> writes:

> The default value of oldest-first is true so the oldest mail is shown
> first by default. This test case used the tree-from-search function
> which now persists this value of true (previously always defaulting to
> nil in its place) which produced a different tree output where the
> oldest-mail is sorted first despite previously being sorted last. Fixed
> by adding in this output as a separate file and comparing against it
> instead.

Please make sure the test suite passes after every commit. Probably that
means squashing this fix into the previous commit.

d

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH 8/9] review: Rename variables to better express intention
  2022-08-07 14:57                         ` [PATCH 8/9] review: Rename variables to better express intention Mohsin Kaleem
@ 2022-08-12 10:55                           ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2022-08-12 10:55 UTC (permalink / raw)
  To: Mohsin Kaleem

Mohsin Kaleem <mohkale@kisara.moe> writes:

> ---
>  emacs/notmuch-hello.el | 18 +++++++++---------
>  emacs/notmuch-jump.el  |  2 +-
>  emacs/notmuch-lib.el   |  4 ++--
>  emacs/notmuch-tree.el  | 24 ++++++++++++------------
>  emacs/notmuch.el       | 29 +++++++++++++++--------------
>  5 files changed, 39 insertions(+), 38 deletions(-)

Please apply these fixes to the previous commits in the series, rather
than sending an extra omnibus commit. magit is actually pretty good at
that (c F).

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-08-07 15:00                       ` [PATCH] emacs: add new option notmuch-search-exclude Mohsin Kaleem
@ 2022-08-12 11:12                         ` David Bremner
  2022-08-12 11:18                           ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: David Bremner @ 2022-08-12 11:12 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

>
> I'm not sure what you mean by the first two patches occur twice, could
> you clarify so I can fix the issue? I've dropped the reverted patch and
> rebased on top of master so you shouldn't have any issues applying the
> patch series now.
>

For reference, just look at the first and third attachements to your
message. These (somehow) describe the same commit / patch. In any case
it is fixed in the next iteration using git send-email.

>> If possible, please use git send-email to send one-patch-per-message, it
>> makes reviewing in notmuch-emacs much easier for me.
>
> I just used git send-email to send the patch series (I assume it'll be
> sent separately). I'd like to ask:
> + How do you manage git and email workflows like this for reference?
> I haven't found any documentation about it when searching.

Some general advice is at https://git-send-email.io/

> + Is there a way to do this with notmuch involved (ideally through emacs
> and Magit)?

I use git send-email from the command line to send patch series. To
review them, I read the resulting threads and reply to individual
patches / commits / messages.

To apply patch series, you may want to try mailscripts [1]. The
description makes it sound debian-centric, but I guess the elisp
functions like notmuch-extract-thread-patches are portable.

Finally I have some git aliases to apply individual patches:

[alias]
	nmam = "!f() { notmuch extract-patch $1 | git am -; }; f"

[alias]
	nmam8 = "!f() { notmuch extract-patch $1 | email-to-8bit |  git am -; }; f"

[alias]
	nmam3 = "!f() { notmuch extract-patch $1 | git am -3 -; }; f"


These versions rely on notmuch-extract-patch, from mailscripts [1], but
if you don't have that "notmuch show --format=raw" works almost as well.

[1]: https://github.com/spwhitton/mailscripts

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] emacs: add new option notmuch-search-exclude
  2022-08-12 11:12                         ` David Bremner
@ 2022-08-12 11:18                           ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2022-08-12 11:18 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

David Bremner <david@tethera.net> writes:

> To apply patch series, you may want to try mailscripts [1]. The
> description makes it sound debian-centric, but I guess the elisp
> functions like notmuch-extract-thread-patches are portable.

That function is one reason why it's nice to start a new thread with
each version of a patch series.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded
  2022-07-30 14:02                     ` David Bremner
  2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
  2022-08-07 15:00                       ` [PATCH] emacs: add new option notmuch-search-exclude Mohsin Kaleem
@ 2023-04-16 13:18                       ` mohkale
  2023-04-16 13:18                         ` [PATCH v2 1/3] " mohkale
                                           ` (3 more replies)
  2 siblings, 4 replies; 45+ messages in thread
From: mohkale @ 2023-04-16 13:18 UTC (permalink / raw)
  To: notmuch, David Bremner; +Cc: Mohsin Kaleem

From: Mohsin Kaleem <mohkale@kisara.moe>

Hi,

I've finally managed to come back to this patch series. Since last time
I've collapsed all the separate commits into 3 main ones. The first adds
the new option and then updates the commands and tests that should be
affected by it. The second allows you to configure message exclusion in
notmuch-saved-searches. The last adds several tests for the new
functionality.

Mohsin Kaleem (3):
  emacs: Add new option notmuch-search-hide-excluded
  emacs: Allow notmuch-saved-searches to hide excluded messages
  test/emacs: Add test cases for notmuch-search-hide-excluded

 devel/emacs-keybindings.org                   |   2 +-
 doc/notmuch-emacs.rst                         |   7 +
 emacs/notmuch-hello.el                        |  40 ++--
 emacs/notmuch-jump.el                         |  11 +-
 emacs/notmuch-lib.el                          |  10 +
 emacs/notmuch-tree.el                         |  60 ++++--
 emacs/notmuch.el                              |  52 +++--
 test/T310-emacs.sh                            |   2 +-
 test/T460-emacs-tree.sh                       |   2 +-
 test/T461-emacs-search-exclude.sh             | 185 ++++++++++++++++++
 .../notmuch-search-tag-inbox-with-excluded    |  25 +++
 .../notmuch-search-tag-inbox-without-excluded |  21 ++
 .../notmuch-tree-tag-inbox-with-excluded      |  53 +++++
 .../notmuch-tree-tag-inbox-without-excluded   |  49 +++++
 ...notmuch-unthreaded-tag-inbox-with-excluded |  53 +++++
 ...much-unthreaded-tag-inbox-without-excluded |  49 +++++
 .../notmuch-tree-tag-inbox-oldest-first       |  53 +++++
 17 files changed, 629 insertions(+), 45 deletions(-)
 create mode 100755 test/T461-emacs-search-exclude.sh
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded
 create mode 100644 test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first

-- 
2.40.0

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded
  2023-04-16 13:18                       ` [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded mohkale
@ 2023-04-16 13:18                         ` mohkale
  2023-05-03 19:59                           ` David Bremner
  2023-05-07 13:19                           ` David Bremner
  2023-04-16 13:18                         ` [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages mohkale
                                           ` (2 subsequent siblings)
  3 siblings, 2 replies; 45+ messages in thread
From: mohkale @ 2023-04-16 13:18 UTC (permalink / raw)
  To: notmuch, David Bremner; +Cc: Mohsin Kaleem

From: Mohsin Kaleem <mohkale@kisara.moe>

The new notmuch-search-hide-excluded option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local notmuch config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-hide-excluded and
notmuch-tree-toggle-exclude have also been added. They toggle the value
of notmuch-search-hide-excluded for the search in the current search or
tree buffer. It's bound to "i" in the respective keymaps for these
modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this
  + include notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

If there was a reasoning behind these not persisting the value of these
variables then we should revert it before merging and discuss whether
it's worth persisting notmuch-search-exclude.

[1]: id:87ilxlxsng.fsf@kisara.moe
---
 devel/emacs-keybindings.org                   |  2 +-
 doc/notmuch-emacs.rst                         |  7 +++
 emacs/notmuch-hello.el                        |  5 +-
 emacs/notmuch-jump.el                         | 11 ++--
 emacs/notmuch-lib.el                          | 10 ++++
 emacs/notmuch-tree.el                         | 60 +++++++++++++++----
 emacs/notmuch.el                              | 52 ++++++++++++----
 test/T310-emacs.sh                            |  2 +-
 test/T460-emacs-tree.sh                       |  2 +-
 .../notmuch-tree-tag-inbox-oldest-first       | 53 ++++++++++++++++
 10 files changed, 172 insertions(+), 32 deletions(-)
 create mode 100644 test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index ad7f72ef..218677c2 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -9,7 +9,7 @@
 | f            |                                        | notmuch-show-forward-message                          | notmuch-show-forward-message            |
 | g            |                                        |                                                       |                                         |
 | h            |                                        | notmuch-show-toggle-visibility-headers                |                                         |
-| i            |                                        |                                                       |                                         |
+| i            | notmuch-search-toggle-hide-excluded    |                                                       | notmuch-tree-toggle-hide-excluded       |
 | j            | notmuch-jump-search                    | notmuch-jump-search                                   | notmuch-jump-search                     |
 | k            | notmuch-tag-jump                       | notmuch-tag-jump                                      | notmuch-tag-jump                        |
 | l            | notmuch-search-filter                  | notmuch-show-filter-thread                            | notmuch-tree-filter                     |
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 7dff7d64..91af6d14 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -232,6 +232,10 @@ menu of results that the user can explore further by pressing
 
     Refresh the buffer
 
+.. el:define-key:: i
+
+    Toggle whether to show messages with excluded tags in search results.
+
 .. el:define-key:: ?
 
     Display full set of key bindings
@@ -559,6 +563,9 @@ tags.
 
    Filter the current search results based on an additional tag
 
+.. el:define-key:: i
+
+    Toggle whether to show messages with excluded tags in search results.
 
 .. el:define-key:: g
    =
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 4662e704..6aef322a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -33,10 +33,11 @@
 (declare-function notmuch-poll "notmuch-lib" ())
 (declare-function notmuch-tree "notmuch-tree"
 		  (&optional query query-context target buffer-name
-			     open-target unthreaded parent-buffer oldest-first))
+			     open-target unthreaded parent-buffer
+			     oldest-first hide-excluded))
 (declare-function notmuch-unthreaded "notmuch-tree"
 		  (&optional query query-context target buffer-name
-			     open-target))
+			     open-target oldest-first hide-excluded))
 
 
 ;;; Options
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..53496e5c 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		 (cl-case (plist-get saved-search :sort-order)
 		   (newest-first nil)
 		   (oldest-first t)
-		   (otherwise (default-value 'notmuch-search-oldest-first)))))
+		   (otherwise (default-value 'notmuch-search-oldest-first))))
+		(exclude (default-value 'notmuch-search-hide-excluded)))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
-			  (lambda () (notmuch-tree query)))
+			  (lambda () (notmuch-tree query nil nil nil nil nil nil
+					      oldest-first exclude)))
 			 ((eq (plist-get saved-search :search-type) 'unthreaded)
-			  (lambda () (notmuch-unthreaded query)))
+			  (lambda () (notmuch-unthreaded query nil nil nil nil
+						    oldest-first exclude)))
 			 (t
-			  (lambda () (notmuch-search query oldest-first)))))
+			  (lambda () (notmuch-search query oldest-first exclude)))))
 		  action-map)))))
     (setq action-map (nreverse action-map))
     (if action-map
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 84ba8c5e..d0205d0e 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,6 +105,16 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
+(defcustom notmuch-search-hide-excluded t
+  "Hide mail tagged with a excluded tag.
+
+Excluded tags are defined in the users configuration file under
+the search section. When this variable is true, any mail with
+such a tag will not be shown in the search output."
+  :type 'boolean
+  :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-hide-excluded)
+
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index b58fa6a6..ae864195 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -372,6 +372,7 @@ then NAME behaves like CMD."
     (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
+    (define-key map "i" 'notmuch-tree-toggle-hide-excluded)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
     (define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
     (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -588,7 +589,9 @@ NOT change the database."
   "Call notmuch search with the current query."
   (interactive)
   (notmuch-tree-close-message-window)
-  (notmuch-search (notmuch-tree-get-query)))
+  (notmuch-search (notmuch-tree-get-query)
+		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -801,7 +804,8 @@ nil otherwise."
 			 target
 			 nil
 			 unthreaded
-			 notmuch-search-oldest-first)))
+			 notmuch-search-oldest-first
+			 notmuch-search-hide-excluded)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1130,7 +1134,8 @@ object, and with the tree results buffer as the current buffer.")
 					 results-buf)))))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
-					open-target unthreaded oldest-first)
+					open-target unthreaded oldest-first
+					exclude)
   "Insert the tree view of the search in the current buffer.
 
 This is is a helper function for notmuch-tree. The arguments are
@@ -1139,6 +1144,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
+  (setq notmuch-search-hide-excluded exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1158,14 +1164,15 @@ the same as for the function notmuch-tree."
 			      (and query-context
 				   (concat " and (" query-context ")"))))
 	 (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
-	 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+	 (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+	 (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
     (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
       (setq search-args basic-query))
     (notmuch-tag-clear-cache)
     (let ((proc (notmuch-start-notmuch
 		 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
 		 "show" "--body=false" "--format=sexp" "--format-version=5"
-		 sort-arg message-arg search-args))
+		 sort-arg message-arg exclude-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
 	  ;; should be called no matter how the process dies.
@@ -1192,8 +1199,18 @@ default sort order is defined by `notmuch-search-oldest-first'."
   (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-tree-refresh-view))
 
+(defun notmuch-tree-toggle-hide-excluded ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-hide-excluded'."
+  (interactive)
+  (setq notmuch-search-hide-excluded (not notmuch-search-hide-excluded))
+  (notmuch-tree-refresh-view))
+
 (defun notmuch-tree (&optional query query-context target buffer-name
-			       open-target unthreaded parent-buffer oldest-first)
+			       open-target unthreaded parent-buffer
+			       oldest-first hide-excluded)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1208,7 +1225,15 @@ The arguments are:
       it is nil \"*notmuch-tree\" followed by QUERY is used.
   OPEN-TARGET: If TRUE open the target message in the message pane.
   UNTHREADED: If TRUE only show matching messages in an unthreaded view."
-  (interactive)
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-hide-excluded)))
   (unless query
     (setq query (notmuch-read-query (concat "Notmuch "
 					    (if unthreaded "unthreaded " "tree ")
@@ -1222,17 +1247,27 @@ The arguments are:
     (pop-to-buffer-same-window buffer))
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
-  (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+  (notmuch-tree-worker query query-context target open-target
+		       unthreaded oldest-first hide-excluded)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target)
+				     open-target oldest-first hide-excluded)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
-  (interactive)
-  (notmuch-tree query query-context target buffer-name open-target t))
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-hide-excluded)))
+  (notmuch-tree query query-context target buffer-name open-target
+		t nil oldest-first hide-excluded))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1266,7 +1301,8 @@ search results and that are also tagged with the given TAG."
 		  nil
 		  notmuch-tree-unthreaded
 		  nil
-		  notmuch-search-oldest-first)))
+		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded)))
 
 (defun notmuch-tree-edit-search (query)
   "Edit the current search"
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6eef4af1..2a73ffa5 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -187,6 +187,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "i" 'notmuch-search-toggle-hide-excluded)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -550,12 +551,18 @@ Return non-nil on success."
 (defun notmuch-tree-from-search-current-query ()
   "Tree view of current query."
   (interactive)
-  (notmuch-tree notmuch-search-query-string))
+  (notmuch-tree notmuch-search-query-string
+		nil nil nil nil nil nil
+		notmuch-search-oldest-first
+		notmuch-search-hide-excluded))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
   (interactive)
-  (notmuch-unthreaded notmuch-search-query-string))
+  (notmuch-unthreaded notmuch-search-query-string
+		      nil nil nil nil
+		      notmuch-search-oldest-first
+		      notmuch-search-hide-excluded))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -564,7 +571,9 @@ Return non-nil on success."
 		notmuch-search-query-string
 		nil
 		(notmuch-prettify-subject (notmuch-search-find-subject))
-		t nil (current-buffer)))
+		t nil (current-buffer)
+		notmuch-search-oldest-first
+		notmuch-search-hide-excluded))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -1035,14 +1044,16 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line
-				 no-display)
+(defun notmuch-search (&optional query oldest-first hide-excluded target-thread
+				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
+  HIDE-EXCLUDED: A boolean controlling whether to omit threads with excluded
+                 tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1057,9 +1068,10 @@ the configured default sort order."
    (list
     ;; Prompt for a query
     nil
-    ;; Use the default search order (if we're doing a search from a
-    ;; search buffer, ignore any buffer-local overrides)
-    (default-value 'notmuch-search-oldest-first)))
+    ;; Use the default search order and exclude value (if we're doing a
+    ;; search from a search buffer, ignore any buffer-local overrides)
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-hide-excluded)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1073,6 +1085,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
+    (setq notmuch-search-hide-excluded hide-excluded)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1086,6 +1099,9 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
+		     (if hide-excluded
+			 "--exclude=true"
+		       "--exclude=false")
 		     query)))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
@@ -1106,11 +1122,21 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
   (goto-char (point-min)))
 
+(defun notmuch-search-toggle-hide-excluded ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-hide-excluded'."
+  (interactive)
+  (setq notmuch-search-hide-excluded (not notmuch-search-hide-excluded))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -1139,7 +1165,8 @@ current search results AND the additional query string provided."
     (notmuch-search (if (string= grouped-original-query "*")
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
-		    notmuch-search-oldest-first)))
+		    notmuch-search-oldest-first
+		    notmuch-search-hide-excluded)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1150,13 +1177,16 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Filter by tag: "
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
-		  notmuch-search-oldest-first))
+		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
   (interactive
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
-  (notmuch-search (concat "tag:" tag)))
+  (notmuch-search (concat "tag:" tag)
+		  (default-value 'notmuch-search-oldest-first)
+		  (default-value 'notmuch-search-hide-excluded)))
 
 (defun notmuch-search-edit-search (query)
   "Edit the current search"
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 9d0df187..b89a100e 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -1030,7 +1030,7 @@ End of search results.
 YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
 === ERROR ===
 YYY/notmuch_fail exited with status 1
-command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
+command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox
 exit status: 1"
 
 test_begin_subtest "Search handles subprocess warnings"
diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 8e071443..6ef5c54a 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -100,7 +100,7 @@ test_emacs '(notmuch-hello)
 	    (notmuch-test-wait)
 	    (test-output)
 	    (delete-other-windows)'
-test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-oldest-first OUTPUT
 
 test_begin_subtest "Tree view of a single thread (from search)"
 test_emacs '(notmuch-hello)
diff --git a/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
new file mode 100644
index 00000000..588fc583
--- /dev/null
+++ b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
-- 
2.40.0
\r

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages
  2023-04-16 13:18                       ` [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded mohkale
  2023-04-16 13:18                         ` [PATCH v2 1/3] " mohkale
@ 2023-04-16 13:18                         ` mohkale
  2023-05-07 13:39                           ` David Bremner
  2023-05-07 20:13                           ` David Bremner
  2023-04-16 13:18                         ` [PATCH v2 3/3] test/emacs: Add test cases for notmuch-search-hide-excluded mohkale
  2024-03-10 18:57                         ` [PATCH v3] emacs: Add new option notmuch-search-hide-excluded mohkale
  3 siblings, 2 replies; 45+ messages in thread
From: mohkale @ 2023-04-16 13:18 UTC (permalink / raw)
  To: notmuch, David Bremner; +Cc: Mohsin Kaleem

From: Mohsin Kaleem <mohkale@kisara.moe>

---
 emacs/notmuch-hello.el | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 6aef322a..6d4197dd 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -144,6 +144,10 @@ a plist. Supported properties are
   :sort-order      Specify the sort order to be used for the search.
                    Possible values are `oldest-first', `newest-first'
                    or nil. Nil means use the default sort order.
+  :excluded        Whether to show mail with excluded tags in the
+                   search. Possible values are `hide', `show',
+                   or nil. Nil means use the default value of
+                   `notmuch-search-hide-excluded'.
   :search-type     Specify whether to run the search in search-mode,
                    tree mode or unthreaded mode. Set to `tree' to
                    specify tree mode, 'unthreaded to specify
@@ -485,19 +489,19 @@ diagonal."
 	     append (notmuch-hello-reflect-generate-row ncols nrows row list))))
 
 (defun notmuch-hello-widget-search (widget &rest _ignore)
-  (cl-case (widget-get widget :notmuch-search-type)
-   (tree
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
-      (notmuch-tree (widget-get widget :notmuch-search-terms)
-		    nil nil n nil nil nil
-		    (widget-get widget :notmuch-search-oldest-first))))
-   (unthreaded
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget)
-						"unthreaded" t)))
-      (notmuch-unthreaded (widget-get widget :notmuch-search-terms) nil nil n)))
-   (t
-    (notmuch-search (widget-get widget :notmuch-search-terms)
-		    (widget-get widget :notmuch-search-oldest-first)))))
+  (let ((search-terms (widget-get widget :notmuch-search-terms))
+	(oldest-first (widget-get widget :notmuch-search-oldest-first))
+	(exclude (widget-get widget :notmuch-search-hide-excluded)))
+    (cl-case (widget-get widget :notmuch-search-type)
+      (tree
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
+	 (notmuch-tree search-terms nil nil n nil nil nil oldest-first exclude)))
+      (unthreaded
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget)
+						   "unthreaded" t)))
+	 (notmuch-unthreaded search-terms nil nil n nil oldest-first exclude)))
+      (t
+       (notmuch-search search-terms oldest-first exclude)))))
 
 (defun notmuch-saved-search-count (search)
   (car (notmuch--process-lines notmuch-command "count" search)))
@@ -644,6 +648,10 @@ with `notmuch-hello-query-counts'."
 				     (newest-first nil)
 				     (oldest-first t)
 				     (otherwise notmuch-search-oldest-first)))
+		     (exclude (cl-case (plist-get elem :excluded)
+				(hide t)
+				(show nil)
+				(otherwise notmuch-search-hide-excluded)))
 		     (search-type (plist-get elem :search-type))
 		     (msg-count (plist-get elem :count)))
 		(widget-insert (format "%8s "
@@ -653,6 +661,7 @@ with `notmuch-hello-query-counts'."
 			       :notmuch-search-terms query
 			       :notmuch-search-oldest-first oldest-first
 			       :notmuch-search-type search-type
+			       :notmuch-search-hide-excluded exclude
 			       name)
 		(setq column-indent
 		      (1+ (max 0 (- column-width (length name)))))))
-- 
2.40.0

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v2 3/3] test/emacs: Add test cases for notmuch-search-hide-excluded
  2023-04-16 13:18                       ` [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded mohkale
  2023-04-16 13:18                         ` [PATCH v2 1/3] " mohkale
  2023-04-16 13:18                         ` [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages mohkale
@ 2023-04-16 13:18                         ` mohkale
  2023-05-07 20:19                           ` David Bremner
  2024-03-10 18:57                         ` [PATCH v3] emacs: Add new option notmuch-search-hide-excluded mohkale
  3 siblings, 1 reply; 45+ messages in thread
From: mohkale @ 2023-04-16 13:18 UTC (permalink / raw)
  To: notmuch, David Bremner; +Cc: Mohsin Kaleem

From: Mohsin Kaleem <mohkale@kisara.moe>

---
 test/T461-emacs-search-exclude.sh             | 185 ++++++++++++++++++
 .../notmuch-search-tag-inbox-with-excluded    |  25 +++
 .../notmuch-search-tag-inbox-without-excluded |  21 ++
 .../notmuch-tree-tag-inbox-with-excluded      |  53 +++++
 .../notmuch-tree-tag-inbox-without-excluded   |  49 +++++
 ...notmuch-unthreaded-tag-inbox-with-excluded |  53 +++++
 ...much-unthreaded-tag-inbox-without-excluded |  49 +++++
 7 files changed, 435 insertions(+)
 create mode 100755 test/T461-emacs-search-exclude.sh
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded

diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exclude.sh
new file mode 100755
index 00000000..70882a7b
--- /dev/null
+++ b/test/T461-emacs-search-exclude.sh
@@ -0,0 +1,185 @@
+#!/usr/bin/env bash
+
+test_description="exclude options persist between Emacs search and tree modes"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
+
+test_require_emacs
+add_email_corpus
+notmuch config set search.exclude_tags deleted
+notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
+
+# Basic test cases just asserting exclude option is working and consistent.
+
+test_begin_subtest "Search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Tree search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in tree search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Unthreaded search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in unthreaded will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
+
+# Cycling from search to tree to unthreaded and vice versa will persist the current
+# value of notmuch-search-hide-excluded.
+
+test_begin_subtest "Value of hide-excluded from search persists into tree search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from search persists into unthreaded"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from tree persists into search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-search-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from tree persists into unthreaded"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from unthreaded persists into tree"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+      (notmuch-tree-from-unthreaded-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from unthreaded persists into search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+      (notmuch-search-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_done
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
new file mode 100644
index 00000000..ce1d7118
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
@@ -0,0 +1,25 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before statting (deleted inbox unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18 [1/1]   Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
new file mode 100644
index 00000000..8a874320
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
@@ -0,0 +1,21 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
new file mode 100644
index 00000000..5c6b2d7a
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (deleted inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
new file mode 100644
index 00000000..55806d18
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
@@ -0,0 +1,49 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
new file mode 100644
index 00000000..d55818e8
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Alex Botero-Lowry    [notmuch] preliminary FreeBSD support                  (attachment inbox unread)
+  2009-11-17  Carl Worth           [notmuch] preliminary FreeBSD support                  (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file        (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Israel Herraiz       [notmuch] New to the list                              (inbox unread)
+  2009-11-17  Adrian Perez de Cast [notmuch] Introducing myself                           (inbox signed unread)
+  2009-11-17  Aron Griffis         [notmuch] archive                                      (inbox unread)
+  2009-11-17  Ingmar Vanhassel     [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry    [notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (deleted inbox unread)
+  2009-11-18  Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18  Keith Packard        [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] archive                                      (inbox unread)
+  2009-11-18  Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before	statting (deleted inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano    [notmuch] Link to mailing list archives ?              (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] request for pull                             (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] archive                                      (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] What a great idea!                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16  Olivier Berger       Essai accentué                                         (inbox unread)
+  2010-12-29  François Boulogne    [aur-general] Guidelines: cp, mkdir vs install         (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded
new file mode 100644
index 00000000..80c67d07
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded
@@ -0,0 +1,49 @@
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Alex Botero-Lowry    [notmuch] preliminary FreeBSD support                  (attachment inbox unread)
+  2009-11-17  Carl Worth           [notmuch] preliminary FreeBSD support                  (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file        (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Israel Herraiz       [notmuch] New to the list                              (inbox unread)
+  2009-11-17  Adrian Perez de Cast [notmuch] Introducing myself                           (inbox signed unread)
+  2009-11-17  Aron Griffis         [notmuch] archive                                      (inbox unread)
+  2009-11-17  Ingmar Vanhassel     [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry    [notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Keith Packard        [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] archive                                      (inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano    [notmuch] Link to mailing list archives ?              (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] request for pull                             (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] archive                                      (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] What a great idea!                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2010-12-16  Olivier Berger       Essai accentué                                         (inbox unread)
+  2010-12-29  François Boulogne    [aur-general] Guidelines: cp, mkdir vs install         (inbox unread)
+End of search results.
-- 
2.40.0
\r

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded
  2023-04-16 13:18                         ` [PATCH v2 1/3] " mohkale
@ 2023-05-03 19:59                           ` David Bremner
  2023-05-05 11:43                             ` Mohsin Kaleem
  2023-05-07 13:19                           ` David Bremner
  1 sibling, 1 reply; 45+ messages in thread
From: David Bremner @ 2023-05-03 19:59 UTC (permalink / raw)
  To: mohkale, notmuch; +Cc: Mohsin Kaleem

> diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
> index 9d0df187..b89a100e 100755
> --- a/test/T310-emacs.sh
> +++ b/test/T310-emacs.sh
> @@ -1030,7 +1030,7 @@ End of search results.
>  YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
>  === ERROR ===
>  YYY/notmuch_fail exited with status 1
> -command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
> +command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox
>  exit status: 1"
>  

I don't understand why --exclude is defaulting to 'false' here. Isn't
this a change in behaviour?

d

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded
  2023-05-03 19:59                           ` David Bremner
@ 2023-05-05 11:43                             ` Mohsin Kaleem
  2023-05-07 12:27                               ` David Bremner
  0 siblings, 1 reply; 45+ messages in thread
From: Mohsin Kaleem @ 2023-05-05 11:43 UTC (permalink / raw)
  To: David Bremner, notmuch

David Bremner <david@tethera.net> writes:

>> diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
>> index 9d0df187..b89a100e 100755
>> --- a/test/T310-emacs.sh
>> +++ b/test/T310-emacs.sh
>> @@ -1030,7 +1030,7 @@ End of search results.
>>  YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
>>  === ERROR ===
>>  YYY/notmuch_fail exited with status 1
>> -command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
>> +command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox
>>  exit status: 1"
>>  
>
> I don't understand why --exclude is defaulting to 'false' here. Isn't
> this a change in behaviour?

You're correct.

This is because the new options notmuch-search-hide-excluded and it
defaults to t, but when we call (notmuch-search) the value used is nil
because we didn't supply one for the search call. If you call
notmuch-search interactively then this isn't an issue, the interactive
spec will substitute the value of the hide-excluded option. This is why
all the tests that use the hello buffer to select the inbox and open a
search in it correctly use the notmuch-search-hide-excluded option. This
test does not do this.

We could workaround this by changing the semantics of the variable. Make
it notmuch-search-show-excluded and default to nil so nothing has to be
changed in existing functions that call notmuch-search. Or we could
switch to using cl-defun and have the default value substituted in the
parameter list. I've never used cl-defun with interactive functions but
long term I think that's the saner solution.

-- 
Mohsin Kaleem

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded
  2023-05-05 11:43                             ` Mohsin Kaleem
@ 2023-05-07 12:27                               ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2023-05-07 12:27 UTC (permalink / raw)
  To: Mohsin Kaleem, notmuch

Mohsin Kaleem <mohkale@kisara.moe> writes:

> We could workaround this by changing the semantics of the variable. Make
> it notmuch-search-show-excluded and default to nil so nothing has to be
> changed in existing functions that call notmuch-search. Or we could
> switch to using cl-defun and have the default value substituted in the
> parameter list. I've never used cl-defun with interactive functions but
> long term I think that's the saner solution.

Thanks for the explanation. I think we can live with it as is for now,
and look into the cl-defun "upgrade" later.

I suspect it will be a bit confusing if we invert the sense of the
variable relative to the CLI argument.

d

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded
  2023-04-16 13:18                         ` [PATCH v2 1/3] " mohkale
  2023-05-03 19:59                           ` David Bremner
@ 2023-05-07 13:19                           ` David Bremner
  1 sibling, 0 replies; 45+ messages in thread
From: David Bremner @ 2023-05-07 13:19 UTC (permalink / raw)
  To: mohkale, notmuch; +Cc: Mohsin Kaleem

mohkale@kisara.moe writes:

> Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
> which didn't pass through the buffer local value of
> notmuch-search-oldest-first (and now notmuch-search-exclude).
> Examples of where I've done this
>   + include notmuch-jump-search

if respinning, move 'include' to previous line

>
> If there was a reasoning behind these not persisting the value of these
> variables then we should revert it before merging and discuss whether
> it's worth persisting notmuch-search-exclude.
>

I think the fixes are fine, and make sense to include since you are
touching that code anyway. This sentence probably doesn't belong in the
commit message, so if respinning the series, I would drop it.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages
  2023-04-16 13:18                         ` [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages mohkale
@ 2023-05-07 13:39                           ` David Bremner
  2024-03-10 18:48                             ` Mohsin Kaleem
  2023-05-07 20:13                           ` David Bremner
  1 sibling, 1 reply; 45+ messages in thread
From: David Bremner @ 2023-05-07 13:39 UTC (permalink / raw)
  To: mohkale, notmuch; +Cc: Mohsin Kaleem

mohkale@kisara.moe writes:

> +  :excluded        Whether to show mail with excluded tags in the
> +                   search. Possible values are `hide', `show',
> +                   or nil. Nil means use the default value of
> +                   `notmuch-search-hide-excluded'.

So if I understand correctly, toggling excludes will not affect saved
searches with a :excluded key. Is this what we want?

I guess the alternative is to AND notmuch-search-hide-excluded with the
value derived from the saved-search?

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages
  2023-04-16 13:18                         ` [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages mohkale
  2023-05-07 13:39                           ` David Bremner
@ 2023-05-07 20:13                           ` David Bremner
  1 sibling, 0 replies; 45+ messages in thread
From: David Bremner @ 2023-05-07 20:13 UTC (permalink / raw)
  To: mohkale, notmuch; +Cc: Mohsin Kaleem

mohkale@kisara.moe writes:

> From: Mohsin Kaleem <mohkale@kisara.moe>
>

Apologies for the many messages. I think this commit message falls a bit
short of our usual standards (as well as a one line subject, we like to
have some kind of "why"). If you figure out the right answer to toggling
saved searches with :excluded properties, it might be worth explaining
your reasoning in the commit message. 

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 3/3] test/emacs: Add test cases for notmuch-search-hide-excluded
  2023-04-16 13:18                         ` [PATCH v2 3/3] test/emacs: Add test cases for notmuch-search-hide-excluded mohkale
@ 2023-05-07 20:19                           ` David Bremner
  0 siblings, 0 replies; 45+ messages in thread
From: David Bremner @ 2023-05-07 20:19 UTC (permalink / raw)
  To: mohkale, notmuch

mohkale@kisara.moe writes:

> From: Mohsin Kaleem <mohkale@kisara.moe>
>

thanks for writing such an extensive set of tests for the new
feature. All I'd ask is a bit more detail in the commit message.

d

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages
  2023-05-07 13:39                           ` David Bremner
@ 2024-03-10 18:48                             ` Mohsin Kaleem
  0 siblings, 0 replies; 45+ messages in thread
From: Mohsin Kaleem @ 2024-03-10 18:48 UTC (permalink / raw)
  To: David Bremner, notmuch

David Bremner <david@tethera.net> writes:

Hi, sorry, took me so long to get back to this XD. I've opted to squash
the 3 separate commits in this patch series into one commit so that
should address the commit message questions.

> mohkale@kisara.moe writes:
>
>> +  :excluded        Whether to show mail with excluded tags in the
>> +                   search. Possible values are `hide', `show',
>> +                   or nil. Nil means use the default value of
>> +                   `notmuch-search-hide-excluded'.
>
> So if I understand correctly, toggling excludes will not affect saved
> searches with a :excluded key. Is this what we want?
>
> I guess the alternative is to AND notmuch-search-hide-excluded with the
> value derived from the saved-search?

I think this is the last pending question. This shouldn't be the case.
When you open a search from notmuch saved searches it'll contain
whatever value you specify in :excluded but you can interactively change
that with the new toggle-exclude commands and the workflow should be as
you expect. I did notice while testing this that notmuch-jump currently
doesn't respect the exclude option you add to saved searches but I've
addressed that in this next patch version.


-- 
Mohsin Kaleem

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v3] emacs: Add new option notmuch-search-hide-excluded
  2023-04-16 13:18                       ` [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded mohkale
                                           ` (2 preceding siblings ...)
  2023-04-16 13:18                         ` [PATCH v2 3/3] test/emacs: Add test cases for notmuch-search-hide-excluded mohkale
@ 2024-03-10 18:57                         ` mohkale
  3 siblings, 0 replies; 45+ messages in thread
From: mohkale @ 2024-03-10 18:57 UTC (permalink / raw)
  To: notmuch, David Bremner; +Cc: Mohsin Kaleem

From: Mohsin Kaleem <mohkale@kisara.moe>

The new notmuch-search-hide-excluded option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local notmuch config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-hide-excluded and
notmuch-tree-toggle-exclude have also been added. They toggle the value
of notmuch-search-hide-excluded for the search in the current search or
tree buffer. It's bound to "i" in the respective keymaps for these
modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this include:
  + notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

A new test file for Emacs has been added which covers the usage of the
new `notmuch-search-hide-excluded' option and interactively hiding or
showing mail with excluded tags. These test cover the basic usage of
the `notmuch-search-toggle-hide-excluded' command in notmuch-search,
notmuch-tree and notmuch-unthreaded searches. These tests also cover
the persistence of the current value of the hide-excluded mail option
as a user switches from between these different search commands.

[1]: id:87ilxlxsng.fsf@kisara.moe
---
 devel/emacs-keybindings.org                   |   2 +-
 doc/notmuch-emacs.rst                         |   7 +
 emacs/notmuch-hello.el                        |  40 ++--
 emacs/notmuch-jump.el                         |  14 +-
 emacs/notmuch-lib.el                          |  10 +
 emacs/notmuch-tree.el                         |  60 ++++--
 emacs/notmuch.el                              |  52 +++--
 test/T310-emacs.sh                            |   2 +-
 test/T460-emacs-tree.sh                       |   2 +-
 test/T461-emacs-search-exclude.sh             | 185 ++++++++++++++++++
 .../notmuch-search-tag-inbox-with-excluded    |  25 +++
 .../notmuch-search-tag-inbox-without-excluded |  21 ++
 .../notmuch-tree-tag-inbox-with-excluded      |  53 +++++
 .../notmuch-tree-tag-inbox-without-excluded   |  49 +++++
 ...notmuch-unthreaded-tag-inbox-with-excluded |  53 +++++
 ...much-unthreaded-tag-inbox-without-excluded |  49 +++++
 .../notmuch-tree-tag-inbox-oldest-first       |  53 +++++
 17 files changed, 632 insertions(+), 45 deletions(-)
 create mode 100755 test/T461-emacs-search-exclude.sh
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
 create mode 100644 test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded
 create mode 100644 test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index ad7f72ef..218677c2 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -9,7 +9,7 @@
 | f            |                                        | notmuch-show-forward-message                          | notmuch-show-forward-message            |
 | g            |                                        |                                                       |                                         |
 | h            |                                        | notmuch-show-toggle-visibility-headers                |                                         |
-| i            |                                        |                                                       |                                         |
+| i            | notmuch-search-toggle-hide-excluded    |                                                       | notmuch-tree-toggle-hide-excluded       |
 | j            | notmuch-jump-search                    | notmuch-jump-search                                   | notmuch-jump-search                     |
 | k            | notmuch-tag-jump                       | notmuch-tag-jump                                      | notmuch-tag-jump                        |
 | l            | notmuch-search-filter                  | notmuch-show-filter-thread                            | notmuch-tree-filter                     |
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 7dff7d64..91af6d14 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -232,6 +232,10 @@ menu of results that the user can explore further by pressing
 
     Refresh the buffer
 
+.. el:define-key:: i
+
+    Toggle whether to show messages with excluded tags in search results.
+
 .. el:define-key:: ?
 
     Display full set of key bindings
@@ -559,6 +563,9 @@ tags.
 
    Filter the current search results based on an additional tag
 
+.. el:define-key:: i
+
+    Toggle whether to show messages with excluded tags in search results.
 
 .. el:define-key:: g
    =
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 47ece536..b6d1e2ae 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -33,10 +33,11 @@
 (declare-function notmuch-poll "notmuch-lib" ())
 (declare-function notmuch-tree "notmuch-tree"
 		  (&optional query query-context target buffer-name
-			     open-target unthreaded parent-buffer oldest-first))
+			     open-target unthreaded parent-buffer
+			     oldest-first hide-excluded))
 (declare-function notmuch-unthreaded "notmuch-tree"
 		  (&optional query query-context target buffer-name
-			     open-target))
+			     open-target oldest-first hide-excluded))
 
 
 ;;; Options
@@ -143,6 +144,10 @@ a plist. Supported properties are
   :sort-order      Specify the sort order to be used for the search.
                    Possible values are `oldest-first', `newest-first'
                    or nil. Nil means use the default sort order.
+  :excluded        Whether to show mail with excluded tags in the
+                   search. Possible values are `hide', `show',
+                   or nil. Nil means use the default value of
+                   `notmuch-search-hide-excluded'.
   :search-type     Specify whether to run the search in search-mode,
                    tree mode or unthreaded mode. Set to `tree' to
                    specify tree mode, \\='unthreaded to specify
@@ -484,19 +489,19 @@ diagonal."
 	     append (notmuch-hello-reflect-generate-row ncols nrows row list))))
 
 (defun notmuch-hello-widget-search (widget &rest _ignore)
-  (cl-case (widget-get widget :notmuch-search-type)
-   (tree
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
-      (notmuch-tree (widget-get widget :notmuch-search-terms)
-		    nil nil n nil nil nil
-		    (widget-get widget :notmuch-search-oldest-first))))
-   (unthreaded
-    (let ((n (notmuch-search-format-buffer-name (widget-value widget)
-						"unthreaded" t)))
-      (notmuch-unthreaded (widget-get widget :notmuch-search-terms) nil nil n)))
-   (t
-    (notmuch-search (widget-get widget :notmuch-search-terms)
-		    (widget-get widget :notmuch-search-oldest-first)))))
+  (let ((search-terms (widget-get widget :notmuch-search-terms))
+	(oldest-first (widget-get widget :notmuch-search-oldest-first))
+	(exclude (widget-get widget :notmuch-search-hide-excluded)))
+    (cl-case (widget-get widget :notmuch-search-type)
+      (tree
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t)))
+	 (notmuch-tree search-terms nil nil n nil nil nil oldest-first exclude)))
+      (unthreaded
+       (let ((n (notmuch-search-format-buffer-name (widget-value widget)
+						   "unthreaded" t)))
+	 (notmuch-unthreaded search-terms nil nil n nil oldest-first exclude)))
+      (t
+       (notmuch-search search-terms oldest-first exclude)))))
 
 (defun notmuch-saved-search-count (search)
   (car (notmuch--process-lines notmuch-command "count" search)))
@@ -643,6 +648,10 @@ with `notmuch-hello-query-counts'."
 				     (newest-first nil)
 				     (oldest-first t)
 				     (otherwise notmuch-search-oldest-first)))
+		     (exclude (cl-case (plist-get elem :excluded)
+				(hide t)
+				(show nil)
+				(otherwise notmuch-search-hide-excluded)))
 		     (search-type (plist-get elem :search-type))
 		     (msg-count (plist-get elem :count)))
 		(widget-insert (format "%8s "
@@ -652,6 +661,7 @@ with `notmuch-hello-query-counts'."
 			       :notmuch-search-terms query
 			       :notmuch-search-oldest-first oldest-first
 			       :notmuch-search-type search-type
+			       :notmuch-search-hide-excluded exclude
 			       name)
 		(setq column-indent
 		      (1+ (max 0 (- column-width (length name)))))))
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..3161ed95 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,21 @@ fast way to jump to a saved search from anywhere in Notmuch."
 		 (cl-case (plist-get saved-search :sort-order)
 		   (newest-first nil)
 		   (oldest-first t)
-		   (otherwise (default-value 'notmuch-search-oldest-first)))))
+		   (otherwise (default-value 'notmuch-search-oldest-first))))
+		(exclude (cl-case (plist-get saved-search :excluded)
+			   (hide t)
+			   (show nil)
+			   (otherwise notmuch-search-hide-excluded))))
 	    (push (list key name
 			(cond
 			 ((eq (plist-get saved-search :search-type) 'tree)
-			  (lambda () (notmuch-tree query)))
+			  (lambda () (notmuch-tree query nil nil nil nil nil nil
+					      oldest-first exclude)))
 			 ((eq (plist-get saved-search :search-type) 'unthreaded)
-			  (lambda () (notmuch-unthreaded query)))
+			  (lambda () (notmuch-unthreaded query nil nil nil nil
+						    oldest-first exclude)))
 			 (t
-			  (lambda () (notmuch-search query oldest-first)))))
+			  (lambda () (notmuch-search query oldest-first exclude)))))
 		  action-map)))))
     (setq action-map (nreverse action-map))
     (if action-map
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 14469a90..bf9c4a53 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -105,6 +105,16 @@ search."
   :group 'notmuch-search)
 (make-variable-buffer-local 'notmuch-search-oldest-first)
 
+(defcustom notmuch-search-hide-excluded t
+  "Hide mail tagged with a excluded tag.
+
+Excluded tags are defined in the users configuration file under
+the search section. When this variable is true, any mail with
+such a tag will not be shown in the search output."
+  :type 'boolean
+  :group 'notmuch-search)
+(make-variable-buffer-local 'notmuch-search-hide-excluded)
+
 (defcustom notmuch-poll-script nil
   "[Deprecated] Command to run to incorporate new mail into the notmuch database.
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 7fa403fc..f56774f4 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -374,6 +374,7 @@ then NAME behaves like CMD."
     (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
+    (define-key map "i" 'notmuch-tree-toggle-hide-excluded)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
     (define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
     (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -590,7 +591,9 @@ NOT change the database."
   "Call notmuch search with the current query."
   (interactive)
   (notmuch-tree-close-message-window)
-  (notmuch-search (notmuch-tree-get-query)))
+  (notmuch-search (notmuch-tree-get-query)
+		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded))
 
 (defun notmuch-tree-message-window-kill-hook ()
   "Close the message pane when exiting the show buffer."
@@ -803,7 +806,8 @@ nil otherwise."
 			 target
 			 nil
 			 unthreaded
-			 notmuch-search-oldest-first)))
+			 notmuch-search-oldest-first
+			 notmuch-search-hide-excluded)))
 
 (defun notmuch-tree-thread-top ()
   (when (notmuch-tree-get-message-properties)
@@ -1133,7 +1137,8 @@ object, and with the tree results buffer as the current buffer.")
 					 results-buf)))))
 
 (defun notmuch-tree-worker (basic-query &optional query-context target
-					open-target unthreaded oldest-first)
+					open-target unthreaded oldest-first
+					exclude)
   "Insert the tree view of the search in the current buffer.
 
 This is is a helper function for notmuch-tree. The arguments are
@@ -1142,6 +1147,7 @@ the same as for the function notmuch-tree."
   (notmuch-tree-mode)
   (add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
   (setq notmuch-search-oldest-first oldest-first)
+  (setq notmuch-search-hide-excluded exclude)
   (setq notmuch-tree-unthreaded unthreaded)
   (setq notmuch-tree-basic-query basic-query)
   (setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1161,14 +1167,15 @@ the same as for the function notmuch-tree."
 			      (and query-context
 				   (concat " and (" query-context ")"))))
 	 (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
-	 (message-arg (if unthreaded "--unthreaded" "--entire-thread")))
+	 (message-arg (if unthreaded "--unthreaded" "--entire-thread"))
+	 (exclude-arg (if exclude "--exclude=true" "--exclude=false")))
     (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
       (setq search-args basic-query))
     (notmuch-tag-clear-cache)
     (let ((proc (notmuch-start-notmuch
 		 "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
 		 "show" "--body=false" "--format=sexp" "--format-version=5"
-		 sort-arg message-arg search-args))
+		 sort-arg message-arg exclude-arg search-args))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
 	  ;; should be called no matter how the process dies.
@@ -1195,8 +1202,18 @@ default sort order is defined by `notmuch-search-oldest-first'."
   (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
   (notmuch-tree-refresh-view))
 
+(defun notmuch-tree-toggle-hide-excluded ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-hide-excluded'."
+  (interactive)
+  (setq notmuch-search-hide-excluded (not notmuch-search-hide-excluded))
+  (notmuch-tree-refresh-view))
+
 (defun notmuch-tree (&optional query query-context target buffer-name
-			       open-target unthreaded parent-buffer oldest-first)
+			       open-target unthreaded parent-buffer
+			       oldest-first hide-excluded)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1211,7 +1228,15 @@ The arguments are:
       it is nil \"*notmuch-tree\" followed by QUERY is used.
   OPEN-TARGET: If TRUE open the target message in the message pane.
   UNTHREADED: If TRUE only show matching messages in an unthreaded view."
-  (interactive)
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-hide-excluded)))
   (unless query
     (setq query (notmuch-read-query (concat "Notmuch "
 					    (if unthreaded "unthreaded " "tree ")
@@ -1225,17 +1250,27 @@ The arguments are:
     (pop-to-buffer-same-window buffer))
   ;; Don't track undo information for this buffer
   (setq buffer-undo-list t)
-  (notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
+  (notmuch-tree-worker query query-context target open-target
+		       unthreaded oldest-first hide-excluded)
   (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded (&optional query query-context target buffer-name
-				     open-target)
+				     open-target oldest-first hide-excluded)
   "Display threads matching QUERY in unthreaded view.
 
 See function NOTMUCH-TREE for documentation of the arguments"
-  (interactive)
-  (notmuch-tree query query-context target buffer-name open-target t))
+  (interactive
+   (list
+    ;; Prompt for a query
+    nil
+    ;; Fill other args with nil.
+    nil nil nil nil
+    ;; Populate these from the default value of these options.
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-hide-excluded)))
+  (notmuch-tree query query-context target buffer-name open-target
+		t nil oldest-first hide-excluded))
 
 (defun notmuch-tree-filter (query)
   "Filter or LIMIT the current search results based on an additional query string.
@@ -1269,7 +1304,8 @@ search results and that are also tagged with the given TAG."
 		  nil
 		  notmuch-tree-unthreaded
 		  nil
-		  notmuch-search-oldest-first)))
+		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded)))
 
 (defun notmuch-tree-edit-search (query)
   "Edit the current search"
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6eef4af1..2a73ffa5 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -187,6 +187,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "i" 'notmuch-search-toggle-hide-excluded)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -550,12 +551,18 @@ Return non-nil on success."
 (defun notmuch-tree-from-search-current-query ()
   "Tree view of current query."
   (interactive)
-  (notmuch-tree notmuch-search-query-string))
+  (notmuch-tree notmuch-search-query-string
+		nil nil nil nil nil nil
+		notmuch-search-oldest-first
+		notmuch-search-hide-excluded))
 
 (defun notmuch-unthreaded-from-search-current-query ()
   "Unthreaded view of current query."
   (interactive)
-  (notmuch-unthreaded notmuch-search-query-string))
+  (notmuch-unthreaded notmuch-search-query-string
+		      nil nil nil nil
+		      notmuch-search-oldest-first
+		      notmuch-search-hide-excluded))
 
 (defun notmuch-tree-from-search-thread ()
   "Show the selected thread with notmuch-tree."
@@ -564,7 +571,9 @@ Return non-nil on success."
 		notmuch-search-query-string
 		nil
 		(notmuch-prettify-subject (notmuch-search-find-subject))
-		t nil (current-buffer)))
+		t nil (current-buffer)
+		notmuch-search-oldest-first
+		notmuch-search-hide-excluded))
 
 (defun notmuch-search-reply-to-thread (&optional prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."
@@ -1035,14 +1044,16 @@ PROMPT is the string to prompt with."
 
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
 ;;;###autoload
-(defun notmuch-search (&optional query oldest-first target-thread target-line
-				 no-display)
+(defun notmuch-search (&optional query oldest-first hide-excluded target-thread
+				 target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
 Other optional parameters are used as follows:
 
   OLDEST-FIRST: A Boolean controlling the sort order of returned threads
+  HIDE-EXCLUDED: A boolean controlling whether to omit threads with excluded
+                 tags.
   TARGET-THREAD: A thread ID (without the thread: prefix) that will be made
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
@@ -1057,9 +1068,10 @@ the configured default sort order."
    (list
     ;; Prompt for a query
     nil
-    ;; Use the default search order (if we're doing a search from a
-    ;; search buffer, ignore any buffer-local overrides)
-    (default-value 'notmuch-search-oldest-first)))
+    ;; Use the default search order and exclude value (if we're doing a
+    ;; search from a search buffer, ignore any buffer-local overrides)
+    (default-value 'notmuch-search-oldest-first)
+    (default-value 'notmuch-search-hide-excluded)))
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
@@ -1073,6 +1085,7 @@ the configured default sort order."
     (setq notmuch-search-oldest-first oldest-first)
     (setq notmuch-search-target-thread target-thread)
     (setq notmuch-search-target-line target-line)
+    (setq notmuch-search-hide-excluded hide-excluded)
     (notmuch-tag-clear-cache)
     (when (get-buffer-process buffer)
       (error "notmuch search process already running for query `%s'" query))
@@ -1086,6 +1099,9 @@ the configured default sort order."
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
+		     (if hide-excluded
+			 "--exclude=true"
+		       "--exclude=false")
 		     query)))
 	  ;; Use a scratch buffer to accumulate partial output.
 	  ;; This buffer will be killed by the sentinel, which
@@ -1106,11 +1122,21 @@ same relative position within the new buffer."
   (interactive)
   (notmuch-search notmuch-search-query-string
 		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded
 		  (notmuch-search-find-thread-id 'bare)
 		  (line-number-at-pos)
 		  t)
   (goto-char (point-min)))
 
+(defun notmuch-search-toggle-hide-excluded ()
+  "Toggle whether to hide excluded messages.
+
+This command toggles whether to hide excluded messages for the current
+search. The default value for this is defined by `notmuch-search-hide-excluded'."
+  (interactive)
+  (setq notmuch-search-hide-excluded (not notmuch-search-hide-excluded))
+  (notmuch-search-refresh-view))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
@@ -1139,7 +1165,8 @@ current search results AND the additional query string provided."
     (notmuch-search (if (string= grouped-original-query "*")
 			grouped-query
 		      (concat grouped-original-query " and " grouped-query))
-		    notmuch-search-oldest-first)))
+		    notmuch-search-oldest-first
+		    notmuch-search-hide-excluded)))
 
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single TAG.
@@ -1150,13 +1177,16 @@ search results and that are also tagged with the given TAG."
    (list (notmuch-select-tag-with-completion "Filter by tag: "
 					     notmuch-search-query-string)))
   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)
-		  notmuch-search-oldest-first))
+		  notmuch-search-oldest-first
+		  notmuch-search-hide-excluded))
 
 (defun notmuch-search-by-tag (tag)
   "Display threads matching TAG in a notmuch-search buffer."
   (interactive
    (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
-  (notmuch-search (concat "tag:" tag)))
+  (notmuch-search (concat "tag:" tag)
+		  (default-value 'notmuch-search-oldest-first)
+		  (default-value 'notmuch-search-hide-excluded)))
 
 (defun notmuch-search-edit-search (query)
   "Edit the current search"
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index d3aa2e7d..e96c1601 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -1032,7 +1032,7 @@ End of search results.
 YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
 === ERROR ===
 YYY/notmuch_fail exited with status 1
-command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
+command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox
 exit status: 1"
 
 test_begin_subtest "Search handles subprocess warnings"
diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 8e071443..6ef5c54a 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -100,7 +100,7 @@ test_emacs '(notmuch-hello)
 	    (notmuch-test-wait)
 	    (test-output)
 	    (delete-other-windows)'
-test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-oldest-first OUTPUT
 
 test_begin_subtest "Tree view of a single thread (from search)"
 test_emacs '(notmuch-hello)
diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exclude.sh
new file mode 100755
index 00000000..70882a7b
--- /dev/null
+++ b/test/T461-emacs-search-exclude.sh
@@ -0,0 +1,185 @@
+#!/usr/bin/env bash
+
+test_description="exclude options persist between Emacs search and tree modes"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
+
+test_require_emacs
+add_email_corpus
+notmuch config set search.exclude_tags deleted
+notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
+
+# Basic test cases just asserting exclude option is working and consistent.
+
+test_begin_subtest "Search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Tree search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in tree search will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Unthreaded search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in unthreaded will show excluded mail"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
+
+# Cycling from search to tree to unthreaded and vice versa will persist the current
+# value of notmuch-search-hide-excluded.
+
+test_begin_subtest "Value of hide-excluded from search persists into tree search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from search persists into unthreaded"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+      (notmuch-search-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from tree persists into search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-search-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from tree persists into unthreaded"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-tree-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from unthreaded persists into tree"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+      (notmuch-tree-from-unthreaded-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Value of hide-excluded from unthreaded persists into search"
+test_emacs '(notmuch-hello)
+	    (goto-char (point-min))
+	    (re-search-forward "inbox")
+	    (widget-button-press (1- (point)))
+	    (notmuch-test-wait)
+	    (notmuch-unthreaded-from-search-current-query)
+	    (notmuch-test-wait)
+      (notmuch-tree-toggle-hide-excluded)
+	    (notmuch-test-wait)
+      (notmuch-search-from-tree-current-query)
+	    (notmuch-test-wait)
+	    (test-output)
+	    (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_done
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
new file mode 100644
index 00000000..ce1d7118
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
@@ -0,0 +1,25 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before statting (deleted inbox unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18 [1/1]   Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
new file mode 100644
index 00000000..8a874320
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
@@ -0,0 +1,21 @@
+  2009-11-17 [5/5]   Mikhail Gusarov, Carl Worth, Keith Packard  [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17 [7/7]   Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth  [notmuch] Working with Maildir storage? (inbox signed unread)
+  2009-11-17 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] preliminary FreeBSD support (attachment inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Keith Packard, Carl Worth    [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17 [2/2]   Jan Janak, Carl Worth        [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17 [3/3]   Jan Janak, Carl Worth        [notmuch] What a great idea! (inbox unread)
+  2009-11-17 [3/3]   Israel Herraiz, Keith Packard, Carl Worth   [notmuch] New to the list (inbox unread)
+  2009-11-17 [3/3]   Adrian Perez de Castro, Keith Packard, Carl Worth  [notmuch] Introducing myself (inbox signed unread)
+  2009-11-17 [3/3]   Aron Griffis, Keith Packard, Carl Worth     [notmuch] archive (inbox unread)
+  2009-11-17 [2/2]   Ingmar Vanhassel, Carl Worth  [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [2/2]   Alex Botero-Lowry, Carl Worth  [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)
+  2009-11-18 [4/4]   Jjgod Jiang, Alexander Botero-Lowry      [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry  [notmuch] request for pull (inbox unread)
+  2009-11-18 [2/2]   Keith Packard, Alexander Botero-Lowry    [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16 [1/1]   Olivier Berger       Essai accentué (inbox unread)
+  2010-12-29 [1/1]   François Boulogne    [aur-general] Guidelines: cp, mkdir vs install (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
new file mode 100644
index 00000000..5c6b2d7a
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (deleted inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
new file mode 100644
index 00000000..55806d18
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
@@ -0,0 +1,49 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
new file mode 100644
index 00000000..d55818e8
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Alex Botero-Lowry    [notmuch] preliminary FreeBSD support                  (attachment inbox unread)
+  2009-11-17  Carl Worth           [notmuch] preliminary FreeBSD support                  (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file        (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Israel Herraiz       [notmuch] New to the list                              (inbox unread)
+  2009-11-17  Adrian Perez de Cast [notmuch] Introducing myself                           (inbox signed unread)
+  2009-11-17  Aron Griffis         [notmuch] archive                                      (inbox unread)
+  2009-11-17  Ingmar Vanhassel     [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry    [notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (deleted inbox unread)
+  2009-11-18  Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (deleted inbox unread)
+  2009-11-18  Keith Packard        [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] archive                                      (inbox unread)
+  2009-11-18  Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before	statting (deleted inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano    [notmuch] Link to mailing list archives ?              (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] request for pull                             (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] archive                                      (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] What a great idea!                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (deleted inbox unread)
+  2010-12-16  Olivier Berger       Essai accentué                                         (inbox unread)
+  2010-12-29  François Boulogne    [aur-general] Guidelines: cp, mkdir vs install         (inbox unread)
+End of search results.
diff --git a/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded
new file mode 100644
index 00000000..80c67d07
--- /dev/null
+++ b/test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded
@@ -0,0 +1,49 @@
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Alex Botero-Lowry    [notmuch] preliminary FreeBSD support                  (attachment inbox unread)
+  2009-11-17  Carl Worth           [notmuch] preliminary FreeBSD support                  (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file        (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-17  Keith Packard        [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Jan Janak            [notmuch] What a great idea!                           (inbox unread)
+  2009-11-17  Israel Herraiz       [notmuch] New to the list                              (inbox unread)
+  2009-11-17  Adrian Perez de Cast [notmuch] Introducing myself                           (inbox signed unread)
+  2009-11-17  Aron Griffis         [notmuch] archive                                      (inbox unread)
+  2009-11-17  Ingmar Vanhassel     [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry    [notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] Working with Maildir storage?                (inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr?            (attachment inbox signed unread)
+  2009-11-18  Keith Packard        [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] archive                                      (inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano    [notmuch] Link to mailing list archives ?              (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Jjgod Jiang          [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] Mac OS X/Darwin compatibility issues         (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] request for pull                             (inbox unread)
+  2009-11-18  Keith Packard        [notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Working with Maildir storage?                (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] archive                                      (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] What a great idea!                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] New to the list                              (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] Introducing myself                           (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Typsos                               (inbox unread)
+  2009-11-18  Carl Worth           [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2010-12-16  Olivier Berger       Essai accentué                                         (inbox unread)
+  2010-12-29  François Boulogne    [aur-general] Guidelines: cp, mkdir vs install         (inbox unread)
+End of search results.
diff --git a/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
new file mode 100644
index 00000000..588fc583
--- /dev/null
+++ b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first
@@ -0,0 +1,53 @@
+  2009-11-17  Mikhail Gusarov       ┬►[notmuch] [PATCH 1/2] Close message file after parsing message	headers (inbox unread)
+  2009-11-17  Mikhail Gusarov       ├─►[notmuch] [PATCH 2/2] Include <stdint.h> to get uint32_t in C++	file with gcc 4.4 (inbox unread)
+  2009-11-17  Carl Worth            ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-17  Keith Packard          ╰┬► ...                                              (inbox unread)
+  2009-11-18  Carl Worth              ╰─► ...                                             (inbox unread)
+  2009-11-17  Lars Kellogg-Stedman  ┬►[notmuch] Working with Maildir storage?             (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       ├┬► ...                                               (inbox signed unread)
+  2009-11-17  Lars Kellogg-Stedman  │╰┬► ...                                              (inbox signed unread)
+  2009-11-17  Mikhail Gusarov       │ ├─► ...                                             (inbox unread)
+  2009-11-17  Keith Packard         │ ╰┬► ...                                             (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  │  ╰─► ...                                            (inbox signed unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Alex Botero-Lowry     ┬►[notmuch] preliminary FreeBSD support               (attachment inbox unread)
+  2009-11-17  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Mikhail Gusarov       ─►[notmuch] [PATCH] Handle rename of message file     (inbox unread)
+  2009-11-17  Keith Packard         ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove	inbox (and unread) tags (inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Jan Janak             ┬►[notmuch] What a great idea!                        (inbox unread)
+  2009-11-17  Jan Janak             ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Israel Herraiz        ┬►[notmuch] New to the list                           (inbox unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Adrian Perez de Cast  ┬►[notmuch] Introducing myself                        (inbox signed unread)
+  2009-11-18  Keith Packard         ├─► ...                                               (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-17  Aron Griffis          ┬►[notmuch] archive                                   (inbox unread)
+  2009-11-18  Keith Packard         ╰┬► ...                                               (inbox unread)
+  2009-11-18  Carl Worth             ╰─► ...                                              (inbox unread)
+  2009-11-17  Ingmar Vanhassel      ┬►[notmuch] [PATCH] Typsos                            (inbox unread)
+  2009-11-18  Carl Worth            ╰─► ...                                               (inbox unread)
+  2009-11-18  Alex Botero-Lowry     ┬►[notmuch] [PATCH] Error out if no query is supplied to search	instead of going into an infinite loop (attachment inbox unread)
+  2009-11-18  Carl Worth            ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18  Lars Kellogg-Stedman  ┬►[notmuch] "notmuch help" outputs to stderr?         (attachment inbox signed unread)
+  2009-11-18  Lars Kellogg-Stedman  ╰─► ...                                               (attachment inbox signed unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++	libs. (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox unread)
+  2009-11-18  Stewart Smith         ─►[notmuch] [PATCH] count_files: sort directory in inode order before	statting (inbox unread)
+  2009-11-18  Jjgod Jiang           ┬►[notmuch] Mac OS X/Darwin compatibility issues      (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰┬► ...                                               (inbox unread)
+  2009-11-18  Jjgod Jiang            ╰┬► ...                                              (inbox unread)
+  2009-11-18  Alexander Botero-Low    ╰─► ...                                             (inbox unread)
+  2009-11-18  Jan Janak             ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool	subdirectories into tags (inbox unread)
+  2009-11-18  Rolland Santimano     ─►[notmuch] Link to mailing list archives ?           (inbox unread)
+  2009-11-18  Alexander Botero-Low  ─►[notmuch] request for pull                          (inbox unread)
+  2009-11-18  Keith Packard         ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that	highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Alexander Botero-Low  ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18  Chris Wilson          ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
+  2010-12-16  Olivier Berger        ─►Essai accentué                                      (inbox unread)
+  2010-12-29  François Boulogne     ─►[aur-general] Guidelines: cp, mkdir vs install      (inbox unread)
+End of search results.
-- 
2.44.0
\r

^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2024-03-10 19:03 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-28 20:02 [PATCH] emacs: add new option notmuch-search-exclude Mohsin Kaleem
2021-12-24  0:33 ` David Bremner
2022-03-22 13:27   ` Mohsin Kaleem
2022-03-22 19:21     ` David Bremner
2022-03-22 19:38       ` Mohsin Kaleem
2022-03-22 19:59         ` David Bremner
2022-03-22 20:07           ` Mohsin Kaleem
2022-03-22 20:19             ` David Bremner
2022-03-22 20:27               ` Mohsin Kaleem
2022-03-25 19:36                 ` David Bremner
2022-07-24 20:59                   ` Mohsin Kaleem
2022-07-30 14:02                     ` David Bremner
2022-08-07 14:57                       ` [PATCH 1/9] " Mohsin Kaleem
2022-08-07 14:57                         ` [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude Mohsin Kaleem
2022-08-12 10:42                           ` David Bremner
2022-08-07 14:57                         ` [PATCH 3/9] test: Fix Search handles subprocess error exit codes Mohsin Kaleem
2022-08-07 14:57                         ` [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello Mohsin Kaleem
2022-08-12 10:46                           ` David Bremner
2022-08-07 14:57                         ` [PATCH 5/9] feat: Add more interactive specs Mohsin Kaleem
2022-08-12 10:48                           ` David Bremner
2022-08-07 14:57                         ` [PATCH 6/9] test: Add test cases for new exclude option Mohsin Kaleem
2022-08-08 18:56                           ` Tomi Ollila
2022-08-08 19:20                             ` Mohsin Kaleem
2022-08-12 10:49                           ` David Bremner
2022-08-07 14:57                         ` [PATCH 7/9] test: Fix Navigation of notmuch-hello to search results Mohsin Kaleem
2022-08-12 10:51                           ` David Bremner
2022-08-07 14:57                         ` [PATCH 8/9] review: Rename variables to better express intention Mohsin Kaleem
2022-08-12 10:55                           ` David Bremner
2022-08-07 14:57                         ` [PATCH 9/9] build: Fix declare-function calls for updated functions Mohsin Kaleem
2022-08-07 15:00                       ` [PATCH] emacs: add new option notmuch-search-exclude Mohsin Kaleem
2022-08-12 11:12                         ` David Bremner
2022-08-12 11:18                           ` David Bremner
2023-04-16 13:18                       ` [PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded mohkale
2023-04-16 13:18                         ` [PATCH v2 1/3] " mohkale
2023-05-03 19:59                           ` David Bremner
2023-05-05 11:43                             ` Mohsin Kaleem
2023-05-07 12:27                               ` David Bremner
2023-05-07 13:19                           ` David Bremner
2023-04-16 13:18                         ` [PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages mohkale
2023-05-07 13:39                           ` David Bremner
2024-03-10 18:48                             ` Mohsin Kaleem
2023-05-07 20:13                           ` David Bremner
2023-04-16 13:18                         ` [PATCH v2 3/3] test/emacs: Add test cases for notmuch-search-hide-excluded mohkale
2023-05-07 20:19                           ` David Bremner
2024-03-10 18:57                         ` [PATCH v3] emacs: Add new option notmuch-search-hide-excluded mohkale

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).