[PATCH] emacs: Add the option of counting threads in notmuch-hello

classic Classic list List threaded Threaded
7 messages Options
Adam Wolfe Gordon Adam Wolfe Gordon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[PATCH] emacs: Add the option of counting threads in notmuch-hello

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

_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
--
Adam Wolfe Gordon
Dmitry Kurochkin Dmitry Kurochkin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello

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
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Adam Wolfe Gordon Adam Wolfe Gordon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello

On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
<[hidden email]> 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 mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
--
Adam Wolfe Gordon
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello

On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <[hidden email]> wrote:
> On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
> <[hidden email]> 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
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Mark Walters Mark Walters
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello


On Wed, 15 Feb 2012 19:14:19 +0200, Tomi Ollila <[hidden email]> wrote:

> On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <[hidden email]> wrote:
> > On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
> > <[hidden email]> 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
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello

In reply to this post by Tomi Ollila-2
On Wed, 15 Feb 2012 19:14:19 +0200, Tomi Ollila <[hidden email]> wrote:

> On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <[hidden email]> wrote:
> > On Wed, Feb 15, 2012 at 08:52, Dmitry Kurochkin
> > <[hidden email]> 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
> [hidden email]
> http://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Adam Wolfe Gordon Adam Wolfe Gordon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [PATCH] emacs: Add the option of counting threads in notmuch-hello

In reply to this post by Tomi Ollila-2
On Wed, Feb 15, 2012 at 10:14, Tomi Ollila <[hidden email]> wrote:

> On Wed, 15 Feb 2012 09:23:31 -0700, Adam Wolfe Gordon <[hidden email]> 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.
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
--
Adam Wolfe Gordon
Loading...