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 8B02C4196F0
\r
6 for <notmuch@notmuchmail.org>; Tue, 27 Apr 2010 00:00:38 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9] autolearn=ham
\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 XMxjARX42NHx for <notmuch@notmuchmail.org>;
\r
16 Tue, 27 Apr 2010 00:00:36 -0700 (PDT)
\r
17 Received: from mail-ww0-f53.google.com (mail-ww0-f53.google.com
\r
18 [74.125.82.53]) by olra.theworths.org (Postfix) with ESMTP id 5F381431FC1 for
\r
19 <notmuch@notmuchmail.org>; Tue, 27 Apr 2010 00:00:36 -0700 (PDT)
\r
20 Received: by wwi18 with SMTP id 18so984078wwi.26
\r
21 for <notmuch@notmuchmail.org>; Tue, 27 Apr 2010 00:00:35 -0700 (PDT)
\r
22 Received: by 10.216.187.142 with SMTP id y14mr3849386wem.114.1272351634997;
\r
23 Tue, 27 Apr 2010 00:00:34 -0700 (PDT)
\r
24 Received: from ut.hh.sledj.net (host83-217-165-81.dsl.vispa.com
\r
26 by mx.google.com with ESMTPS id z3sm5053974wbs.22.2010.04.27.00.00.33
\r
27 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
28 Tue, 27 Apr 2010 00:00:34 -0700 (PDT)
\r
29 Received: by ut.hh.sledj.net (Postfix, from userid 1000)
\r
30 id 07CB059413B; Tue, 27 Apr 2010 08:00:46 +0100 (BST)
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH] emacs: Fix column alignment in `notmuch-hello-insert-tags'
\r
34 Date: Tue, 27 Apr 2010 08:00:44 +0100
\r
35 Message-Id: <1272351644-11843-1-git-send-email-dme@dme.org>
\r
36 X-Mailer: git-send-email 1.7.0
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Tue, 27 Apr 2010 07:00:38 -0000
\r
51 From: David Edmondson <dme@dme.org>
\r
53 Re-working the saved search/tag insertion to buttonize only the name
\r
54 of the saved search/tag plus one space broke the calculation of how
\r
55 much filler is required to complete the column, resulting in lines
\r
56 wider than the window.
\r
58 emacs/notmuch-hello.el | 44 +++++++++++++++++++++++++++-----------------
\r
59 1 files changed, 27 insertions(+), 17 deletions(-)
\r
61 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
62 index cbe414f..50d8911 100644
\r
63 --- a/emacs/notmuch-hello.el
\r
64 +++ b/emacs/notmuch-hello.el
\r
65 @@ -148,8 +148,9 @@ diagonal."
\r
66 (defun notmuch-hello-insert-tags (tag-alist widest target)
\r
67 (let* ((tags-per-line (max 1
\r
68 (/ (- (window-width) notmuch-hello-indent)
\r
69 - ;; Count is 7 wide, 1 for the space
\r
70 - ;; after the name.
\r
71 + ;; Count is 7 wide (6 digits plus
\r
72 + ;; space), 1 for the space after the
\r
76 (reordered-list (notmuch-hello-reflect tag-alist tags-per-line))
\r
77 @@ -159,21 +160,30 @@ diagonal."
\r
78 (found-target-pos nil))
\r
79 ;; dme: It feels as though there should be a better way to
\r
80 ;; implement this loop than using an incrementing counter.
\r
81 - (loop for elem in reordered-list
\r
83 - ;; (not elem) indicates an empty slot in the matrix.
\r
85 - (widget-insert (format "%6s " (notmuch-saved-search-count (cdr elem))))
\r
86 - (if (string= (format "%s " (car elem)) target)
\r
87 - (setq found-target-pos (point-marker)))
\r
88 - (widget-create 'push-button
\r
89 - :notify #'notmuch-hello-widget-search
\r
90 - :notmuch-search-terms (cdr elem)
\r
91 - (format "%s " (car elem)))
\r
92 - (insert (make-string (1+ (- widest (length (car elem)))) ? )))
\r
93 - (setq count (1+ count))
\r
94 - (if (eq (% count tags-per-line) 0)
\r
95 - (widget-insert "\n"))))
\r
96 + (mapc (lambda (elem)
\r
97 + ;; (not elem) indicates an empty slot in the matrix.
\r
99 + (let* ((name (car elem))
\r
100 + (query (cdr elem))
\r
101 + (formatted-name (format "%s " name)))
\r
102 + (widget-insert (format "%6s " (notmuch-saved-search-count query)))
\r
103 + (if (string= formatted-name target)
\r
104 + (setq found-target-pos (point-marker)))
\r
105 + (widget-create 'push-button
\r
106 + :notify #'notmuch-hello-widget-search
\r
107 + :notmuch-search-terms query
\r
109 + ;; Insert enough space to consume the rest of the
\r
110 + ;; column. Because the button for the name is `(1+
\r
111 + ;; (length name))' long (due to the trailing space) we
\r
112 + ;; can just insert `(- widest (length name))' spaces -
\r
113 + ;; the column separator is included in the button if
\r
114 + ;; `(equal widest (length name)'.
\r
115 + (widget-insert (make-string (- widest (length name)) ? )))
\r
116 + (setq count (1+ count))
\r
117 + (if (eq (% count tags-per-line) 0)
\r
118 + (widget-insert "\n"))))
\r
121 ;; If the last line was not full (and hence did not include a
\r
122 ;; carriage return), insert one now.
\r