[PATCH] emacs: Display non-matching authors in italic.
authorDavid Edmondson <dme@dme.org>
Wed, 28 Apr 2010 18:00:27 +0000 (19:00 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:59 +0000 (09:36 -0800)
9a/762e98d42ad194c0129e410314368f605cb48e [new file with mode: 0644]

diff --git a/9a/762e98d42ad194c0129e410314368f605cb48e b/9a/762e98d42ad194c0129e410314368f605cb48e
new file mode 100644 (file)
index 0000000..aa051d6
--- /dev/null
@@ -0,0 +1,104 @@
+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 404B54196F0\r
+       for <notmuch@notmuchmail.org>; Wed, 28 Apr 2010 11:06:30 -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 8RzJBXODz53d for <notmuch@notmuchmail.org>;\r
+       Wed, 28 Apr 2010 11:06:29 -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 3FEAA431FC1       for\r
+ <notmuch@notmuchmail.org>; Wed, 28 Apr 2010 11:06:29 -0700 (PDT)\r
+Received: by wwe15 with SMTP id 15so141610wwe.26\r
+       for <notmuch@notmuchmail.org>; Wed, 28 Apr 2010 11:06:28 -0700 (PDT)\r
+Received: by 10.216.159.141 with SMTP id s13mr4586390wek.64.1272477987149;\r
+       Wed, 28 Apr 2010 11:06:27 -0700 (PDT)\r
+Received: from ut.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1])\r
+       by mx.google.com with ESMTPS id z34sm230022wbv.14.2010.04.28.11.06.25\r
+       (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+       Wed, 28 Apr 2010 11:06:25 -0700 (PDT)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+       id 5318459411F; Wed, 28 Apr 2010 19:00:29 +0100 (BST)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Display non-matching authors in italic.\r
+Date: Wed, 28 Apr 2010 19:00:27 +0100\r
+Message-Id: <1272477627-10562-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.0\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: Wed, 28 Apr 2010 18:06:30 -0000\r
+\r
+In search mode some messages don't match the search criteria. Show\r
+their authors names in italic.\r
+---\r
+\r
+Whilst enjoying knowing which authors match, I disliked the pipe\r
+symbol. This is a proposed improvement.\r
+\r
+ emacs/notmuch.el |   24 +++++++++++++++++-------\r
+ 1 files changed, 17 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 7457da9..0a7a398 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -576,6 +576,22 @@ matching will be applied."\r
+                 (t\r
+                  (setq tags-faces (cdr tags-faces)))))))))\r
\r
++(defun notmuch-search-insert-authors (format-string authors)\r
++  (insert (let* ((formatted-sample (format format-string ""))\r
++               (formatted-authors (format format-string authors))\r
++               (truncated-string\r
++                (if (> (length formatted-authors)\r
++                       (length formatted-sample))\r
++                    (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")\r
++                  formatted-authors)))\r
++          ;; Need to save the match data to avoid interfering with\r
++          ;; `notmuch-search-process-filter'.\r
++          (save-match-data\r
++            (if (string-match "\\(.*\\)|\\(..*\\)" truncated-string)\r
++                (concat (match-string 1 truncated-string) ","\r
++                        (propertize (match-string 2 truncated-string) 'face 'italic))\r
++              truncated-string)))))\r
++\r
+ (defun notmuch-search-insert-field (field date count authors subject tags)\r
+   (cond\r
+    ((string-equal field "date")\r
+@@ -583,13 +599,7 @@ 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 (let* ((format-string (cdr (assoc field notmuch-search-result-format)))\r
+-                 (formatted-sample (format format-string ""))\r
+-                 (formatted-authors (format format-string authors)))\r
+-            (if (> (length formatted-authors)\r
+-                   (length formatted-sample))\r
+-                (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")\r
+-              formatted-authors))))\r
++    (notmuch-search-insert-authors (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
+-- \r
+1.7.0\r
+\r