--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 D6B38431FB6\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Jan 2015 10:10:39 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.34\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.34 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, DNS_FROM_AHBL_RHSBL=2.438,\r
+ FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3]\r
+ 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 lxpiBCLpoj+I for <notmuch@notmuchmail.org>;\r
+ Sun, 18 Jan 2015 10:10:36 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 4918E431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Jan 2015 10:10:36 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YCuIy-0006Mw-Cw; Sun, 18 Jan 2015 18:10:32 +0000\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YCuIx-00078I-Tv; Sun, 18 Jan 2015 18:10:32 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 2/3] emacs: Improved display of\r
+ matching/non-matching authors.\r
+In-Reply-To: <1414172643-28270-3-git-send-email-dme@dme.org>\r
+References: <1414172643-28270-1-git-send-email-dme@dme.org>\r
+ <1414172643-28270-3-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/24.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 18 Jan 2015 18:10:51 +0000\r
+Message-ID: <87oapwj6xg.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 5f0bc6cd3ac055a77f4f406af71c2084 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+ * -0.1 AWL AWL: Adjusted score from AWL reputation of From: address\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Sun, 18 Jan 2015 18:10:40 -0000\r
+\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
+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