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

* Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Kurochkin @ 2012-02-15 15:52 UTC (permalink / raw)
  To: Adam Wolfe Gordon, David Bremner, notmuch

Hello.

Can we delay this patch until user-defined sections are pushed?  I know
I promised to review it long ago.  But I still did not manage to finish
it yet.  I hope I can do it in the beginning of the next week.

Regards,
  Dmitry

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

* Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello
  2012-02-15 15:52 ` Dmitry Kurochkin
@ 2012-02-15 16:23   ` Adam Wolfe Gordon
  2012-02-15 17:14     ` Tomi Ollila
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Wolfe Gordon @ 2012-02-15 16:23 UTC (permalink / raw)
  To: Dmitry Kurochkin; +Cc: notmuch

On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
<dmitry.kurochkin@gmail.com> wrote:
> Can we delay this patch until user-defined sections are pushed?  I know
> I promised to review it long ago.  But I still did not manage to finish
> it yet.  I hope I can do it in the beginning of the next week.

Absolutely. I was just building new notmuch packages for myself this
morning and realized I had this commit sitting in my tree collecting
dust.

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

* Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello
  2012-02-15 16:23   ` Adam Wolfe Gordon
@ 2012-02-15 17:14     ` Tomi Ollila
  2012-02-15 20:24       ` Mark Walters
                         ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tomi Ollila @ 2012-02-15 17:14 UTC (permalink / raw)
  To: Adam Wolfe Gordon, Dmitry Kurochkin; +Cc: notmuch

On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:
> On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
> <dmitry.kurochkin@gmail.com> wrote:
> > Can we delay this patch until user-defined sections are pushed?  I know
> > I promised to review it long ago.  But I still did not manage to finish
> > it yet.  I hope I can do it in the beginning of the next week.
> 
> Absolutely. I was just building new notmuch packages for myself this
> morning and realized I had this commit sitting in my tree collecting
> dust.

notmuch count is fast
notmuch count --output=threads  is slower

I was thinking why not show both? but as threads
count is slow there could be customization variable
for showing *optionally* thread count in addition 
to message count like

"You have nn,nnn messages in n,nnn threads"

Tomi

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

* Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello
  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
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2012-02-15 20:24 UTC (permalink / raw)
  To: Tomi Ollila, Adam Wolfe Gordon, Dmitry Kurochkin; +Cc: notmuch


On Wed, 15 Feb 2012 19:14:19 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:
> > On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
> > <dmitry.kurochkin@gmail.com> wrote:
> > > Can we delay this patch until user-defined sections are pushed?  I know
> > > I promised to review it long ago.  But I still did not manage to finish
> > > it yet.  I hope I can do it in the beginning of the next week.
> > 
> > Absolutely. I was just building new notmuch packages for myself this
> > morning and realized I had this commit sitting in my tree collecting
> > dust.
> 
> notmuch count is fast
> notmuch count --output=threads  is slower
> 
> I was thinking why not show both? but as threads
> count is slow there could be customization variable
> for showing *optionally* thread count in addition 
> to message count like
> 
> "You have nn,nnn messages in n,nnn threads"


At the risk of reducing this to bikeshedding I would prefer an option to
disable the counts totally: even counting messages is annoyingly
slow. Maybe this will all be fixed by the user-defined sections patch
though.

Best wishes

Mark

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

* Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello
  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
  2 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2012-02-15 20:58 UTC (permalink / raw)
  To: Tomi Ollila, Adam Wolfe Gordon, Dmitry Kurochkin; +Cc: notmuch

On Wed, 15 Feb 2012 19:14:19 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:
> > On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
> > <dmitry.kurochkin@gmail.com> wrote:
> > > Can we delay this patch until user-defined sections are pushed?  I know
> > > I promised to review it long ago.  But I still did not manage to finish
> > > it yet.  I hope I can do it in the beginning of the next week.
> > 
> > Absolutely. I was just building new notmuch packages for myself this
> > morning and realized I had this commit sitting in my tree collecting
> > dust.
> 
> notmuch count is fast
> notmuch count --output=threads  is slower

Yup, it's because you can't query Xapian about threads. Compare
notmuch_query_count_{messages,threads} in lib/query.cc for details.

> I was thinking why not show both? but as threads
> count is slow there could be customization variable
> for showing *optionally* thread count in addition 
> to message count like
> 
> "You have nn,nnn messages in n,nnn threads"
> 
> Tomi
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello
  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
  2 siblings, 0 replies; 7+ messages in thread
From: Adam Wolfe Gordon @ 2012-02-22  0:28 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

On Wed, Feb 15, 2012 at 10:14, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:
> notmuch count is fast
> notmuch count --output=threads  is slower
>
> I was thinking why not show both? but as threads
> count is slow there could be customization variable
> for showing *optionally* thread count in addition
> to message count like
>
> "You have nn,nnn messages in n,nnn threads"

Sure, sounds good to me. I never really look at the count at the top,
I just like having the counts beside the saved searches and tags be
thread counts.

^ permalink raw reply	[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).