[PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello

Subject: [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello

Date: Sun, 7 Aug 2022 15:57:28 +0100

To: David Bremner, notmuch@notmuchmail.org

Cc: Mohsin Kaleem

From: 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

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: