[PATCH] emacs-hello: Do not calculate the count of the messages in

Subject: [PATCH] emacs-hello: Do not calculate the count of the messages in

Date: Thu, 13 Oct 2011 16:09:23 +0200

To: Daniel Schoepe, notmuch@notmuchmail.org

Cc:

From: Michal Sojka


On Mon, 10 Oct 2011, Daniel Schoepe wrote:
> Fixed that and rebased against master.

Hi Daniel,

I've an improvement for your patches. Recently, I decided to speed up
notmuch hello startup times and I found that hiding a section does not
eliminate the execution of "notmuch count" commands for buttons in the
hidden section. The following patch (applies on top of v5) should fix
it. Now I can enjoy blazingly fast notmuch startup, because I have only
one section shown. :-)

Another improvement could be the addition of [hide] button for saved
searches sections.

Cheers,
-Michal

--8<---------------cut here---------------start------------->8---
The result is that hello screen shows much faster when some sections are
hidden.
---
 emacs/notmuch-hello.el |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1f51281..9dcd0f9 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -653,16 +653,16 @@ Supports the following entries in OPTIONS as a plist:
 				(notmuch-hello-update))
 		     "hide"))
     (widget-insert "\n")
-    (let (target-pos
-	  (searches (apply 'notmuch-hello-query-counts query-alist options)))
-      (when (and (not is-hidden)
-	       (or (not (plist-get options :hide-if-empty))
-		  searches))
-	(widget-insert "\n")
-	(setq target-pos
-	      (notmuch-hello-insert-buttons searches))
-	(indent-rigidly start (point) notmuch-hello-indent)
-	target-pos))))
+    (let (target-pos)
+      (when (not is-hidden)
+	(let ((searches (apply 'notmuch-hello-query-counts query-alist options)))
+	  (when (or (not (plist-get options :hide-if-empty))
+		    searches)
+	    (widget-insert "\n")
+	    (setq target-pos
+		  (notmuch-hello-insert-buttons searches))
+	    (indent-rigidly start (point) notmuch-hello-indent))))
+      target-pos)))
 
 (defun notmuch-hello-insert-tags-section (&optional title &rest options)
   "Insert a section displaying all tags and message counts for each.
-- 
1.7.5.4

--8<---------------cut here---------------end--------------->8---

Thread: