[PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch...
authorDavid Edmondson <dme@dme.org>
Fri, 23 Apr 2010 10:24:09 +0000 (11:24 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:49 +0000 (09:36 -0800)
bf/dbf10514fcf46848b151567fa9d9a1c9034d59 [new file with mode: 0644]

diff --git a/bf/dbf10514fcf46848b151567fa9d9a1c9034d59 b/bf/dbf10514fcf46848b151567fa9d9a1c9034d59
new file mode 100644 (file)
index 0000000..797dcb9
--- /dev/null
@@ -0,0 +1,123 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 382184196F2\r
+       for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 03:24:17 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id aFasxxK5Q2C1 for <notmuch@notmuchmail.org>;\r
+       Fri, 23 Apr 2010 03:24:16 -0700 (PDT)\r
+Received: from mail-ww0-f53.google.com (mail-ww0-f53.google.com\r
+ [74.125.82.53])       by olra.theworths.org (Postfix) with ESMTP id 4590B431FC1       for\r
+ <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 03:24:16 -0700 (PDT)\r
+Received: by wwb28 with SMTP id 28so2887942wwb.26\r
+       for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 03:24:15 -0700 (PDT)\r
+Received: by 10.216.157.145 with SMTP id o17mr8066609wek.125.1272018255026;\r
+       Fri, 23 Apr 2010 03:24:15 -0700 (PDT)\r
+Received: from ut.hh.sledj.net (gmp-ea-fw-1.sun.com [192.18.1.36])\r
+       by mx.google.com with ESMTPS id z34sm499609wbv.8.2010.04.23.03.24.13\r
+       (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+       Fri, 23 Apr 2010 03:24:14 -0700 (PDT)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+       id 004E3594135; Fri, 23 Apr 2010 11:24:12 +0100 (BST)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use\r
+       of `notmuch-search-result-format' accordingly\r
+Date: Fri, 23 Apr 2010 11:24:09 +0100\r
+Message-Id: <1272018249-10300-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.0\r
+In-Reply-To: <87633jo2st.fsf@ut.hh.sledj.net>\r
+References: <87633jo2st.fsf@ut.hh.sledj.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 23 Apr 2010 10:24:17 -0000\r
+\r
+The width of the authors field in search output was previously\r
+specified in two places:\r
+ - `notmuch-search-authors-width': the limit beyond which the authors\r
+   names are truncated,\r
+ - `notmuch-search-result-format': the layout of the search results.\r
+\r
+Changing the configuration of one of these may have required the user\r
+to know about and adapt the other accordingly. This led to confusion.\r
+\r
+Instead, remove `notmuch-search-authors-width' and perform truncation\r
+based on the relevant field in `notmuch-search-result-format'.\r
+---\r
+\r
+Jamie, could you test this patch please? My main concern is that it\r
+makes a small assumption about the value of\r
+`notmuch-search-result-format' - namely that the `authors' field ends\r
+with a space.\r
+\r
+ emacs/notmuch.el |   16 ++++++----------\r
+ 1 files changed, 6 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index f96394a..d40c36e 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -55,15 +55,10 @@\r
+ (require 'notmuch-show)\r
+ (require 'notmuch-mua)\r
\r
+-(defcustom notmuch-search-authors-width 20\r
+-  "Number of columns to use to display authors in a notmuch-search buffer."\r
+-  :type 'integer\r
+-  :group 'notmuch)\r
+-\r
+ (defcustom notmuch-search-result-format\r
+   `(("date" . "%s ")\r
+     ("count" . "%-7s ")\r
+-    ("authors" . ,(format "%%-%ds " notmuch-search-authors-width))\r
++    ("authors" . "%-20s ")\r
+     ("subject" . "%s ")\r
+     ("tags" . "(%s)"))\r
+   "Search result formating. Supported fields are:\r
+@@ -585,7 +580,11 @@ matching will be applied."\r
+    ((string-equal field "count")\r
+     (insert (format (cdr (assoc field notmuch-search-result-format)) count)))\r
+    ((string-equal field "authors")\r
+-    (insert (format (cdr (assoc field notmuch-search-result-format)) authors)))\r
++    (insert (let ((sample (format (cdr (assoc field notmuch-search-result-format)) "")))\r
++            (if (> (length authors)\r
++                   (length sample))\r
++                (concat (substring authors 0 (- (length sample) 4)) "... ")\r
++              (format (cdr (assoc field notmuch-search-result-format)) authors)))))\r
+    ((string-equal field "subject")\r
+     (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))\r
+    ((string-equal field "tags")\r
+@@ -614,12 +613,9 @@ matching will be applied."\r
+                          (date (match-string 2 string))\r
+                          (count (match-string 3 string))\r
+                          (authors (match-string 4 string))\r
+-                         (authors-length (length authors))\r
+                          (subject (match-string 5 string))\r
+                          (tags (match-string 6 string))\r
+                          (tag-list (if tags (save-match-data (split-string tags)))))\r
+-                    (if (> authors-length notmuch-search-authors-width)\r
+-                        (set 'authors (concat (substring authors 0 (- notmuch-search-authors-width 3)) "...")))\r
+                     (goto-char (point-max))\r
+                     (let ((beg (point-marker)))\r
+                       (notmuch-search-show-result date count authors subject tags)\r
+-- \r
+1.7.0\r
+\r