--- /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 9460B431FC9\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 04:51:30 -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 p6z+ARD0eogM for <notmuch@notmuchmail.org>;\r
+ Sat, 22 Mar 2014 04:51:25 -0700 (PDT)\r
+Received: from mail-we0-f175.google.com (mail-we0-f175.google.com\r
+ [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id DC31C431FC2\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 04:51:24 -0700 (PDT)\r
+Received: by mail-we0-f175.google.com with SMTP id q58so2282275wes.34\r
+ for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 04:51:23 -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=gSliWsi5Qv4/R9XYHWk98eS0946wwZRKlUGWJlq/dtU=;\r
+ b=O+TnEfOkdGr9mP885PJz439OCvTU2E6FLz7PrvIt5yrmhi7agwvdGToz9EP4D+PL0K\r
+ v2eEN7BQ3oKdoiUE+mHF98WQl+DT7+3qamTq0mTfVTcM1foUMKLCC5IW0y9U0GhAbtTo\r
+ BooR6k3dtxW7s5R2uAQinGh8AAP5vMZ/OJNqhAUFkFS272CdNBzA/2CEqj1D/U04IrHO\r
+ cdFw7FRAugrZQZuMohlGJYQE4vhbWPDon2Q2FkROfORyWdxsBpsiTlqvwXYfcHZuy8Wx\r
+ F0DOYPnXJJb90WseOCxciIcmiPTGmIFlCx8YGXjFAMxbFikUDDP+4To+vM7z/JnFXpxt\r
+ 9DGg==\r
+X-Received: by 10.180.219.44 with SMTP id pl12mr3238423wic.12.1395489083803;\r
+ Sat, 22 Mar 2014 04:51:23 -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 hp5sm16887304wjb.0.2014.03.22.04.51.22\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 22 Mar 2014 04:51:23 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+ amdragon@mit.edu\r
+Subject: [Patch v4 1/8] emacs: Combine notmuch-combine-face-text-property{,\r
+ -string}\r
+Date: Sat, 22 Mar 2014 11:51:05 +0000\r
+Message-Id: <1395489072-19001-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1395489072-19001-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1395489072-19001-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: Sat, 22 Mar 2014 11:51:30 -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.10.4\r
+\r