Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 25 / 8c85424978bffc9f1271621bc3bdd3d0e3ee38
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 9A732429E21\r
6         for <notmuch@notmuchmail.org>; Mon, 28 Nov 2011 13:27:05 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \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 AVNz-szc1JT5 for <notmuch@notmuchmail.org>;\r
17         Mon, 28 Nov 2011 13:27:05 -0800 (PST)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.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 AB29B431FB6\r
22         for <notmuch@notmuchmail.org>; Mon, 28 Nov 2011 13:27:04 -0800 (PST)\r
23 Received: by bkaq10 with SMTP id q10so9895992bka.26\r
24         for <notmuch@notmuchmail.org>; Mon, 28 Nov 2011 13:27:03 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=2yaUzdeNCA540rFFVgy0gE9WE1AjXXJRbSCoEDjx8Rc=;\r
29         b=o+2vGCcqej1lI7Yi5UXS/oV+BC8wVxzmoDv/1x401rifJ5hD8QzEbcFzzDtRjEkbs+\r
30         gpAWM20XZCunZ3zz4jnbXnKGGyfnSRR0i1p4YDMlVzNWI602kg5P1yEHrbB7TtMLWTYU\r
31         iU2sLihJBB2xBPwGzXE4GyRF1J+T8kBpo47no=\r
32 Received: by 10.204.141.2 with SMTP id k2mr44756041bku.81.1322515623220;\r
33         Mon, 28 Nov 2011 13:27:03 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id c4sm32384414bkk.13.2011.11.28.13.27.02\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Mon, 28 Nov 2011 13:27:02 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH 1/3] test: add functions to count how much times notmuch\r
41         was called\r
42 In-Reply-To: <yf6aa7gj7w5.fsf@taco2.nixu.fi>\r
43 References: <1322271878-32614-1-git-send-email-dmitry.kurochkin@gmail.com>\r
44         <1322450895-32523-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45         <1322450895-32523-2-git-send-email-dmitry.kurochkin@gmail.com>\r
46         <yf6aa7gj7w5.fsf@taco2.nixu.fi>\r
47 User-Agent: Notmuch/0.10+44~g067c44f (http://notmuchmail.org) Emacs/23.3.1\r
48         (x86_64-pc-linux-gnu)\r
49 Date: Tue, 29 Nov 2011 01:26:39 +0400\r
50 Message-ID: <87hb1ovsz4.fsf@gmail.com>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=us-ascii\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Mon, 28 Nov 2011 21:27:05 -0000\r
66 \r
67 Hi Tomi.\r
68 \r
69 On Mon, 28 Nov 2011 22:42:50 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
70 > On Mon, 28 Nov 2011 07:28:13 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
71\r
72 > [...]\r
73 > > +\r
74 > > +    These allow to count how many times notmuch binary is called.\r
75 > > +    notmuch_counter_reset() function generates a script that counts\r
76 > > +    how many times it is called and resets the counter to zero.  The\r
77 > > +    function sets $notmuch_counter_command variable to the path to the\r
78 > > +    generated script that should be called instead of notmuch to do\r
79 > > +    the counting.  The notmuch_counter_value() function prints the\r
80 > > +    current counter value.\r
81 > > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
82 > > index 076f929..880bed9 100644\r
83 > > --- a/test/test-lib.sh\r
84 > > +++ b/test/test-lib.sh\r
85 > > @@ -868,6 +868,38 @@ test_emacs () {\r
86 > >     emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
87 > >  }\r
88 > >  \r
89 > > +# Creates a script that counts how much time it is executed and calls\r
90 > > +# notmuch.  $notmuch_counter_command is set to the path to the\r
91 > > +# generated script.  Use notmuch_counter_value() function to get the\r
92 > > +# current counter value.\r
93 > > +notmuch_counter_reset () {\r
94 > > +   notmuch_counter_command="$TMP_DIRECTORY/notmuch_counter"\r
95 > > +   if [ ! -x "$notmuch_counter_command" ]; then\r
96 > > +           notmuch_counter_state_path="$TMP_DIRECTORY/notmuch_counter.state"\r
97 > > +           cat >"$notmuch_counter_command" <<EOF || return\r
98 > > +#!/bin/sh\r
99 > > +\r
100 > > +count=\$(cat "$notmuch_counter_state_path")\r
101 > > +echo -n \$(expr \$count + 1) > "$notmuch_counter_state_path"\r
102 > > +\r
103 > > +exec notmuch "\$@"\r
104 > > +EOF\r
105 > > +           chmod +x "$notmuch_counter_command" || return\r
106 > > +   fi\r
107 > > +\r
108 > > +   echo -n 0 > "$notmuch_counter_state_path"\r
109 > > +}\r
110 > > +\r
111 > > +# Returns the current notmuch counter value.\r
112 > > +notmuch_counter_value () {\r
113 > > +   if [ -r "$notmuch_counter_state_path" ]; then\r
114 > > +           count=$(cat "$notmuch_counter_state_path")\r
115 > > +   else\r
116 > > +           count=0\r
117 > > +   fi\r
118 > > +   echo -n $count\r
119 > > +}\r
120 > > +\r
121\r
122 > Good work! It would be nice if the state file contained newline after\r
123 > count number.\r
124 \r
125 I wonder why it is actually nice :)  I do not have strong preference\r
126 here.  So a newline is added in v3.  Also a newline is added to\r
127 notmuch_counter_value() output for consistency.\r
128 \r
129 > Also some optimizations could be done:\r
130\r
131 \r
132 (Would be nice if you send a diff, or a human-friendly description of\r
133 the changes.)\r
134 \r
135 >               cat >"$notmuch_counter_command" <<EOF || return\r
136 > #!/bin/sh\r
137\r
138 > read count < "$notmuch_counter_state_path"\r
139 \r
140 Nice.  Fixed in the new patch version.\r
141 \r
142 > echo \$((count + 1)) > "$notmuch_counter_state_path"\r
143\r
144 \r
145 I do not think this is really an optimization.  And I find expr more\r
146 clear than using $(()).  I always have troubles remembering "random\r
147 special char syntax" (yeah, not a Perl fan :)), prefer human friendly\r
148 words.\r
149 \r
150 > exec notmuch "\$@"\r
151 > EOF\r
152 >               chmod +x "$notmuch_counter_command" || return\r
153 >       fi\r
154\r
155 >       echo 0 > "$notmuch_counter_state_path"\r
156 > }\r
157\r
158 > # Returns the current notmuch counter value.\r
159 > notmuch_counter_value () {\r
160 >       if [ -r "$notmuch_counter_state_path" ]; then\r
161 >               read count < "$notmuch_counter_state_path"\r
162 \r
163 Also changes in v3.\r
164 \r
165 Regards,\r
166   Dmitry\r
167 \r
168 >       else\r
169 >               count=0\r
170 >       fi\r
171 >       echo -n $count\r
172 > }\r
173\r
174\r
175 > Tomi\r