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 19B41431FD4
\r
6 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 01:35:44 -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 7yzlTucx-v1y for <notmuch@notmuchmail.org>;
\r
17 Tue, 17 Apr 2012 01:35:42 -0700 (PDT)
\r
18 Received: from mail-qa0-f43.google.com (mail-qa0-f43.google.com
\r
19 [209.85.216.43]) (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 DF8D1431FC7
\r
22 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 01:35:36 -0700 (PDT)
\r
23 Received: by mail-qa0-f43.google.com with SMTP id b15so225149qad.2
\r
24 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 01:35:36 -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=cI9JN7spgr90sOxN8oeJZSgD+GfYoU4XntX5CWkYh+E=;
\r
30 b=Pw0S95qbfp9vdYYdAAogqd8634JqTW9J4WA38qDJ8yMsIZlfM7BCA38Oe6MuM+Ge2Q
\r
31 EkVsxk04f75ok3+XbTLExSo0O2w4jQQLVf4EciCqu2Cu68eXV8bk1pf7coWgZkbQaXuJ
\r
32 2XGX3A2BVMpx9Jv7kyCv9zw+B7Q/kgQkiac/NC16FI1+Dc4jVHeSxV4nzqV0teToV/1N
\r
33 u8+aDDohNyWbEo9P98TtQeQ2YSd2PBBgRJOp2jWgiD8kXP2jt9wMDGI55YEeAsOfeNuv
\r
34 K5zqOuMIJv5O+WkicjrYr7SRJ1mrhY8kWi/5Cmj4rTnjFcDyEpixX1F4CnC+0SAdOrXs
\r
36 Received: by 10.229.136.7 with SMTP id p7mr5896824qct.52.1334651736555;
\r
37 Tue, 17 Apr 2012 01:35:36 -0700 (PDT)
\r
38 Received: from localhost (nikula.org. [92.243.24.172])
\r
39 by mx.google.com with ESMTPS id i8sm15947250qap.0.2012.04.17.01.35.35
\r
40 (version=SSLv3 cipher=OTHER); Tue, 17 Apr 2012 01:35:35 -0700 (PDT)
\r
41 From: Jani Nikula <jani@nikula.org>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [RFC PATCH 3/4] emacs: add notmuch hello refresh hook to display
\r
44 message count change
\r
45 Date: Tue, 17 Apr 2012 08:35:24 +0000
\r
47 <c2449d9a081e5f013da4349368f4be291d03724e.1334651669.git.jani@nikula.org>
\r
48 X-Mailer: git-send-email 1.7.1
\r
50 <bcfdc0d1969997e89e5abe0b320d77ee2109796a.1334651669.git.jani@nikula.org>
\r
52 <bcfdc0d1969997e89e5abe0b320d77ee2109796a.1334651669.git.jani@nikula.org>
\r
54 <bcfdc0d1969997e89e5abe0b320d77ee2109796a.1334651669.git.jani@nikula.org>
\r
56 <bcfdc0d1969997e89e5abe0b320d77ee2109796a.1334651669.git.jani@nikula.org>
\r
58 ALoCoQkg4U22FefUtW10XDcvV5wdltchQuaYCoZxx+X67ieL9WD/Lxf4PS06mU2q4phGFv3DmgkH
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Tue, 17 Apr 2012 08:35:44 -0000
\r
73 Add a notmuch hello refresh hook to display a message about change in
\r
74 message count in the database since the notmuch-hello buffer was last
\r
75 refreshed manually (no-display is nil).
\r
77 emacs/notmuch-hello.el | 23 +++++++++++++++++++++++
\r
78 1 files changed, 23 insertions(+), 0 deletions(-)
\r
80 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
81 index 0596bbe..13da146 100644
\r
82 --- a/emacs/notmuch-hello.el
\r
83 +++ b/emacs/notmuch-hello.el
\r
84 @@ -148,6 +148,7 @@ International Bureau of Weights and Measures."
\r
85 (defcustom notmuch-hello-refresh-hook nil
\r
86 "Functions called after updating a `notmuch-hello' buffer."
\r
88 + :options '(notmuch-hello-refresh-status-message)
\r
89 :group 'notmuch-hello
\r
90 :group 'notmuch-hooks)
\r
92 @@ -729,6 +730,28 @@ following:
\r
93 (let ((fill-column (- (window-width) notmuch-hello-indent)))
\r
94 (center-region start (point)))))
\r
96 +(defvar notmuch-hello-refresh-count 0
\r
97 + "Number of messages in the database when `notmuch-hello' was last run.
\r
99 +Used internally by `notmuch-hello-refresh-status-message'.")
\r
101 +(defun notmuch-hello-refresh-status-message (no-display)
\r
102 + "Hook to display a status message when refreshing notmuch-hello buffer."
\r
103 + (unless no-display
\r
104 + (let* ((new-count
\r
105 + (string-to-number (car (process-lines notmuch-command "count"))))
\r
106 + (diff-count (- new-count notmuch-hello-refresh-count)))
\r
107 + (if (= notmuch-hello-refresh-count 0)
\r
108 + (message "You have %s messages."
\r
109 + (notmuch-hello-nice-number new-count))
\r
110 + (if (not (= diff-count 0))
\r
111 + (if (>= diff-count 0)
\r
112 + (message "You have %s more messages since last refresh."
\r
113 + (notmuch-hello-nice-number diff-count))
\r
114 + (message "You have %s fewer messages since last refresh."
\r
115 + (notmuch-hello-nice-number (- diff-count))))))
\r
116 + (setq notmuch-hello-refresh-count new-count))))
\r
119 (defun notmuch-hello (&optional no-display)
\r
120 "Run notmuch and display saved searches, known tags, etc."
\r