unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: Add the option of counting threads in notmuch-hello
Date: Wed, 15 Feb 2012 08:28:08 -0700	[thread overview]
Message-ID: <1329319688-16056-1-git-send-email-awg+notmuch@xvx.ca> (raw)

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	other threads:[~2012-02-15 15:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 15:28 Adam Wolfe Gordon [this message]
2012-02-15 15:52 ` [PATCH] emacs: Add the option of counting threads in notmuch-hello 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329319688-16056-1-git-send-email-awg+notmuch@xvx.ca \
    --to=awg+notmuch@xvx.ca \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).