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 2C1A0431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 02:45:24 -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 4Z-GpKARgmIN for <notmuch@notmuchmail.org>;
\r
17 Tue, 17 Apr 2012 02:45:20 -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 16AB1431FAE
\r
22 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 02:45:19 -0700 (PDT)
\r
23 Received: by lahc1 with SMTP id c1so4783588lah.26
\r
24 for <notmuch@notmuchmail.org>; Tue, 17 Apr 2012 02:45:18 -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=UNvkLiMfVtnWdjYrEglmE1YKerzn6wCJlBOAChpyl5w=;
\r
29 b=sdlsSzS0WDvf62rcNx/h/52UWHqEghcWMiK0LVwsXS514aD+xaJw1Bw2GrurBituFR
\r
30 f1F6nvlkzy8xtIohAF31S2HoRWKfZv/5y69D5gHTohaj/0dCc1K/J3sMHy5vccOUoKNl
\r
31 KBMMgiL/KYemjnNECnx5VAiBa+pRegLXChzS2ObmkS2fF/SqbXNZ4y8XE4wCjbFed0Bv
\r
32 9UUz4J4669Ute9A08i78kO4ghJqUk4toASYLnpHOOh4eBFQwoRjgUVKM919IWdwXeRwO
\r
33 r7IUOoMiZDWzFzpu5DMrErMZquWwdtYa/H1OPqUnjfdC5iiyr/2RORc3D0NcQo8Zqx+H
\r
35 Received: by 10.112.48.36 with SMTP id i4mr6900644lbn.84.1334655918454;
\r
36 Tue, 17 Apr 2012 02:45:18 -0700 (PDT)
\r
37 Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id
\r
38 gw17sm22284179lab.11.2012.04.17.02.45.17
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Tue, 17 Apr 2012 02:45:17 -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
45 In-Reply-To: <87ehrmvgyn.fsf@nikula.org>
\r
47 <bcfdc0d1969997e89e5abe0b320d77ee2109796a.1334651669.git.jani@nikula.org>
\r
48 <c2449d9a081e5f013da4349368f4be291d03724e.1334651669.git.jani@nikula.org>
\r
49 <874nsioh5g.fsf@gmail.com> <87ehrmvgyn.fsf@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:43:28 +0400
\r
53 Message-ID: <87vckyn16n.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:45:24 -0000
\r
70 Jani Nikula <jani@nikula.org> writes:
\r
72 > On Tue, 17 Apr 2012 13:13:15 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
73 >> Jani Nikula <jani@nikula.org> writes:
\r
75 >> > Add a notmuch hello refresh hook to display a message about change in
\r
76 >> > message count in the database since the notmuch-hello buffer was last
\r
77 >> > refreshed manually (no-display is nil).
\r
79 >> I like this idea. But IMO we should avoid another call to notmuch
\r
80 >> count. Notmuch-hello buffer already displays the message count on the
\r
81 >> first line. I would propose to implement this functionality not as a
\r
82 >> hook but as part of the section which outputs the first line. We can
\r
83 >> add an option to disable it if you prefer but I do not think it is
\r
84 >> needed. This is less flexible than a hook, but IMO it is not a big
\r
87 > And what if someone has disabled the header section but would want the
\r
90 Well, that is what I meant by "less flexible than a hook".
\r
92 > Also, you'd have to pass no-display there too.
\r
94 Sure, we can pass it to sections.
\r
97 > notmuch count is not a big issue, especially for an optional feature.
\r
98 > And having it as a hook very nicely isolates the feature from everything
\r
102 I think this feature should be enabled by default.
\r
104 I guess you are right that it is not a big issue. I still think we
\r
105 would be better without it (and we still can isolate the feature), but I
\r
106 would not object to having the extra call.
\r
119 >> > emacs/notmuch-hello.el | 23 +++++++++++++++++++++++
\r
120 >> > 1 files changed, 23 insertions(+), 0 deletions(-)
\r
122 >> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
123 >> > index 0596bbe..13da146 100644
\r
124 >> > --- a/emacs/notmuch-hello.el
\r
125 >> > +++ b/emacs/notmuch-hello.el
\r
126 >> > @@ -148,6 +148,7 @@ International Bureau of Weights and Measures."
\r
127 >> > (defcustom notmuch-hello-refresh-hook nil
\r
128 >> > "Functions called after updating a `notmuch-hello' buffer."
\r
130 >> > + :options '(notmuch-hello-refresh-status-message)
\r
131 >> > :group 'notmuch-hello
\r
132 >> > :group 'notmuch-hooks)
\r
134 >> > @@ -729,6 +730,28 @@ following:
\r
135 >> > (let ((fill-column (- (window-width) notmuch-hello-indent)))
\r
136 >> > (center-region start (point)))))
\r
138 >> > +(defvar notmuch-hello-refresh-count 0
\r
139 >> > + "Number of messages in the database when `notmuch-hello' was last run.
\r
141 >> > +Used internally by `notmuch-hello-refresh-status-message'.")
\r
143 >> > +(defun notmuch-hello-refresh-status-message (no-display)
\r
144 >> > + "Hook to display a status message when refreshing notmuch-hello buffer."
\r
145 >> > + (unless no-display
\r
146 >> > + (let* ((new-count
\r
147 >> > + (string-to-number (car (process-lines notmuch-command "count"))))
\r
148 >> > + (diff-count (- new-count notmuch-hello-refresh-count)))
\r
149 >> > + (if (= notmuch-hello-refresh-count 0)
\r
150 >> > + (message "You have %s messages."
\r
151 >> > + (notmuch-hello-nice-number new-count))
\r
152 >> > + (if (not (= diff-count 0))
\r
153 >> > + (if (>= diff-count 0)
\r
154 >> > + (message "You have %s more messages since last refresh."
\r
155 >> > + (notmuch-hello-nice-number diff-count))
\r
156 >> > + (message "You have %s fewer messages since last refresh."
\r
157 >> > + (notmuch-hello-nice-number (- diff-count))))))
\r
158 >> > + (setq notmuch-hello-refresh-count new-count))))
\r
160 >> > ;;;###autoload
\r
161 >> > (defun notmuch-hello (&optional no-display)
\r
162 >> > "Run notmuch and display saved searches, known tags, etc."
\r
166 >> > _______________________________________________
\r
167 >> > notmuch mailing list
\r
168 >> > notmuch@notmuchmail.org
\r
169 >> > http://notmuchmail.org/mailman/listinfo/notmuch
\r