unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Add the option of counting threads in notmuch-hello
@ 2012-02-15 15:28 Adam Wolfe Gordon
  2012-02-15 15:52 ` Dmitry Kurochkin
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Wolfe Gordon @ 2012-02-15 15:28 UTC (permalink / raw)
  To: notmuch

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

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

end of thread, other threads:[~2012-02-22  0:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15 15:28 [PATCH] emacs: Add the option of counting threads in notmuch-hello Adam Wolfe Gordon
2012-02-15 15:52 ` Dmitry Kurochkin
2012-02-15 16:23   ` Adam Wolfe Gordon
2012-02-15 17:14     ` Tomi Ollila
2012-02-15 20:24       ` Mark Walters
2012-02-15 20:58       ` Jani Nikula
2012-02-22  0:28       ` Adam Wolfe Gordon

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).