[PATCH 2/3] emacs: Add `notmuch-show-line-faces' and apply it.
authorMark Walters <markwalters1009@gmail.com>
Sat, 14 Apr 2012 19:21:40 +0000 (20:21 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:23 +0000 (09:46 -0800)
9b/a1936a340462720043c4bebdd03fd475a88f98 [new file with mode: 0644]

diff --git a/9b/a1936a340462720043c4bebdd03fd475a88f98 b/9b/a1936a340462720043c4bebdd03fd475a88f98
new file mode 100644 (file)
index 0000000..f599ba8
--- /dev/null
@@ -0,0 +1,149 @@
+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 E12CF431FD0\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 12:21:49 -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 VqBBJHf8af6t for <notmuch@notmuchmail.org>;\r
+       Sat, 14 Apr 2012 12:21:47 -0700 (PDT)\r
+Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com\r
+       [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3C040431FC2\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 12:21:43 -0700 (PDT)\r
+Received: by wibhn6 with SMTP id hn6so3284596wib.2\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 12:21:41 -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=tFt6E5PF4Ik2i9JM3XCnxHqCRerCNv0s73mCKpUn8yk=;\r
+       b=SRxkeFzAMX7OVScMG4pO2iRHrMujWVoZo5iT8+x8OvkFtykavIRpLBdQDNuLIxvub7\r
+       0JEL7v5s915bgdFUvKeTMfgpHt0EsPYQgq3dRa6iWyaTHpw916MW0n5yyh5294oWV0uV\r
+       E1e6FxJCaUobXu5AJCqNnpoU4cwftl7d5vWBBnOmz+ELSZROUE4vigxfSpkEBpSbI5jB\r
+       4nivmGeiQVHMIzcMHdI6rl6hpGxjMbGq0p5hnsQR6TadGhkgAI2OPLpgQ1qe08YrLyMK\r
+       wNmfhaGci1qX3znnRMSPkzMADrNB2JD5F3ufMs2zWu/v/YqMH7ZSuoLp+Bxls/f9GJrG\r
+       l3Aw==\r
+Received: by 10.216.131.30 with SMTP id l30mr3425417wei.111.1334431301852;\r
+       Sat, 14 Apr 2012 12:21:41 -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
+ fz9sm6623197wib.3.2012.04.14.12.21.40 (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 14 Apr 2012 12:21:41 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] emacs: Add `notmuch-show-line-faces' and apply it.\r
+Date: Sat, 14 Apr 2012 20:21:40 +0100\r
+Message-Id: <1334431301-27303-3-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:50 -0000\r
+\r
+Similar to `notmuch-search-line-faces', `notmuch-show-line-faces'\r
+allows the header line in `notmuch-show-mode' buffers to be coloured\r
+according to the tags of the message. This is just a rebased version of\r
+the  emacs/notmuch-show.el of David Edmondson's patch\r
+id:"1325006003-27152-1-git-send-email-dme@dme.org"\r
+---\r
+ emacs/notmuch-show.el |   33 +++++++++++++++++++++++++++++----\r
+ 1 files changed, 29 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 30b26d1..3dbb25f 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -94,6 +94,24 @@ any given message."\r
+   :group 'notmuch-show\r
+   :group 'notmuch-hooks)\r
+ \r
++(defcustom notmuch-show-line-faces nil\r
++  "Tag to face mapping for header line highlighting in `notmuch-show-mode'.\r
++\r
++Here is an example of how to color search results based on tags.\r
++ (the following text would be placed in your ~/.emacs file):\r
++\r
++ (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"\r
++                                                :background \"blue\"))\r
++                                   (\"unread\" . (:foreground \"green\"))))\r
++\r
++The attributes defined for matching tags are merged, with later\r
++attributes overriding earlier. A message having both \"delete\"\r
++and \"unread\" tags with the above settings would have a green\r
++foreground and blue background."\r
++  :type '(alist :key-type (string) :value-type (custom-face-edit))\r
++  :group 'notmuch-show\r
++  :group 'notmuch-faces)\r
++\r
+ ;; Mostly useful for debugging.\r
+ (defcustom notmuch-show-all-multipart/alternative-parts t\r
+   "Should all parts of multipart/alternative parts be shown?"\r
+@@ -412,7 +430,8 @@ unchanged ADDRESS if parsing fails."\r
+ (defun notmuch-show-insert-headerline (headers date tags depth)\r
+   "Insert a notmuch style headerline based on HEADERS for a\r
+ message at DEPTH in the current thread."\r
+-  (let ((start (point)))\r
++  (let ((start (point))\r
++      overlay)\r
+     (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))\r
+           (notmuch-show-clean-address (plist-get headers :From))\r
+           " ("\r
+@@ -421,7 +440,9 @@ message at DEPTH in the current thread."\r
+           (propertize (mapconcat 'identity tags " ")\r
+                       'face 'notmuch-tag-face)\r
+           ")\n")\r
+-    (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))\r
++    (setq overlay (make-overlay start (point)))\r
++    (overlay-put overlay 'face 'notmuch-message-summary-face)\r
++    (overlay-put overlay 'priority 2)))\r
+ \r
+ (defun notmuch-show-insert-header (header header-value)\r
+   "Insert a single header."\r
+@@ -853,7 +874,8 @@ current buffer, if possible."\r
+        body-start body-end\r
+        (headers-invis-spec (notmuch-show-make-symbol "header"))\r
+        (message-invis-spec (notmuch-show-make-symbol "message"))\r
+-       (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))\r
++       (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))\r
++       (tags (plist-get msg :tags)))\r
+ \r
+     ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise\r
+     ;; removing items from `buffer-invisibility-spec' (which is what\r
+@@ -878,10 +900,13 @@ current buffer, if possible."\r
+                                           (plist-get msg :date_relative)\r
+                                         nil)\r
+                                       (plist-get headers :Date))\r
+-                                  (plist-get msg :tags) depth)\r
++                                  tags depth)\r
+ \r
+     (setq content-start (point-marker))\r
+ \r
++    ;; Colour the header line according to the tags of the message.\r
++    (notmuch-color-line message-start content-start tags notmuch-show-line-faces)\r
++\r
+     (plist-put msg :headers-invis-spec headers-invis-spec)\r
+     (plist-put msg :message-invis-spec message-invis-spec)\r
+ \r
+-- \r
+1.7.9.1\r
+\r