[Patch v2 1/3] emacs: Move colour line from search to lib
authorMark Walters <markwalters1009@gmail.com>
Sun, 29 Apr 2012 22:48:15 +0000 (23:48 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:49 +0000 (09:46 -0800)
eb/15fd48dd135b5aa695291c048a1381e2cafe99 [new file with mode: 0644]

diff --git a/eb/15fd48dd135b5aa695291c048a1381e2cafe99 b/eb/15fd48dd135b5aa695291c048a1381e2cafe99
new file mode 100644 (file)
index 0000000..76c20de
--- /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 DD3FD431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:07 -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 vpA3CRuJJQ73 for <notmuch@notmuchmail.org>;\r
+       Sun, 29 Apr 2012 15:48:07 -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 0E6E5431FAE\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:06 -0700 (PDT)\r
+Received: by wibhq7 with SMTP id hq7so1840741wib.2\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:05 -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=oJXjnokV/Eho6LgbYalIC0UBmZ2myw+Gfxxu67qjuG6NMTYtaOiYiPnb+D0PBnPS6y\r
+       X7rnFRlzo713cP93Bm/k7+JKYWq5Oj/Xo3qzLzF3Xzd9gaftISjQoi0Oqe9prPU8zBp0\r
+       uDmDAApA+nBEwGdM8jBvZNdE5uo/faovoQvR1sAmT2whNClOjgqKAmkzUv2bRRz1FCYw\r
+       oXLGPtKX666bYCtKzwyuFI2OaqMUDAZSX/u4WKqdGHU6Wan9w62/fw/fyO7r2bz6X/aA\r
+       /efUTFy3jEJTnp0RwxPFDoTUaXj3sOCv1pFCOeWDxZKprZXynq3q7TSmwtY/jyLy/cOy\r
+       eaDA==\r
+Received: by 10.180.24.7 with SMTP id q7mr1545725wif.11.1335739685672;\r
+       Sun, 29 Apr 2012 15:48:05 -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
+ fz9sm24223990wib.3.2012.04.29.15.48.04        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 29 Apr 2012 15:48:05 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v2 1/3] emacs: Move colour line from search to lib\r
+Date: Sun, 29 Apr 2012 23:48:15 +0100\r
+Message-Id: <1335739697-8501-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1335739697-8501-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1335739697-8501-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: Sun, 29 Apr 2012 22:48:08 -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