[PATCH 1/3] emacs: Move colour line from search to lib
authorMark Walters <markwalters1009@gmail.com>
Sat, 14 Apr 2012 19:21:39 +0000 (20:21 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:22 +0000 (09:46 -0800)
2a/84f96ad568a07c0afb2bb686e8d3f069c5923b [new file with mode: 0644]

diff --git a/2a/84f96ad568a07c0afb2bb686e8d3f069c5923b b/2a/84f96ad568a07c0afb2bb686e8d3f069c5923b
new file mode 100644 (file)
index 0000000..bc4375a
--- /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 AD84C431FC2\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 12:21: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 eEopK5ZF17UI for <notmuch@notmuchmail.org>;\r
+       Sat, 14 Apr 2012 12:21:41 -0700 (PDT)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id F1C28431FAF\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 12:21:40 -0700 (PDT)\r
+Received: by werm13 with SMTP id m13so3020360wer.26\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 12:21:39 -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=y0hdnGd29PSJx+eMW5RDnHZNH17Jv6GTzMVLCfLdID4=;\r
+       b=kQMgCgwXogN0Ed6oPe+vSiEQVUgN92r3tIVPaYk8H/vzeStFnexZfPPyTHiCvqx/7e\r
+       cuE4RHYB6gcFO3c5giapDNokeQRfe/iNmjGo9AsNyLaoVPhUrG7S/0kMlsNAZtd8cMxl\r
+       jqujyis2i33qmcMFJgwrpM+M+A3b13wW4/rcgwbV7RfjvsFOZpsIPT7WDpCE4qfLjvSp\r
+       fNCNtrOiI0Y5dMNGrNBKLvRTXzGrxDg2YMxzS+To8ewLhuK4WdeLHW+djt8hWr9NwHSH\r
+       zx7TWotRhgAA0TxvSBdWjaM2tBPNNLnl0rs3kUAuAPHMQTc4nUYv2Z8feYNdS6hzaFyC\r
+       ABPQ==\r
+Received: by 10.216.208.21 with SMTP id p21mr3543264weo.12.1334431299625;\r
+       Sat, 14 Apr 2012 12:21:39 -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
+ h8sm10637596wix.4.2012.04.14.12.21.38 (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 14 Apr 2012 12:21:39 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/3] emacs: Move colour line from search to lib\r
+Date: Sat, 14 Apr 2012 20:21:39 +0100\r
+Message-Id: <1334431301-27303-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1334431301-27303-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1334431301-27303-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, 14 Apr 2012 19:21: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 ba833e6..09f6c50 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -728,20 +728,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