--- /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 B3D53431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 01:18:24 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.739\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.739 tagged_above=-999 required=5\r
+ tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7,\r
+ UNPARSEABLE_RELAY=0.001] autolearn=disabled\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 HEWAdpCx3JAm for <notmuch@notmuchmail.org>;\r
+ Mon, 19 Jan 2015 01:18:20 -0800 (PST)\r
+Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com\r
+ [74.125.82.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 8D919431FAF for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 01:18:20 -0800\r
+ (PST)\r
+Received: by mail-wg0-f46.google.com with SMTP id x13so30543023wgg.5\r
+ for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 01:18:19 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:to:subject:in-reply-to:references:user-agent\r
+ :from:date:message-id:mime-version:content-type;\r
+ bh=HKb+HJljNoXJ1QUmT5l46+3GC5UqXzw/Ix06XYznn/s=;\r
+ b=Py3AuPHcYPYDB5JTeGskQm1DnLeN7u9LLCRj8ff8aOHhKjJI/c2PkX6+BVIVmOSVQA\r
+ /iWEF5treYSXBY+x2lxM+9x4tS3hobsILTS+YOnIxfLKy74j8Ta5Y401c+IVMO3Zf/kS\r
+ mfGXhhgxXSOk2eN9c8y+EuOhTSfn3fsvEWmLzy698hnBMiO2Fnlikrc5wwojjtNwVhI6\r
+ KW8eRDc8Hs3PLIpFkq81gOj1/eHorRsfJji4Q46zZjWFQq7MH3WkzjZchBmZ5lsuKS2A\r
+ ZYarR0GSBeImG+i9ylMlOMVWofG5+yvMqnMQxpuGxER6MeXaY/310OlBlk6+Ysz1ciSD\r
+ PiCw==\r
+X-Gm-Message-State:\r
+ ALoCoQns778PiErCnuJ1/XBtyuy19rQebE8VV3uNCOQ2JPiVC+deoaZoFhzR/bB9askp4gkUH7G/\r
+X-Received: by 10.180.228.72 with SMTP id sg8mr33561156wic.48.1421659099365;\r
+ Mon, 19 Jan 2015 01:18:19 -0800 (PST)\r
+Received: from disaster-area.hh.sledj.net\r
+ ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
+ by mx.google.com with ESMTPSA id fp2sm13419444wib.8.2015.01.19.01.18.18\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Mon, 19 Jan 2015 01:18:18 -0800 (PST)\r
+Received: from localhost (30000@localhost [local]);\r
+ by localhost (OpenSMTPD) with ESMTPA id d2b51c17;\r
+ Mon, 19 Jan 2015 09:18:17 +0000 (UTC)\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 2/3] emacs: Improved display of\r
+ matching/non-matching authors.\r
+In-Reply-To: <87oapwj6xg.fsf@qmul.ac.uk>\r
+References: <1414172643-28270-1-git-send-email-dme@dme.org>\r
+ <1414172643-28270-3-git-send-email-dme@dme.org>\r
+ <87oapwj6xg.fsf@qmul.ac.uk>\r
+User-Agent: none\r
+From: David Edmondson <dme@dme.org>\r
+Date: Mon, 19 Jan 2015 09:18:17 +0000\r
+Message-ID: <cund26bku1y.fsf@gargravarr.hh.sledj.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Mon, 19 Jan 2015 09:18:24 -0000\r
+\r
+On Sun, Jan 18 2015, Mark Walters wrote:\r
+> On Fri, 24 Oct 2014, David Edmondson <dme@dme.org> wrote:\r
+>> Rather than splitting the :authors attribute, which is error prone,\r
+>> use the separate :authors_matched and :authors_non_matched attributes.\r
+>>\r
+>> This improves the display of authors should one of them include a pipe\r
+>> symbol (|) in their 'from' address.\r
+>\r
+> Hi\r
+>\r
+> I haven't fully understood this code yet: do you need to join the\r
+> matching and non-matching authors and then split again for propertizing?\r
+> It feels like it would be nicer to keep them separate and only combine\r
+> at the very end.\r
+>\r
+> Does this all get nicer with your formatting search results series?\r
+\r
+Yes. I tried re-writing this code to use the already split authors here,\r
+but given that I was going to re-write it for the formatting changes\r
+anyway, I gave up.\r
+\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>> ---\r
+>> emacs/notmuch.el | 64 +++++++++++++++++++++++++++++++-------------------------\r
+>> 1 file changed, 35 insertions(+), 29 deletions(-)\r
+>>\r
+>> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+>> index b44a907..688b37c 100644\r
+>> --- a/emacs/notmuch.el\r
+>> +++ b/emacs/notmuch.el\r
+>> @@ -672,22 +672,24 @@ foreground and blue background."\r
+>> ;; Reverse the list so earlier entries take precedence\r
+>> (reverse notmuch-search-line-faces)))\r
+>> \r
+>> -(defun notmuch-search-author-propertize (authors)\r
+>> +(defun notmuch-search-author-propertize (authors matching-length)\r
+>> "Split `authors' into matching and non-matching authors and\r
+>> propertize appropriately. If no boundary between authors and\r
+>> non-authors is found, assume that all of the authors match."\r
+>> - (if (string-match "\\(.*\\)|\\(.*\\)" authors)\r
+>> - (concat (propertize (concat (match-string 1 authors) ",")\r
+>> - 'face 'notmuch-search-matching-authors)\r
+>> - (propertize (match-string 2 authors)\r
+>> - 'face 'notmuch-search-non-matching-authors))\r
+>> - (propertize authors 'face 'notmuch-search-matching-authors)))\r
+>> -\r
+>> -(defun notmuch-search-insert-authors (format-string authors)\r
+>> + (let ((match-part (substring authors 0 matching-length))\r
+>> + (non-match-part (substring authors matching-length)))\r
+>> +\r
+>> + (concat (propertize match-part 'face 'notmuch-search-matching-authors)\r
+>> + (propertize non-match-part 'face 'notmuch-search-non-matching-authors))))\r
+>> +\r
+>> +(defun notmuch-search-insert-authors (format-string matching-authors non-matching-authors)\r
+>> ;; Save the match data to avoid interfering with\r
+>> ;; `notmuch-search-process-filter'.\r
+>> (save-match-data\r
+>> - (let* ((formatted-authors (format format-string authors))\r
+>> + (let* ((authors (if (string= "" non-matching-authors)\r
+>> + matching-authors\r
+>> + (concat matching-authors ", " non-matching-authors)))\r
+>> + (formatted-authors (format format-string authors))\r
+>> (formatted-sample (format format-string ""))\r
+>> (visible-string formatted-authors)\r
+>> (invisible-string "")\r
+>> @@ -703,9 +705,9 @@ non-authors is found, assume that all of the authors match."\r
+>> (setq visible-string (substring formatted-authors 0 visible-length)\r
+>> invisible-string (substring formatted-authors visible-length))\r
+>> ;; If possible, truncate the visible string at a natural\r
+>> - ;; break (comma or pipe), as incremental search doesn't\r
+>> - ;; match across the visible/invisible border.\r
+>> - (when (string-match "\\(.*\\)\\([,|] \\)\\([^,|]*\\)" visible-string)\r
+>> + ;; break (comma), as incremental search doesn't match\r
+>> + ;; across the visible/invisible border.\r
+>> + (when (string-match "\\(.*\\)\\(, \\)\\([^,]*\\)" visible-string)\r
+>> ;; Second clause is destructive on `visible-string', so\r
+>> ;; order is important.\r
+>> (setq invisible-string (concat (match-string 3 visible-string)\r
+>> @@ -721,20 +723,23 @@ non-authors is found, assume that all of the authors match."\r
+>> ? ))))\r
+>> \r
+>> ;; Use different faces to show matching and non-matching authors.\r
+>> - (if (string-match "\\(.*\\)|\\(.*\\)" visible-string)\r
+>> - ;; The visible string contains both matching and\r
+>> - ;; non-matching authors.\r
+>> - (setq visible-string (notmuch-search-author-propertize visible-string)\r
+>> - ;; The invisible string must contain only non-matching\r
+>> - ;; authors, as the visible-string contains both.\r
+>> - invisible-string (propertize invisible-string\r
+>> - 'face 'notmuch-search-non-matching-authors))\r
+>> - ;; The visible string contains only matching authors.\r
+>> - (setq visible-string (propertize visible-string\r
+>> - 'face 'notmuch-search-matching-authors)\r
+>> - ;; The invisible string may contain both matching and\r
+>> - ;; non-matching authors.\r
+>> - invisible-string (notmuch-search-author-propertize invisible-string)))\r
+>> + (let ((visible-length (length visible-string))\r
+>> + (matching-length (length matching-authors)))\r
+>> +\r
+>> + (if (> visible-length matching-length)\r
+>> + ;; The visible string contains both matching and\r
+>> + ;; non-matching authors.\r
+>> + (setq visible-string (notmuch-search-author-propertize visible-string matching-length)\r
+>> + ;; The invisible string must contain only non-matching\r
+>> + ;; authors, as the visible-string contains both.\r
+>> + invisible-string (propertize invisible-string\r
+>> + 'face 'notmuch-search-non-matching-authors))\r
+>> + ;; The visible string contains only matching authors.\r
+>> + (setq visible-string (propertize visible-string\r
+>> + 'face 'notmuch-search-matching-authors)\r
+>> + ;; The invisible string may contain both matching and\r
+>> + ;; non-matching authors.\r
+>> + invisible-string (notmuch-search-author-propertize invisible-string (- visible-length matching-length)))))\r
+>> \r
+>> ;; If there is any invisible text, add it as a tooltip to the\r
+>> ;; visible text.\r
+>> @@ -768,8 +773,9 @@ non-authors is found, assume that all of the authors match."\r
+>> 'face 'notmuch-search-subject)))\r
+>> \r
+>> ((string-equal field "authors")\r
+>> - (notmuch-search-insert-authors\r
+>> - format-string (notmuch-sanitize (plist-get result :authors))))\r
+>> + (notmuch-search-insert-authors format-string\r
+>> + (notmuch-sanitize (mapconcat 'identity (plist-get result :authors_matched) ", "))\r
+>> + (notmuch-sanitize (mapconcat 'identity (plist-get result :authors_non_matched) ", "))))\r
+>> \r
+>> ((string-equal field "tags")\r
+>> (let ((tags (plist-get result :tags))\r
+>> -- \r
+>> 2.1.1\r
+>>\r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r