Add a customizable variable, notmuch-hello-count-threads, which when
set causes notmuch-hello to display thread counts instead of message
counts. The default remains message counts.
---
 emacs/notmuch-hello.el |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index d17a30f..9bbf725 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -151,6 +151,11 @@ International Bureau of Weights and Measures."
   :group 'notmuch-hello
   :group 'notmuch-hooks)

+(defcustom notmuch-hello-count-threads nil
+  "If non-nil, count threads instead of messages in `notmuch-hello'."
+  :type 'boolean
+  :group 'notmuch-hello)
+
 (defvar notmuch-hello-url "http://notmuchmail.org";
   "The `notmuch' web site.")

@@ -232,7 +237,9 @@ diagonal."
                  nil nil #'notmuch-hello-search-continuation))

 (defun notmuch-saved-search-count (search)
-  (car (process-lines notmuch-command "count" search)))
+  (if notmuch-hello-count-threads
+      (car (process-lines notmuch-command "count" "--output=threads" search))
+    (car (process-lines notmuch-command "count" search))))

 (defun notmuch-hello-tags-per-line (widest)
   "Determine how many tags to show per line and how wide they
@@ -453,8 +460,12 @@ Complete list of currently available key bindings:
                               (notmuch-hello-update))
                     :help-echo "Refresh"
                     (notmuch-hello-nice-number
-                     (string-to-number (car (process-lines notmuch-command 
"count")))))
-      (widget-insert " messages.\n"))
+                     (if notmuch-hello-count-threads
+                         (string-to-number (car (process-lines notmuch-command 
"count" "--output=threads")))
+                       (string-to-number (car (process-lines notmuch-command 
"count"))))))
+      (if notmuch-hello-count-threads
+         (widget-insert " threads.\n")
+       (widget-insert " messages.\n")))

     (let ((found-target-pos nil)
          (final-target-pos nil)
-- 
1.7.5.4

Reply via email to