1 Return-Path: <dme@dme.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 BF2D6431FD0
\r
6 for <notmuch@notmuchmail.org>; Tue, 10 Jan 2012 02:15:34 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 4QlGiRnYjAFK for <notmuch@notmuchmail.org>;
\r
16 Tue, 10 Jan 2012 02:15:34 -0800 (PST)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 18592431FB6 for <notmuch@notmuchmail.org>; Tue, 10 Jan 2012 02:15:33 -0800
\r
22 Received: by wgbds11 with SMTP id ds11so2349741wgb.2
\r
23 for <notmuch@notmuchmail.org>; Tue, 10 Jan 2012 02:15:32 -0800 (PST)
\r
24 Received: by 10.180.106.165 with SMTP id gv5mr33342887wib.18.1326190532661;
\r
25 Tue, 10 Jan 2012 02:15:32 -0800 (PST)
\r
26 Received: from hotblack-desiato.hh.sledj.net
\r
27 (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])
\r
28 by mx.google.com with ESMTPS id y5sm907043wiw.3.2012.01.10.02.15.31
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Tue, 10 Jan 2012 02:15:31 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 0E0339FE69; Tue, 10 Jan 2012 10:15:30 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH] emacs: Improve `notmuch-hello' display on ttys.
\r
36 Date: Tue, 10 Jan 2012 10:15:28 +0000
\r
37 Message-Id: <1326190528-3548-1-git-send-email-dme@dme.org>
\r
38 X-Mailer: git-send-email 1.7.7.3
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Tue, 10 Jan 2012 10:15:34 -0000
\r
53 Inserting spaces to pad out columns is good, except when the padding
\r
54 makes the line wider than the window. This looks particularly bad on a
\r
55 tty where there is no fringe.
\r
57 Hence, avoid padding the last column on each row.
\r
60 Thanks to j4ni in #notmuch for spotting this.
\r
62 emacs/notmuch-hello.el | 20 +++++++++++---------
\r
63 1 files changed, 11 insertions(+), 9 deletions(-)
\r
65 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
66 index 333d4c1..02017ce 100644
\r
67 --- a/emacs/notmuch-hello.el
\r
68 +++ b/emacs/notmuch-hello.el
\r
69 @@ -299,15 +299,17 @@ should be. Returns a cons cell `(tags-per-line width)'."
\r
70 :notify #'notmuch-hello-widget-search
\r
71 :notmuch-search-terms query
\r
73 - ;; Insert enough space to consume the rest of the
\r
74 - ;; column. Because the button for the name is `(1+
\r
75 - ;; (length name))' long (due to the trailing space) we
\r
76 - ;; can just insert `(- widest (length name))' spaces -
\r
77 - ;; the column separator is included in the button if
\r
78 - ;; `(equal widest (length name)'.
\r
79 - (widget-insert (make-string (max 1
\r
80 - (- widest (length name)))
\r
82 + (unless (eq (% count tags-per-line) (1- tags-per-line))
\r
83 + ;; If this is not the last tag on the line, insert
\r
84 + ;; enough space to consume the rest of the column.
\r
85 + ;; Because the button for the name is `(1+ (length
\r
86 + ;; name))' long (due to the trailing space) we can
\r
87 + ;; just insert `(- widest (length name))' spaces - the
\r
88 + ;; column separator is included in the button if
\r
89 + ;; `(equal widest (length name)'.
\r
90 + (widget-insert (make-string (max 1
\r
91 + (- widest (length name)))
\r
93 (setq count (1+ count))
\r
94 (if (eq (% count tags-per-line) 0)
\r
95 (widget-insert "\n")))
\r