--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 C322E431FC9\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:11 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] 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 8d5yCh3UHu07 for <notmuch@notmuchmail.org>;\r
+ Tue, 11 Mar 2014 21:10:06 -0700 (PDT)\r
+Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com\r
+ [209.85.212.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id BE445431FBF\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:05 -0700 (PDT)\r
+Received: by mail-wi0-f176.google.com with SMTP id hr14so1812893wib.15\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:03 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=vIc6ipLlzFMHEZWIOh7wQDzbatephbb/YDXMoza4Rl4=;\r
+ b=0UfEDjImByCn8yAfy0Db8Ds6Kd5G0B3EC/oIfknkg2gmG+rpvm0DUhGcURkhX7ooxy\r
+ dSdu5kh2PtN98Efgh0PSeyRR8wDxNrKLlQxNlEBfPZ0uyS7HbPF8dZ2RWpDFd3JA0x+3\r
+ 4vwf0tWacaKZwRRXAQUJ4x3RX+r9v/6V6jfpLf46SGJTSw6HlFTqe03Nlgx3Q1Bhu6VM\r
+ lR+xjq83e7qgUINUI4n8PE+/ydwsBMABjr6J34NXaC/PV6DBy7jxtjQJQABYH4LCoL2w\r
+ QYupG1uczniF0rkjYwmnKXnpitXFK/KoZqz4p7rT60Mm+LGP+wdZnOgxYRC+DQF+MplB\r
+ xeXA==\r
+X-Received: by 10.195.13.103 with SMTP id ex7mr39488373wjd.3.1394597403086;\r
+ Tue, 11 Mar 2014 21:10:03 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id\r
+ jw4sm66476951wjc.20.2014.03.11.21.10.02 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Tue, 11 Mar 2014 21:10:02 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+ amdragon@mit.edu\r
+Subject: [Patch v3 1/8] emacs: Combine notmuch-combine-face-text-property{,\r
+ -string}\r
+Date: Wed, 12 Mar 2014 04:09:50 +0000\r
+Message-Id: <1394597397-8486-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1394597397-8486-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1394597397-8486-1-git-send-email-markwalters1009@gmail.com>\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, 12 Mar 2014 04:10:12 -0000\r
+\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+\r
+This combines our two face combining functions into one, easy to use\r
+function with a much shorter name: `notmuch-apply-face'. This\r
+function takes the full set of arguments that\r
+`notmuch-combine-face-text-property' took, but takes them in a more\r
+convenient order and provides smarter defaults that make the function\r
+easy to use on both strings and buffers.\r
+---\r
+ emacs/notmuch-lib.el | 35 ++++++++++++++++++-----------------\r
+ emacs/notmuch-tag.el | 2 +-\r
+ emacs/notmuch-tree.el | 2 +-\r
+ emacs/notmuch.el | 2 +-\r
+ 4 files changed, 21 insertions(+), 20 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 2fefdad..fa7646f 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -578,23 +578,32 @@ (defun notmuch-face-ensure-list-form (face)\r
+ face\r
+ (list face)))\r
+ \r
+-(defun notmuch-combine-face-text-property (start end face &optional below object)\r
+- "Combine FACE into the 'face text property between START and END.\r
++(defun notmuch-apply-face (object face &optional below start end)\r
++ "Combine FACE into the 'face text property of OBJECT between START and END.\r
+ \r
+ This function combines FACE with any existing faces between START\r
+-and END in OBJECT (which defaults to the current buffer).\r
+-Attributes specified by FACE take precedence over existing\r
+-attributes unless BELOW is non-nil. FACE must be a face name (a\r
+-symbol or string), a property list of face attributes, or a list\r
+-of these. For convenience when applied to strings, this returns\r
+-OBJECT."\r
++and END in OBJECT. Attributes specified by FACE take precedence\r
++over existing attributes unless BELOW is non-nil.\r
++\r
++OBJECT may be a string, a buffer, or nil (which means the current\r
++buffer). If object is a string, START and END are 0-based;\r
++otherwise they are buffer positions (integers or markers). FACE\r
++must be a face name (a symbol or string), a property list of face\r
++attributes, or a list of these. If START and/or END are omitted,\r
++they default to the beginning/end of OBJECT. For convenience\r
++when applied to strings, this returns OBJECT."\r
+ \r
+ ;; A face property can have three forms: a face name (a string or\r
+ ;; symbol), a property list, or a list of these two forms. In the\r
+ ;; list case, the faces will be combined, with the earlier faces\r
+ ;; taking precedent. Here we canonicalize everything to list form\r
+ ;; to make it easy to combine.\r
+- (let ((pos start)\r
++ (let ((pos (cond (start start)\r
++ ((stringp object) 0)\r
++ (t 1)))\r
++ (end (cond (end end)\r
++ ((stringp object) (length object))\r
++ (t (1+ (buffer-size object)))))\r
+ (face-list (notmuch-face-ensure-list-form face)))\r
+ (while (< pos end)\r
+ (let* ((cur (get-text-property pos 'face object))\r
+@@ -607,14 +616,6 @@ (defun notmuch-combine-face-text-property (start end face &optional below object\r
+ (setq pos next))))\r
+ object)\r
+ \r
+-(defun notmuch-combine-face-text-property-string (string face &optional below)\r
+- (notmuch-combine-face-text-property\r
+- 0\r
+- (length string)\r
+- face\r
+- below\r
+- string))\r
+-\r
+ (defun notmuch-map-text-property (start end prop func &optional object)\r
+ "Transform text property PROP using FUNC.\r
+ \r
+diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
+index 908e7ad..41b1687 100644\r
+--- a/emacs/notmuch-tag.el\r
++++ b/emacs/notmuch-tag.el\r
+@@ -151,7 +151,7 @@ (defun notmuch-tag-format-tag (tag)\r
+ (defun notmuch-tag-format-tags (tags &optional face)\r
+ "Return a string representing formatted TAGS."\r
+ (let ((face (or face 'notmuch-tag-face)))\r
+- (notmuch-combine-face-text-property-string\r
++ (notmuch-apply-face\r
+ (mapconcat #'identity\r
+ ;; nil indicated that the tag was deliberately hidden\r
+ (delq nil (mapcar #'notmuch-tag-format-tag tags))\r
+diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el\r
+index 4f2ac02..e3aa2cd 100644\r
+--- a/emacs/notmuch-tree.el\r
++++ b/emacs/notmuch-tree.el\r
+@@ -715,7 +715,7 @@ (defun notmuch-tree-format-field-list (field-list msg)\r
+ (dolist (spec field-list result-string)\r
+ (let ((field-string (notmuch-tree-format-field (car spec) (cdr spec) msg)))\r
+ (setq result-string (concat result-string field-string))))\r
+- (notmuch-combine-face-text-property-string result-string face t)))\r
++ (notmuch-apply-face result-string face t)))\r
+ \r
+ (defun notmuch-tree-insert-msg (msg)\r
+ "Insert the message MSG according to notmuch-tree-result-format"\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 0471750..5cddaac 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -649,7 +649,7 @@ (defun notmuch-search-color-line (start end line-tag-list)\r
+ (let ((tag (car elem))\r
+ (attributes (cdr elem)))\r
+ (when (member tag line-tag-list)\r
+- (notmuch-combine-face-text-property start end attributes))))\r
++ (notmuch-apply-face nil attributes nil start end))))\r
+ ;; Reverse the list so earlier entries take precedence\r
+ (reverse notmuch-search-line-faces)))\r
+ \r
+-- \r
+1.7.9.1\r
+\r