[Patch v3 1/4] emacs: Move colour line from search to lib
authorMark Walters <markwalters1009@gmail.com>
Sat, 5 May 2012 13:39:44 +0000 (14:39 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:55 +0000 (09:46 -0800)
4a/263280bf05c2147b84fca18bdc86249a55291a [new file with mode: 0644]

diff --git a/4a/263280bf05c2147b84fca18bdc86249a55291a b/4a/263280bf05c2147b84fca18bdc86249a55291a
new file mode 100644 (file)
index 0000000..2778377
--- /dev/null
@@ -0,0 +1,130 @@
+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 E92A2431FCB\r
+       for <notmuch@notmuchmail.org>; Sat,  5 May 2012 06:39:42 -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 riJu5K8UXCsV for <notmuch@notmuchmail.org>;\r
+       Sat,  5 May 2012 06:39:41 -0700 (PDT)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+       [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7A79C431FB6\r
+       for <notmuch@notmuchmail.org>; Sat,  5 May 2012 06:39:41 -0700 (PDT)\r
+Received: by wibhr7 with SMTP id hr7so1498669wib.2\r
+       for <notmuch@notmuchmail.org>; Sat, 05 May 2012 06:39:40 -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:x-mailer:in-reply-to:references;\r
+       bh=oaIUiyCRs6sL/rfiID+f7sP0GJBjAONIWuhpviQcmJo=;\r
+       b=mQWbVhrJ/CIMIcRUgX3Eazl61biv8q40vIhnvPwPBtHrHTU1zKVelyRKAyInImVGL/\r
+       BNySXb8yuUKzZRSyMa5U4i/CJ3gh8W9LXAYaCKmemtRHkco07IvaWO1Lr8ieiZ6CEOtr\r
+       zFj4WxciEL50nVUUMjyAmfqbGcEkW6plBP5A3gEsXKcjMiqyp0x4E1ua0MiYTVKfIxC6\r
+       58qW78rFv3osGZZKzIt2sWZnmPLh3ii6Jx6/h3JHXHHqYBaa36W3gwX7OqmKpBmj6DWt\r
+       p8GVBiKUPt4/f8U8NEihixwLdcBNAcBh1rkIFqsXGO4gwyAxPwiZGYYPEcUP4igFySpg\r
+       4jGw==\r
+Received: by 10.180.24.35 with SMTP id r3mr21234054wif.7.1336225180102;\r
+       Sat, 05 May 2012 06:39:40 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ b3sm5797889wib.4.2012.05.05.06.39.38  (version=TLSv1/SSLv3 cipher=OTHER);     Sat,\r
+ 05 May 2012 06:39:39 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v3 1/4] emacs: Move colour line from search to lib\r
+Date: Sat,  5 May 2012 14:39:44 +0100\r
+Message-Id: <1336225187-8772-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1336225187-8772-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1336225187-8772-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, 05 May 2012 13:39:43 -0000\r
+\r
+This patch moves the overlay/colouring from notmuch.el to\r
+notmuch-lib.el. This is in preparation for its use by notmuch-show in\r
+the next patch. This is just a rebased version of the emacs/notmuch.el\r
+and emacs/notmuch-lib.el parts of David Edmondson's patch (see\r
+id:"1325006003-27152-1-git-send-email-dme@dme.org")\r
+---\r
+ emacs/notmuch-lib.el |   18 ++++++++++++++++++\r
+ emacs/notmuch.el     |   15 +--------------\r
+ 2 files changed, 19 insertions(+), 14 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 6907a5f..c8a9351 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -148,6 +148,24 @@ the user hasn't set this variable with the old or new value."\r
+   "Return a query that matches the message with id ID."\r
+   (concat "id:\"" (replace-regexp-in-string "\"" "\"\"" id t t) "\""))\r
+ \r
++(defun notmuch-color-line (start end line-tag-list spec)\r
++  "Colorize a line based on tags."\r
++  ;; Create the overlay only if the message has tags which match one\r
++  ;; of those specified in `spec'.\r
++  (let (overlay)\r
++    (mapc (lambda (elem)\r
++          (let ((tag (car elem))\r
++                (attributes (cdr elem)))\r
++            (when (member tag line-tag-list)\r
++              (when (not overlay)\r
++                (setq overlay (make-overlay start end))\r
++                (overlay-put overlay 'priority 5))\r
++              ;; Merge the specified properties with any already\r
++              ;; applied from an earlier match.\r
++              (overlay-put overlay 'face\r
++                           (append (overlay-get overlay 'face) attributes)))))\r
++        spec)))\r
++\r
+ ;;\r
+ \r
+ (defun notmuch-common-do-stash (text)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index c6236db..d5f40e2 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -612,20 +612,7 @@ foreground and blue background."\r
+ \r
+ (defun notmuch-search-color-line (start end line-tag-list)\r
+   "Colorize lines in `notmuch-show' based on tags."\r
+-  ;; Create the overlay only if the message has tags which match one\r
+-  ;; of those specified in `notmuch-search-line-faces'.\r
+-  (let (overlay)\r
+-    (mapc (lambda (elem)\r
+-          (let ((tag (car elem))\r
+-                (attributes (cdr elem)))\r
+-            (when (member tag line-tag-list)\r
+-              (when (not overlay)\r
+-                (setq overlay (make-overlay start end)))\r
+-              ;; Merge the specified properties with any already\r
+-              ;; applied from an earlier match.\r
+-              (overlay-put overlay 'face\r
+-                           (append (overlay-get overlay 'face) attributes)))))\r
+-        notmuch-search-line-faces)))\r
++  (notmuch-color-line start end line-tag-list notmuch-search-line-faces))\r
+ \r
+ (defun notmuch-search-author-propertize (authors)\r
+   "Split `authors' into matching and non-matching authors and\r
+-- \r
+1.7.9.1\r
+\r