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 82D2D40AB25
\r
6 for <notmuch@notmuchmail.org>; Wed, 19 May 2010 01:55:14 -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, RCVD_IN_DNSWL_NONE=-0.0001] 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 WmaeLOwLXszv for <notmuch@notmuchmail.org>;
\r
16 Wed, 19 May 2010 01:55:00 -0700 (PDT)
\r
17 Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id 0EABE409DF7
\r
20 for <notmuch@notmuchmail.org>; Wed, 19 May 2010 01:53:48 -0700 (PDT)
\r
21 Received: by mail-ew0-f213.google.com with SMTP id 5so1814158ewy.0
\r
22 for <notmuch@notmuchmail.org>; Wed, 19 May 2010 01:53:48 -0700 (PDT)
\r
23 Received: by 10.213.55.76 with SMTP id t12mr3285630ebg.3.1274259228640;
\r
24 Wed, 19 May 2010 01:53:48 -0700 (PDT)
\r
25 Received: from ut.hh.sledj.net (host83-217-165-81.dsl.vispa.com
\r
27 by mx.google.com with ESMTPS id 16sm3523089ewy.3.2010.05.19.01.53.44
\r
28 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
29 Wed, 19 May 2010 01:53:45 -0700 (PDT)
\r
30 Received: by ut.hh.sledj.net (Postfix, from userid 1000)
\r
31 id E5EC65940A3; Wed, 19 May 2010 08:03:45 +0100 (BST)
\r
32 From: David Edmondson <dme@dme.org>
\r
33 To: notmuch@notmuchmail.org
\r
34 Subject: [PATCH 07/13] emacs: Allow tuning of the tag/saved search layout.
\r
35 Date: Wed, 19 May 2010 08:03:34 +0100
\r
36 Message-Id: <1274252620-1249-8-git-send-email-dme@dme.org>
\r
37 X-Mailer: git-send-email 1.7.1
\r
38 In-Reply-To: <1274252620-1249-1-git-send-email-dme@dme.org>
\r
39 References: <1274252620-1249-1-git-send-email-dme@dme.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Wed, 19 May 2010 08:55:14 -0000
\r
54 Add `notmuch-column-control', which has three potential sets of
\r
57 - t: automatically calculate the number of columns per line based on
\r
58 the tags to be shown and the window width,
\r
59 - an integer: a lower bound on the number of characters that will be
\r
60 used to display each column,
\r
61 - a float: a fraction of the window width that is the lower bound on
\r
62 the number of characters that should be used for each column.
\r
65 - if you would like two columns of tags, set this to 0.5.
\r
66 - if you would like a single column of tags, set this to 1.0.
\r
67 - if you would like tags to be 30 characters wide, set this to
\r
69 - if you don't want to worry about all of this nonsense, leave
\r
72 emacs/notmuch-hello.el | 63 +++++++++++++++++++++++++++++++++++++++++++----
\r
73 1 files changed, 57 insertions(+), 6 deletions(-)
\r
75 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
76 index 1358387..acf40bc 100644
\r
77 --- a/emacs/notmuch-hello.el
\r
78 +++ b/emacs/notmuch-hello.el
\r
80 "Background colour for the notmuch logo."
\r
83 +(defcustom notmuch-column-control t
\r
84 + "Controls the number of columns for saved searches/tags in notmuch view.
\r
86 +This variable has three potential sets of values:
\r
88 +- t: automatically calculate the number of columns possible based
\r
89 + on the tags to be shown and the window width,
\r
90 +- an integer: a lower bound on the number of characters that will
\r
91 + be used to display each column,
\r
92 +- a float: a fraction of the window width that is the lower bound
\r
93 + on the number of characters that should be used for each
\r
97 +- if you would like two columns of tags, set this to 0.5.
\r
98 +- if you would like a single column of tags, set this to 1.0.
\r
99 +- if you would like tags to be 30 characters wide, set this to
\r
101 +- if you don't want to worry about all of this nonsense, leave
\r
102 + this set to `t'."
\r
105 + (const :tag "Automatically calculated" t)
\r
106 + (integer :tag "Number of characters")
\r
107 + (float :tag "Fraction of window")))
\r
109 (defvar notmuch-hello-url "http://notmuchmail.org"
\r
110 "The `notmuch' web site.")
\r
112 @@ -146,13 +172,38 @@ diagonal."
\r
113 (defun notmuch-saved-search-count (search)
\r
114 (car (process-lines notmuch-command "count" search)))
\r
116 +(defun notmuch-hello-tags-per-line (widest)
\r
117 + "Determine how many tags to show per line and how wide they
\r
118 +should be. Returns a cons cell `(tags-per-line width)'."
\r
119 + (let ((tags-per-line
\r
121 + ((integerp notmuch-column-control)
\r
123 + (/ (- (window-width) notmuch-hello-indent)
\r
124 + ;; Count is 7 wide (6 digits plus space), 1 for the space
\r
125 + ;; after the name.
\r
126 + (+ 7 1 (max notmuch-column-control widest)))))
\r
128 + ((floatp notmuch-column-control)
\r
129 + (let* ((available-width (- (window-width) notmuch-hello-indent))
\r
130 + (proposed-width (max (* available-width notmuch-column-control) widest)))
\r
131 + (floor available-width proposed-width)))
\r
135 + (/ (- (window-width) notmuch-hello-indent)
\r
136 + ;; Count is 7 wide (6 digits plus space), 1 for the space
\r
137 + ;; after the name.
\r
138 + (+ 7 1 widest)))))))
\r
140 + (cons tags-per-line (/ (- (window-width) notmuch-hello-indent
\r
141 + (* tags-per-line (+ 7 1)))
\r
142 + tags-per-line))))
\r
144 (defun notmuch-hello-insert-tags (tag-alist widest target)
\r
145 - (let* ((tags-per-line (max 1
\r
146 - (/ (- (window-width) notmuch-hello-indent)
\r
147 - ;; Count is 7 wide (6 digits plus
\r
148 - ;; space), 1 for the space after the
\r
150 - (+ 7 1 widest))))
\r
151 + (let* ((tags-and-width (notmuch-hello-tags-per-line widest))
\r
152 + (tags-per-line (car tags-and-width))
\r
153 + (widest (cdr tags-and-width))
\r
155 (reordered-list (notmuch-hello-reflect tag-alist tags-per-line))
\r
156 ;; Hack the display of the buttons used.
\r