--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id E7956431FC0\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Sep 2012 07:49:03 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id M0p1JxO-RvlQ for <notmuch@notmuchmail.org>;\r
+ Sun, 2 Sep 2012 07:49:01 -0700 (PDT)\r
+Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
+ [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 36066431E62\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Sep 2012 07:48:53 -0700 (PDT)\r
+Received: by mail-lpp01m010-f53.google.com with SMTP id c1so3338105lah.26\r
+ for <notmuch@notmuchmail.org>; Sun, 02 Sep 2012 07:48:53 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+ :in-reply-to:references:x-gm-message-state;\r
+ bh=lpkbhuiH9hr11QEWg7A3rntVi7TM/yHv4iz0RQC2x94=;\r
+ b=JX9u+XX1nco8jiyA7chLQ0REJ3Qw3c44hksnZ6z1m7il1RBUy9IxTY3LLbWyy8J5x9\r
+ Q60h4Gnmqb4vXvjGN/Yc0FNOiMfB4VpkfhCCHlswEGce2l47mVG7kDBkGGJspdpuPMlc\r
+ iEZKf1LNEDpfEPmF2dq5TB9b/bqXRoEPnvluAHvvUGuiutVM5tzWuoR15YZg81KUr/0U\r
+ 4I7lBqf2sA5UQzM2HE/JlXaqexNx/jiK5sP2S1RtjFoWTBn/FSx8zZls5DvJ+/xqZMjS\r
+ F3lCtSH3b35o7XDqqDjtluc3w9oEngPbvMsxzLi+cL7Wvvn/ap+a1DmiqalAukxtelM4\r
+ szGA==\r
+Received: by 10.152.132.133 with SMTP id ou5mr11535308lab.45.1346597333679;\r
+ Sun, 02 Sep 2012 07:48:53 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
+ [80.223.81.27])\r
+ by mx.google.com with ESMTPS id mq9sm10741917lab.0.2012.09.02.07.48.52\r
+ (version=SSLv3 cipher=OTHER); Sun, 02 Sep 2012 07:48:52 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 4/5] emacs: add notmuch hello refresh hook to display\r
+ message count change\r
+Date: Sun, 2 Sep 2012 17:48:36 +0300\r
+Message-Id:\r
+ <68598461de8be62156ce21545baeb2ab325fa817.1346596156.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <cover.1346596156.git.jani@nikula.org>\r
+References: <cover.1346596156.git.jani@nikula.org>\r
+In-Reply-To: <cover.1346596156.git.jani@nikula.org>\r
+References: <cover.1346596156.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQkvRIidSe+0zxgATcR9NHm7Q7JRYPA/zuSPH1CfNgCFtKUlwOte9s1mR2Te6Abq3UNkXovW\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 02 Sep 2012 14:49:04 -0000\r
+\r
+Add a notmuch hello refresh hook to display a message about change in\r
+message count in the database since the notmuch-hello buffer was last\r
+refreshed manually (no-display is nil).\r
+\r
+Signed-off-by: Jani Nikula <jani@nikula.org>\r
+---\r
+ emacs/notmuch-hello.el | 38 ++++++++++++++++++++++++++++++++++++++\r
+ 1 file changed, 38 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index fa14443..f7a3c95 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -148,6 +148,7 @@ International Bureau of Weights and Measures."\r
+ (defcustom notmuch-hello-refresh-hook nil\r
+ "Functions called after updating a `notmuch-hello' buffer."\r
+ :type 'hook\r
++ :options '(notmuch-hello-refresh-status-message)\r
+ :group 'notmuch-hello\r
+ :group 'notmuch-hooks)\r
+ \r
+@@ -749,6 +750,43 @@ following:\r
+ (let ((fill-column (- (window-width) notmuch-hello-indent)))\r
+ (center-region start (point)))))\r
+ \r
++(defcustom notmuch-hello-refresh-status-query "*"\r
++ "Query to use for `notmuch-hello-refresh-status-message' hook."\r
++ :type '(choice (const :tag "All messages" "*")\r
++ (string :tag "Custom query"\r
++ :value "tag:inbox"))\r
++ :group 'notmuch-hello)\r
++\r
++(defvar notmuch-hello-refresh-count 0\r
++ "Number of matching messages when `notmuch-hello' was last run.\r
++\r
++Used internally by `notmuch-hello-refresh-status-message'.")\r
++\r
++(defun notmuch-hello-refresh-status-message (no-display)\r
++ "Hook to display a status message when refreshing notmuch-hello buffer.\r
++\r
++Display a status message about the difference in message count\r
++matching `notmuch-hello-refresh-status-query' since the last time\r
++notmuch-hello was refreshed. Only takes into account explicit\r
++refreshes (NO-DISPLAY is nil)."\r
++ (unless no-display\r
++ (let* ((new-count\r
++ (string-to-number\r
++ (car (process-lines notmuch-command "count"\r
++ notmuch-hello-refresh-status-query))))\r
++ (diff-count (- new-count notmuch-hello-refresh-count)))\r
++ (cond\r
++ ((= notmuch-hello-refresh-count 0)\r
++ (message "You have %s messages."\r
++ (notmuch-hello-nice-number new-count)))\r
++ ((> diff-count 0)\r
++ (message "You have %s more messages since last refresh."\r
++ (notmuch-hello-nice-number diff-count)))\r
++ ((< diff-count 0)\r
++ (message "You have %s fewer messages since last refresh."\r
++ (notmuch-hello-nice-number (- diff-count)))))\r
++ (setq notmuch-hello-refresh-count new-count))))\r
++\r
+ ;;;###autoload\r
+ (defun notmuch-hello (&optional no-display)\r
+ "Run notmuch and display saved searches, known tags, etc.\r
+-- \r
+1.7.9.5\r
+\r