Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / 6f / 8610aa9d9f7f54c07bddd0fd7d503af1ac0782
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 C1280431FC3\r
6         for <notmuch@notmuchmail.org>; Fri,  9 Mar 2012 19:55:50 -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 yT1GOGbn8Qf6 for <notmuch@notmuchmail.org>;\r
17         Fri,  9 Mar 2012 19:55:49 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-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 A2CC7431FAE\r
22         for <notmuch@notmuchmail.org>; Fri,  9 Mar 2012 19:55:47 -0800 (PST)\r
23 Received: by bkwj4 with SMTP id j4so1840558bkw.26\r
24         for <notmuch@notmuchmail.org>; Fri, 09 Mar 2012 19:55:46 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:subject:date:message-id:x-mailer;\r
27         bh=fjq0DEuj2IDjFzIckUJomvNc7eDKMMCy7JL0pTMP93w=;\r
28         b=p6ZZQzigXwD/gc8Qx41pqiIb5U3OE5lcSAIih8JN23gWnCshKk8VUf0c1NBCkpdMSh\r
29         i1Uok9pbim7EkfHVrHehxoLmK437PCiHsmg8YbpN0FuEjmiyJv0T/lljr0cUDqXMDCOb\r
30         r4gAIRlQXZZa3JWtz1zsdFc52AgS0NzzpO1ncdGHPXtcMQD9VfcEFP3d1i3/7NgS1wce\r
31         x0Bap5SE9aC9oXgP2PpeeZd1UivCyQbKWXcYP1T6z6Mv81N1bUbezCZsWRrVT1E5xBNh\r
32         nZETy2s1C3EtfGYGU8uDO0VWweZPP8xXPL+TkCLO2UhIIieNotDjfaZytLsJ65Z98rJg\r
33         x9Nw==\r
34 Received: by 10.205.136.12 with SMTP id ii12mr1804042bkc.98.1331351746398;\r
35         Fri, 09 Mar 2012 19:55:46 -0800 (PST)\r
36 Received: from localhost ([91.144.186.21])\r
37         by mx.google.com with ESMTPS id d5sm12542132bkb.3.2012.03.09.19.55.45\r
38         (version=TLSv1/SSLv3 cipher=OTHER);\r
39         Fri, 09 Mar 2012 19:55:45 -0800 (PST)\r
40 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
41 To: notmuch@notmuchmail.org\r
42 Subject: [PATCH] emacs: get rid of trailing spaces in notmuch-hello view\r
43 Date: Sat, 10 Mar 2012 07:54:15 +0400\r
44 Message-Id: <1331351655-16921-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45 X-Mailer: git-send-email 1.7.9.1\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Sat, 10 Mar 2012 03:55:51 -0000\r
59 \r
60 This patch removes trailing spaces in notmuch-hello view.\r
61 \r
62 A side effect of this change is that tag/query buttons no longer\r
63 include a space at the end.  This means that pressing RET when the\r
64 point is at the first character after the tag/query button no longer\r
65 works (note that this is the standard behavior for buttons).  We may\r
66 change this behavior in the future (without adding trailing spaces\r
67 back) if people would find this change inconvenient.\r
68 ---\r
69  emacs/notmuch-hello.el                             |   30 ++++++++------------\r
70  test/emacs                                         |    2 +-\r
71  test/emacs.expected-output/notmuch-hello           |    2 +-\r
72  .../emacs.expected-output/notmuch-hello-long-names |    6 ++--\r
73  .../notmuch-hello-new-section                      |    2 +-\r
74  .../notmuch-hello-section-counts                   |    4 +-\r
75  .../notmuch-hello-section-hidden-tag               |    2 +-\r
76  .../notmuch-hello-section-with-empty               |    2 +-\r
77  .../emacs.expected-output/notmuch-hello-with-empty |    2 +-\r
78  9 files changed, 23 insertions(+), 29 deletions(-)\r
79 \r
80 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
81 index 28f39f1..17f7edd 100644\r
82 --- a/emacs/notmuch-hello.el\r
83 +++ b/emacs/notmuch-hello.el\r
84 @@ -429,7 +429,8 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
85    (let* ((widest (notmuch-hello-longest-label searches))\r
86          (tags-and-width (notmuch-hello-tags-per-line widest))\r
87          (tags-per-line (car tags-and-width))\r
88 -        (widest (cdr tags-and-width))\r
89 +        (column-width (cdr tags-and-width))\r
90 +        (column-indent 0)\r
91          (count 0)\r
92          (reordered-list (notmuch-hello-reflect searches tags-per-line))\r
93          ;; Hack the display of the buttons used.\r
94 @@ -441,32 +442,25 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
95      (mapc (lambda (elem)\r
96             ;; (not elem) indicates an empty slot in the matrix.\r
97             (when elem\r
98 +             (if (> column-indent 0)\r
99 +                 (widget-insert (make-string column-indent ? )))\r
100               (let* ((name (first elem))\r
101                      (query (second elem))\r
102 -                    (msg-count (third elem))\r
103 -                    (formatted-name (format "%s " name)))\r
104 +                    (msg-count (third elem)))\r
105                 (widget-insert (format "%8s "\r
106                                        (notmuch-hello-nice-number msg-count)))\r
107 -               (if (string= formatted-name notmuch-hello-target)\r
108 +               (if (string= name notmuch-hello-target)\r
109                     (setq found-target-pos (point-marker)))\r
110                 (widget-create 'push-button\r
111                                :notify #'notmuch-hello-widget-search\r
112                                :notmuch-search-terms query\r
113 -                              formatted-name)\r
114 -               (unless (eq (% count tags-per-line) (1- tags-per-line))\r
115 -                 ;; If this is not the last tag on the line, insert\r
116 -                 ;; enough space to consume the rest of the column.\r
117 -                 ;; Because the button for the name is `(1+ (length\r
118 -                 ;; name))' long (due to the trailing space) we can\r
119 -                 ;; just insert `(- widest (length name))' spaces - the\r
120 -                 ;; column separator is included in the button if\r
121 -                 ;; `(equal widest (length name)'.\r
122 -                 (widget-insert (make-string (max 0\r
123 -                                                  (- widest (length name)))\r
124 -                                             ? )))))\r
125 +                              name)\r
126 +               (setq column-indent\r
127 +                     (1+ (max 0 (- column-width (length name)))))))\r
128             (setq count (1+ count))\r
129 -           (if (eq (% count tags-per-line) 0)\r
130 -               (widget-insert "\n")))\r
131 +           (when (eq (% count tags-per-line) 0)\r
132 +             (setq column-indent 0)\r
133 +             (widget-insert "\n")))\r
134           reordered-list)\r
135  \r
136      ;; If the last line was not full (and hence did not include a\r
137 diff --git a/test/emacs b/test/emacs\r
138 index 29a489c..42780af 100755\r
139 --- a/test/emacs\r
140 +++ b/test/emacs\r
141 @@ -39,7 +39,7 @@ test_begin_subtest "Navigation of notmuch-hello to search results"\r
142  test_emacs '(notmuch-hello)\r
143             (goto-char (point-min))\r
144             (re-search-forward "inbox")\r
145 -           (widget-button-press (point))\r
146 +           (widget-button-press (1- (point)))\r
147             (notmuch-test-wait)\r
148             (test-output)'\r
149  test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox\r
150 diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello\r
151 index 1470790..2d69891 100644\r
152 --- a/test/emacs.expected-output/notmuch-hello\r
153 +++ b/test/emacs.expected-output/notmuch-hello\r
154 @@ -2,7 +2,7 @@\r
155  \r
156  Saved searches: [edit]\r
157  \r
158 -         52 inbox           52 unread    \r
159 +         52 inbox           52 unread\r
160  \r
161  Search:                                                                     .\r
162  \r
163 diff --git a/test/emacs.expected-output/notmuch-hello-long-names b/test/emacs.expected-output/notmuch-hello-long-names\r
164 index be6d2c5..486d0d9 100644\r
165 --- a/test/emacs.expected-output/notmuch-hello-long-names\r
166 +++ b/test/emacs.expected-output/notmuch-hello-long-names\r
167 @@ -2,14 +2,14 @@\r
168  \r
169  Saved searches: [edit]\r
170  \r
171 -         52 inbox           52 unread    \r
172 +         52 inbox           52 unread\r
173  \r
174  Search:                                                                     .\r
175  \r
176  All tags: [hide]\r
177  \r
178 -         52 a-very-long-tag       52 inbox                 52 unread \r
179 -          4 attachment             7 signed          \r
180 +         52 a-very-long-tag       52 inbox                 52 unread\r
181 +          4 attachment             7 signed\r
182  \r
183          Type a search query and hit RET to view matching threads.\r
184                 Edit saved searches with the `edit' button.\r
185 diff --git a/test/emacs.expected-output/notmuch-hello-new-section b/test/emacs.expected-output/notmuch-hello-new-section\r
186 index 6a339aa..67fdef2 100644\r
187 --- a/test/emacs.expected-output/notmuch-hello-new-section\r
188 +++ b/test/emacs.expected-output/notmuch-hello-new-section\r
189 @@ -1,4 +1,4 @@\r
190  Test: [hide]\r
191  \r
192 -         52 inbox \r
193 +         52 inbox\r
194  \r
195 diff --git a/test/emacs.expected-output/notmuch-hello-section-counts b/test/emacs.expected-output/notmuch-hello-section-counts\r
196 index 9d79659..7a9827c 100644\r
197 --- a/test/emacs.expected-output/notmuch-hello-section-counts\r
198 +++ b/test/emacs.expected-output/notmuch-hello-section-counts\r
199 @@ -1,5 +1,5 @@\r
200  Test-with-counts: [hide]\r
201  \r
202 -          2 attachment             7 signed          \r
203 -          7 inbox                  7 unread          \r
204 +          2 attachment             7 signed\r
205 +          7 inbox                  7 unread\r
206  \r
207 diff --git a/test/emacs.expected-output/notmuch-hello-section-hidden-tag b/test/emacs.expected-output/notmuch-hello-section-hidden-tag\r
208 index 3688e7c..809a114 100644\r
209 --- a/test/emacs.expected-output/notmuch-hello-section-hidden-tag\r
210 +++ b/test/emacs.expected-output/notmuch-hello-section-hidden-tag\r
211 @@ -1,4 +1,4 @@\r
212  Test-with-filtered: [hide]\r
213  \r
214 -          4 attachment            52 inbox                  7 signed \r
215 +          4 attachment            52 inbox                  7 signed\r
216  \r
217 diff --git a/test/emacs.expected-output/notmuch-hello-section-with-empty b/test/emacs.expected-output/notmuch-hello-section-with-empty\r
218 index dc2568d..5c67317 100644\r
219 --- a/test/emacs.expected-output/notmuch-hello-section-with-empty\r
220 +++ b/test/emacs.expected-output/notmuch-hello-section-with-empty\r
221 @@ -1,4 +1,4 @@\r
222  Test-with-empty: [hide]\r
223  \r
224 -         52 inbox \r
225 +         52 inbox\r
226  \r
227 diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty\r
228 index 5e53222..854e0c2 100644\r
229 --- a/test/emacs.expected-output/notmuch-hello-with-empty\r
230 +++ b/test/emacs.expected-output/notmuch-hello-with-empty\r
231 @@ -2,7 +2,7 @@\r
232  \r
233  Saved searches: [edit]\r
234  \r
235 -         52 inbox           52 unread           0 empty     \r
236 +         52 inbox           52 unread           0 empty\r
237  \r
238  Search:                                                                     .\r
239  \r
240 -- \r
241 1.7.9.1\r
242 \r