1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id E7956431FC0
\r
6 for <notmuch@notmuchmail.org>; Sun, 2 Sep 2012 07:49:03 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id M0p1JxO-RvlQ for <notmuch@notmuchmail.org>;
\r
17 Sun, 2 Sep 2012 07:49:01 -0700 (PDT)
\r
18 Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com
\r
19 [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 36066431E62
\r
22 for <notmuch@notmuchmail.org>; Sun, 2 Sep 2012 07:48:53 -0700 (PDT)
\r
23 Received: by mail-lpp01m010-f53.google.com with SMTP id c1so3338105lah.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 02 Sep 2012 07:48:53 -0700 (PDT)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=google.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references
\r
28 :in-reply-to:references:x-gm-message-state;
\r
29 bh=lpkbhuiH9hr11QEWg7A3rntVi7TM/yHv4iz0RQC2x94=;
\r
30 b=JX9u+XX1nco8jiyA7chLQ0REJ3Qw3c44hksnZ6z1m7il1RBUy9IxTY3LLbWyy8J5x9
\r
31 Q60h4Gnmqb4vXvjGN/Yc0FNOiMfB4VpkfhCCHlswEGce2l47mVG7kDBkGGJspdpuPMlc
\r
32 iEZKf1LNEDpfEPmF2dq5TB9b/bqXRoEPnvluAHvvUGuiutVM5tzWuoR15YZg81KUr/0U
\r
33 4I7lBqf2sA5UQzM2HE/JlXaqexNx/jiK5sP2S1RtjFoWTBn/FSx8zZls5DvJ+/xqZMjS
\r
34 F3lCtSH3b35o7XDqqDjtluc3w9oEngPbvMsxzLi+cL7Wvvn/ap+a1DmiqalAukxtelM4
\r
36 Received: by 10.152.132.133 with SMTP id ou5mr11535308lab.45.1346597333679;
\r
37 Sun, 02 Sep 2012 07:48:53 -0700 (PDT)
\r
38 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.
\r
40 by mx.google.com with ESMTPS id mq9sm10741917lab.0.2012.09.02.07.48.52
\r
41 (version=SSLv3 cipher=OTHER); Sun, 02 Sep 2012 07:48:52 -0700 (PDT)
\r
42 From: Jani Nikula <jani@nikula.org>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH v2 4/5] emacs: add notmuch hello refresh hook to display
\r
45 message count change
\r
46 Date: Sun, 2 Sep 2012 17:48:36 +0300
\r
48 <68598461de8be62156ce21545baeb2ab325fa817.1346596156.git.jani@nikula.org>
\r
49 X-Mailer: git-send-email 1.7.9.5
\r
50 In-Reply-To: <cover.1346596156.git.jani@nikula.org>
\r
51 References: <cover.1346596156.git.jani@nikula.org>
\r
52 In-Reply-To: <cover.1346596156.git.jani@nikula.org>
\r
53 References: <cover.1346596156.git.jani@nikula.org>
\r
55 ALoCoQkvRIidSe+0zxgATcR9NHm7Q7JRYPA/zuSPH1CfNgCFtKUlwOte9s1mR2Te6Abq3UNkXovW
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.13
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Sun, 02 Sep 2012 14:49:04 -0000
\r
70 Add a notmuch hello refresh hook to display a message about change in
\r
71 message count in the database since the notmuch-hello buffer was last
\r
72 refreshed manually (no-display is nil).
\r
74 Signed-off-by: Jani Nikula <jani@nikula.org>
\r
76 emacs/notmuch-hello.el | 38 ++++++++++++++++++++++++++++++++++++++
\r
77 1 file changed, 38 insertions(+)
\r
79 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
80 index fa14443..f7a3c95 100644
\r
81 --- a/emacs/notmuch-hello.el
\r
82 +++ b/emacs/notmuch-hello.el
\r
83 @@ -148,6 +148,7 @@ International Bureau of Weights and Measures."
\r
84 (defcustom notmuch-hello-refresh-hook nil
\r
85 "Functions called after updating a `notmuch-hello' buffer."
\r
87 + :options '(notmuch-hello-refresh-status-message)
\r
88 :group 'notmuch-hello
\r
89 :group 'notmuch-hooks)
\r
91 @@ -749,6 +750,43 @@ following:
\r
92 (let ((fill-column (- (window-width) notmuch-hello-indent)))
\r
93 (center-region start (point)))))
\r
95 +(defcustom notmuch-hello-refresh-status-query "*"
\r
96 + "Query to use for `notmuch-hello-refresh-status-message' hook."
\r
97 + :type '(choice (const :tag "All messages" "*")
\r
98 + (string :tag "Custom query"
\r
99 + :value "tag:inbox"))
\r
100 + :group 'notmuch-hello)
\r
102 +(defvar notmuch-hello-refresh-count 0
\r
103 + "Number of matching messages when `notmuch-hello' was last run.
\r
105 +Used internally by `notmuch-hello-refresh-status-message'.")
\r
107 +(defun notmuch-hello-refresh-status-message (no-display)
\r
108 + "Hook to display a status message when refreshing notmuch-hello buffer.
\r
110 +Display a status message about the difference in message count
\r
111 +matching `notmuch-hello-refresh-status-query' since the last time
\r
112 +notmuch-hello was refreshed. Only takes into account explicit
\r
113 +refreshes (NO-DISPLAY is nil)."
\r
114 + (unless no-display
\r
115 + (let* ((new-count
\r
116 + (string-to-number
\r
117 + (car (process-lines notmuch-command "count"
\r
118 + notmuch-hello-refresh-status-query))))
\r
119 + (diff-count (- new-count notmuch-hello-refresh-count)))
\r
121 + ((= notmuch-hello-refresh-count 0)
\r
122 + (message "You have %s messages."
\r
123 + (notmuch-hello-nice-number new-count)))
\r
124 + ((> diff-count 0)
\r
125 + (message "You have %s more messages since last refresh."
\r
126 + (notmuch-hello-nice-number diff-count)))
\r
127 + ((< diff-count 0)
\r
128 + (message "You have %s fewer messages since last refresh."
\r
129 + (notmuch-hello-nice-number (- diff-count)))))
\r
130 + (setq notmuch-hello-refresh-count new-count))))
\r
133 (defun notmuch-hello (&optional no-display)
\r
134 "Run notmuch and display saved searches, known tags, etc.
\r