[Patch v3 2/4] emacs: Add `notmuch-show-line-faces' and apply it.
authorMark Walters <markwalters1009@gmail.com>
Sat, 5 May 2012 13:39:45 +0000 (14:39 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:55 +0000 (09:46 -0800)
65/b43b49133228eaa5b0a17b45c848e7bb692d69 [new file with mode: 0644]

diff --git a/65/b43b49133228eaa5b0a17b45c848e7bb692d69 b/65/b43b49133228eaa5b0a17b45c848e7bb692d69
new file mode 100644 (file)
index 0000000..2457665
--- /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 EE5E6431FD5\r
+       for <notmuch@notmuchmail.org>; Sat,  5 May 2012 06:39:48 -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 jlDrU+XvWMd4 for <notmuch@notmuchmail.org>;\r
+       Sat,  5 May 2012 06:39:46 -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 CEBF8431FC9\r
+       for <notmuch@notmuchmail.org>; Sat,  5 May 2012 06:39:42 -0700 (PDT)\r
+Received: by mail-wi0-f173.google.com with SMTP id hr7so1498669wib.2\r
+       for <notmuch@notmuchmail.org>; Sat, 05 May 2012 06:39:42 -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=eTrMf2YDfMZtzWu1CzWLU1VdCsDJwwkBwJ2Oyaqr28g=;\r
+       b=IpUbk7UIkGXnAGCnDyj0QPbyUXfpOVqjZwHxyuPNzAmVRZ/8Su8NjM38bX7xZIEZ3a\r
+       pOTZoMyIcyg+nZTAeWopMouJjYQnEyxhFtnJ5wg8AltFrLNB8Um69/zPOafAYMQaCU+w\r
+       IWTcmAh/hnVr5zIloMZQaD7n0jOm3z5KoO4q/RsiraReINJwX6+KlmZXiUS5oulR1C4H\r
+       4wcymNUAI/wut6Fqc36sUH3s3DbrCCUJR7OZ2O4YC+7C7pDuO8t66undrNMAkIUSGYA7\r
+       Vzuhcsi6h4tqnm4z7b176WdQggMgIP6iyza/0PoDlCdG8BmJ2ER4dPspOAaxA8lw0x0r\r
+       a72Q==\r
+Received: by 10.180.77.4 with SMTP id o4mr21353989wiw.17.1336225182580;\r
+       Sat, 05 May 2012 06:39:42 -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
+ 6sm5808799wiz.1.2012.05.05.06.39.41   (version=TLSv1/SSLv3 cipher=OTHER);     Sat,\r
+ 05 May 2012 06:39:41 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v3 2/4] emacs: Add `notmuch-show-line-faces' and apply it.\r
+Date: Sat,  5 May 2012 14:39:45 +0100\r
+Message-Id: <1336225187-8772-3-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:49 -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 37f0ebb..e62f0a0 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -93,6 +93,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-show-line-faces '((\"deleted\" . (: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
+@@ -411,7 +429,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
+@@ -420,7 +439,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
+@@ -852,7 +873,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
+@@ -877,10 +899,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