1 Return-Path: <dmitry.kurochkin@gmail.com>
\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 3FAE9431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 02:15:12 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, 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 RCf9MelaOOJY for <notmuch@notmuchmail.org>;
\r
17 Tue, 17 Apr 2012 02:15:07 -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 94BCC431FAE
\r
22 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 02:15:07 -0700 (PDT)
\r
23 Received: by lahc1 with SMTP id c1so4765502lah.26
\r
24 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 02:15:06 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
27 :mime-version:content-type;
\r
28 bh=990vjPpnDm9P+RsMbwGOjAQEsYqB1PzKu6MCSN829Jo=;
\r
29 b=ilRX6A19bxQW5rlWt3sYmKRCY8Uw+pQBzK7p76dRSJjlTGxJsTH3NoB4kTgNzYfO0L
\r
30 WmYCzTyIA2Y0bIVVpmRvZczNlhjij1S+yZHYFeDbtZ549C+zhavlUwWg+BF/OeBvqnO+
\r
31 wrXfvsPOQcsbXzKFRXosu7eN8FhEs1r8KrUC7vzSTaOqJOtc94jqAoK6gfXaEF5yBzhu
\r
32 n9zI2jB2Gc3ZMTqp4Y6HAgnUSNqAJB51I6ctzzTJD/8Awq7Xtukd0yWscYSAAjelXkwY
\r
33 6w3AsL5qWJze6rt7pu+c1+5qnIVzSLUsvz5iXpUAc8FC2RQ8CH5Rs+RvqipnJzYzipX+
\r
35 Received: by 10.112.99.38 with SMTP id en6mr6884321lbb.48.1334654105990;
\r
36 Tue, 17 Apr 2012 02:15:05 -0700 (PDT)
\r
37 Received: from localhost ([91.144.186.21])
\r
38 by mx.google.com with ESMTPS id nv7sm10605563lab.9.2012.04.17.02.15.04
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Tue, 17 Apr 2012 02:15:05 -0700 (PDT)
\r
41 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
42 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
\r
43 Subject: Re: [RFC PATCH 3/4] emacs: add notmuch hello refresh hook to display
\r
44 message count change
\r
46 <c2449d9a081e5f013da4349368f4be291d03724e.1334651669.git.jani@nikula.org>
\r
48 <bcfdc0d1969997e89e5abe0b320d77ee2109796a.1334651669.git.jani@nikula.org>
\r
49 <c2449d9a081e5f013da4349368f4be291d03724e.1334651669.git.jani@nikula.org>
\r
50 User-Agent: Notmuch/0.12+104~gf9ad237 (http://notmuchmail.org) Emacs/23.4.1
\r
51 (x86_64-pc-linux-gnu)
\r
52 Date: Tue, 17 Apr 2012 13:13:15 +0400
\r
53 Message-ID: <874nsioh5g.fsf@gmail.com>
\r
55 Content-Type: text/plain; charset=us-ascii
\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: Tue, 17 Apr 2012 09:15:12 -0000
\r
70 Jani Nikula <jani@nikula.org> writes:
\r
72 > Add a notmuch hello refresh hook to display a message about change in
\r
73 > message count in the database since the notmuch-hello buffer was last
\r
74 > refreshed manually (no-display is nil).
\r
76 I like this idea. But IMO we should avoid another call to notmuch
\r
77 count. Notmuch-hello buffer already displays the message count on the
\r
78 first line. I would propose to implement this functionality not as a
\r
79 hook but as part of the section which outputs the first line. We can
\r
80 add an option to disable it if you prefer but I do not think it is
\r
81 needed. This is less flexible than a hook, but IMO it is not a big
\r
88 > emacs/notmuch-hello.el | 23 +++++++++++++++++++++++
\r
89 > 1 files changed, 23 insertions(+), 0 deletions(-)
\r
91 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
92 > index 0596bbe..13da146 100644
\r
93 > --- a/emacs/notmuch-hello.el
\r
94 > +++ b/emacs/notmuch-hello.el
\r
95 > @@ -148,6 +148,7 @@ International Bureau of Weights and Measures."
\r
96 > (defcustom notmuch-hello-refresh-hook nil
\r
97 > "Functions called after updating a `notmuch-hello' buffer."
\r
99 > + :options '(notmuch-hello-refresh-status-message)
\r
100 > :group 'notmuch-hello
\r
101 > :group 'notmuch-hooks)
\r
103 > @@ -729,6 +730,28 @@ following:
\r
104 > (let ((fill-column (- (window-width) notmuch-hello-indent)))
\r
105 > (center-region start (point)))))
\r
107 > +(defvar notmuch-hello-refresh-count 0
\r
108 > + "Number of messages in the database when `notmuch-hello' was last run.
\r
110 > +Used internally by `notmuch-hello-refresh-status-message'.")
\r
112 > +(defun notmuch-hello-refresh-status-message (no-display)
\r
113 > + "Hook to display a status message when refreshing notmuch-hello buffer."
\r
114 > + (unless no-display
\r
115 > + (let* ((new-count
\r
116 > + (string-to-number (car (process-lines notmuch-command "count"))))
\r
117 > + (diff-count (- new-count notmuch-hello-refresh-count)))
\r
118 > + (if (= notmuch-hello-refresh-count 0)
\r
119 > + (message "You have %s messages."
\r
120 > + (notmuch-hello-nice-number new-count))
\r
121 > + (if (not (= diff-count 0))
\r
122 > + (if (>= diff-count 0)
\r
123 > + (message "You have %s more messages since last refresh."
\r
124 > + (notmuch-hello-nice-number diff-count))
\r
125 > + (message "You have %s fewer messages since last refresh."
\r
126 > + (notmuch-hello-nice-number (- diff-count))))))
\r
127 > + (setq notmuch-hello-refresh-count new-count))))
\r
130 > (defun notmuch-hello (&optional no-display)
\r
131 > "Run notmuch and display saved searches, known tags, etc."
\r
135 > _______________________________________________
\r
136 > notmuch mailing list
\r
137 > notmuch@notmuchmail.org
\r
138 > http://notmuchmail.org/mailman/listinfo/notmuch
\r