--- /dev/null
+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 143A740DBE7\r
+ for <notmuch@notmuchmail.org>; Wed, 10 Nov 2010 01:24:50 -0800 (PST)\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, RCVD_IN_DNSWL_NONE=-0.0001] 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 LwaHdwAAYRD7 for <notmuch@notmuchmail.org>;\r
+ Wed, 10 Nov 2010 01:24:39 -0800 (PST)\r
+Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
+ [74.125.82.181])\r
+ by olra.theworths.org (Postfix) with ESMTP id 3810440DBC3\r
+ for <notmuch@notmuchmail.org>; Wed, 10 Nov 2010 01:24:39 -0800 (PST)\r
+Received: by wyb40 with SMTP id 40so489533wyb.26\r
+ for <notmuch@notmuchmail.org>; Wed, 10 Nov 2010 01:24:38 -0800 (PST)\r
+Received: by 10.227.154.7 with SMTP id m7mr7986568wbw.211.1289381077741;\r
+ Wed, 10 Nov 2010 01:24:37 -0800 (PST)\r
+Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com\r
+ [81.149.164.25])\r
+ by mx.google.com with ESMTPS id f14sm404219wbe.14.2010.11.10.01.24.30\r
+ (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+ Wed, 10 Nov 2010 01:24:32 -0800 (PST)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+ id 8F7C259405B; Wed, 10 Nov 2010 09:23:08 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Show cleaner addresses during message display.\r
+Date: Wed, 10 Nov 2010 09:23:07 +0000\r
+Message-Id: <1289380987-1206-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <87d3qd1t43.fsf@ut.hh.sledj.net>\r
+References: <87d3qd1t43.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: Wed, 10 Nov 2010 09:24:50 -0000\r
+\r
+Simplify the display of addresses by setting\r
+`notmuch-show-address-simplication' to:\r
+\r
+- 'full: Only the name component of the address, if present, is\r
+ shown (the default),\r
+- 'partial: Addresses are stripped of redundant information,\r
+- 'none: Addresses are shown as-is.\r
+---\r
+ emacs/notmuch-show.el | 55 +++++++++++++++++++++++++++++++++++++++++++++++-\r
+ 1 files changed, 53 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 9e5d72d..054aba1 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -26,6 +26,7 @@\r
+ (require 'message)\r
+ (require 'mm-decode)\r
+ (require 'mailcap)\r
++(require 'mail-parse)\r
+ \r
+ (require 'notmuch-lib)\r
+ (require 'notmuch-query)\r
+@@ -82,6 +83,21 @@ any given message."\r
+ notmuch-wash-elide-blank-lines\r
+ notmuch-wash-excerpt-citations))\r
+ \r
++(defcustom notmuch-show-address-simplification 'full\r
++ "How should addresses be displayed?\r
++\r
++Set `notmuch-show-address-simplication' to:\r
++\r
++- 'full: Only the name component of the address, if present, is\r
++ shown,\r
++- 'partial: Addresses are stripped of redundant information,\r
++- 'none: Addresses are shown as-is."\r
++ :group 'notmuch\r
++ :type '(choice\r
++ (const :tag "Full simplification" full)\r
++ (const :tag "Partial simplification" partial)\r
++ (const :tag "No simplification" none)))\r
++\r
+ (defmacro with-current-notmuch-show-message (&rest body)\r
+ "Evaluate body with current buffer set to the text of current message"\r
+ `(save-excursion\r
+@@ -198,12 +214,36 @@ any given message."\r
+ 'face 'notmuch-tag-face)\r
+ ")"))))))\r
+ \r
++(defun notmuch-show-clean-address (parsed-address)\r
++ "Prepare a single email address for display."\r
++ (let* ((address (car parsed-address))\r
++ (name (cdr parsed-address))\r
++ (displayed-name name))\r
++\r
++ ;; If the address is 'foo@bar.com <foo@bar.com>' then show just\r
++ ;; 'foo@bar.com'.\r
++ (when (string= displayed-name address)\r
++ (setq displayed-name nil))\r
++\r
++ (cond\r
++ ((eq notmuch-show-address-simplification 'full)\r
++ (if displayed-name\r
++ (propertize displayed-name 'help-echo address)\r
++ address))\r
++\r
++ ((eq notmuch-show-address-simplification 'partial)\r
++ (mail-header-make-address displayed-name address))\r
++\r
++ (t ;; All other settings, but mostly 'none.\r
++ (mail-header-make-address name address)))))\r
++\r
+ (defun notmuch-show-insert-headerline (headers date tags depth)\r
+ "Insert a notmuch style headerline based on HEADERS for a\r
+ message at DEPTH in the current thread."\r
+ (let ((start (point)))\r
+ (insert (notmuch-show-spaces-n depth)\r
+- (plist-get headers :From)\r
++ (notmuch-show-clean-address\r
++ (mail-header-parse-address (plist-get headers :From)))\r
+ " ("\r
+ date\r
+ ") ("\r
+@@ -214,7 +254,18 @@ message at DEPTH in the current thread."\r
+ \r
+ (defun notmuch-show-insert-header (header header-value)\r
+ "Insert a single header."\r
+- (insert header ": " header-value "\n"))\r
++ (insert header ": "\r
++ (cond\r
++ ((or (string= "To" header)\r
++ (string= "Cc" header)\r
++ (string= "Bcc" header)\r
++ (string= "From" header))\r
++ (mapconcat 'notmuch-show-clean-address\r
++ (mail-header-parse-addresses header-value)\r
++ ", "))\r
++ (t\r
++ header-value))\r
++ "\n"))\r
+ \r
+ (defun notmuch-show-insert-headers (headers)\r
+ "Insert the headers of the current message."\r
+-- \r
+1.7.2.3\r
+\r