Re: [PATCH] Fix typo in Message.maildir_flags_to_tags
[notmuch-archives.git] / bf / dbf10514fcf46848b151567fa9d9a1c9034d59
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 382184196F2\r
6         for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 03:24:17 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \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 aFasxxK5Q2C1 for <notmuch@notmuchmail.org>;\r
16         Fri, 23 Apr 2010 03:24:16 -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 4590B431FC1       for\r
19  <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 03:24:16 -0700 (PDT)\r
20 Received: by wwb28 with SMTP id 28so2887942wwb.26\r
21         for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 03:24:15 -0700 (PDT)\r
22 Received: by 10.216.157.145 with SMTP id o17mr8066609wek.125.1272018255026;\r
23         Fri, 23 Apr 2010 03:24:15 -0700 (PDT)\r
24 Received: from ut.hh.sledj.net (gmp-ea-fw-1.sun.com [192.18.1.36])\r
25         by mx.google.com with ESMTPS id z34sm499609wbv.8.2010.04.23.03.24.13\r
26         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
27         Fri, 23 Apr 2010 03:24:14 -0700 (PDT)\r
28 Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
29         id 004E3594135; Fri, 23 Apr 2010 11:24:12 +0100 (BST)\r
30 From: David Edmondson <dme@dme.org>\r
31 To: notmuch@notmuchmail.org\r
32 Subject: [PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use\r
33         of `notmuch-search-result-format' accordingly\r
34 Date: Fri, 23 Apr 2010 11:24:09 +0100\r
35 Message-Id: <1272018249-10300-1-git-send-email-dme@dme.org>\r
36 X-Mailer: git-send-email 1.7.0\r
37 In-Reply-To: <87633jo2st.fsf@ut.hh.sledj.net>\r
38 References: <87633jo2st.fsf@ut.hh.sledj.net>\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\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: Fri, 23 Apr 2010 10:24:17 -0000\r
52 \r
53 The width of the authors field in search output was previously\r
54 specified in two places:\r
55  - `notmuch-search-authors-width': the limit beyond which the authors\r
56    names are truncated,\r
57  - `notmuch-search-result-format': the layout of the search results.\r
58 \r
59 Changing the configuration of one of these may have required the user\r
60 to know about and adapt the other accordingly. This led to confusion.\r
61 \r
62 Instead, remove `notmuch-search-authors-width' and perform truncation\r
63 based on the relevant field in `notmuch-search-result-format'.\r
64 ---\r
65 \r
66 Jamie, could you test this patch please? My main concern is that it\r
67 makes a small assumption about the value of\r
68 `notmuch-search-result-format' - namely that the `authors' field ends\r
69 with a space.\r
70 \r
71  emacs/notmuch.el |   16 ++++++----------\r
72  1 files changed, 6 insertions(+), 10 deletions(-)\r
73 \r
74 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
75 index f96394a..d40c36e 100644\r
76 --- a/emacs/notmuch.el\r
77 +++ b/emacs/notmuch.el\r
78 @@ -55,15 +55,10 @@\r
79  (require 'notmuch-show)\r
80  (require 'notmuch-mua)\r
81  \r
82 -(defcustom notmuch-search-authors-width 20\r
83 -  "Number of columns to use to display authors in a notmuch-search buffer."\r
84 -  :type 'integer\r
85 -  :group 'notmuch)\r
86 -\r
87  (defcustom notmuch-search-result-format\r
88    `(("date" . "%s ")\r
89      ("count" . "%-7s ")\r
90 -    ("authors" . ,(format "%%-%ds " notmuch-search-authors-width))\r
91 +    ("authors" . "%-20s ")\r
92      ("subject" . "%s ")\r
93      ("tags" . "(%s)"))\r
94    "Search result formating. Supported fields are:\r
95 @@ -585,7 +580,11 @@ matching will be applied."\r
96     ((string-equal field "count")\r
97      (insert (format (cdr (assoc field notmuch-search-result-format)) count)))\r
98     ((string-equal field "authors")\r
99 -    (insert (format (cdr (assoc field notmuch-search-result-format)) authors)))\r
100 +    (insert (let ((sample (format (cdr (assoc field notmuch-search-result-format)) "")))\r
101 +             (if (> (length authors)\r
102 +                    (length sample))\r
103 +                 (concat (substring authors 0 (- (length sample) 4)) "... ")\r
104 +               (format (cdr (assoc field notmuch-search-result-format)) authors)))))\r
105     ((string-equal field "subject")\r
106      (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))\r
107     ((string-equal field "tags")\r
108 @@ -614,12 +613,9 @@ matching will be applied."\r
109                            (date (match-string 2 string))\r
110                            (count (match-string 3 string))\r
111                            (authors (match-string 4 string))\r
112 -                          (authors-length (length authors))\r
113                            (subject (match-string 5 string))\r
114                            (tags (match-string 6 string))\r
115                            (tag-list (if tags (save-match-data (split-string tags)))))\r
116 -                     (if (> authors-length notmuch-search-authors-width)\r
117 -                         (set 'authors (concat (substring authors 0 (- notmuch-search-authors-width 3)) "...")))\r
118                       (goto-char (point-max))\r
119                       (let ((beg (point-marker)))\r
120                         (notmuch-search-show-result date count authors subject tags)\r
121 -- \r
122 1.7.0\r
123 \r