Re: [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it.
authorJani Nikula <jani@nikula.org>
Sat, 5 May 2012 11:45:17 +0000 (14:45 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:55 +0000 (09:46 -0800)
c3/a7cabae4ff1cc5c816198300b77bfb2effca79 [new file with mode: 0644]

diff --git a/c3/a7cabae4ff1cc5c816198300b77bfb2effca79 b/c3/a7cabae4ff1cc5c816198300b77bfb2effca79
new file mode 100644 (file)
index 0000000..482e039
--- /dev/null
@@ -0,0 +1,165 @@
+Return-Path: <jani@nikula.org>\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 6537C431FB6\r
+       for <notmuch@notmuchmail.org>; Sat,  5 May 2012 04:45:30 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 vOJ9Q3AUsSea for <notmuch@notmuchmail.org>;\r
+       Sat,  5 May 2012 04:45:26 -0700 (PDT)\r
+Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
+       [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A0C9C431FAE\r
+       for <notmuch@notmuchmail.org>; Sat,  5 May 2012 04:45:25 -0700 (PDT)\r
+Received: by lbbgk8 with SMTP id gk8so2839017lbb.26\r
+       for <notmuch@notmuchmail.org>; Sat, 05 May 2012 04:45:22 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type:x-gm-message-state;\r
+       bh=rrgnsvX9gTtAeqH1CASjLgJLqWVwBSmf0oJHSRaywIc=;\r
+       b=ibEfIM43ycp2DkoX4tuDh6TwTV2FG6tca8K60MniFOsubx4EL5I0cLwnCuRU7DtiGV\r
+       bqS22svsGLKul6We07pRT4W1CKzxIo3UmC41NCgczpTYFxzgB32+OcOC10FcJj3vrxGh\r
+       lflz8cDgLzBDuLIL1VHhFzGaTCXV5w8pusGN+DLGUYthAYSCJRpd5WVGW2hnLCz7J4vY\r
+       6HstPV7Il9YlEmFCBsQ5Y27oToSlJ44V6BbG8FjZW3pQ3Ld2FWXqPLq6apRxzHkdySsM\r
+       S/etf6gpM07JFA1sc5Q8/EjO8I9EgL4Jkg66sNq4yK+jemArE1wqWi86t57vSueKf2lv\r
+       QkqQ==\r
+Received: by 10.152.114.106 with SMTP id jf10mr8849397lab.16.1336218322454;\r
+       Sat, 05 May 2012 04:45:22 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-fe50dc00-68.dhcp.inet.fi.\r
+       [80.220.80.68])\r
+       by mx.google.com with ESMTPS id j6sm14856244lbl.0.2012.05.05.04.45.19\r
+       (version=SSLv3 cipher=OTHER); Sat, 05 May 2012 04:45:20 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it.\r
+In-Reply-To: <1335739697-8501-3-git-send-email-markwalters1009@gmail.com>\r
+References: <1335739697-8501-1-git-send-email-markwalters1009@gmail.com>\r
+       <1335739697-8501-3-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.12+169~g45438b0 (http://notmuchmail.org) Emacs/23.3.1\r
+       (i686-pc-linux-gnu)\r
+Date: Sat, 05 May 2012 14:45:17 +0300\r
+Message-ID: <87bom2j1gy.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQn47k/AHPvksT0n6SxFsA8T9R+AmEWdlk4QO4+etoexOgRKESVkfpbDZYyWdW8QpivPCZBL\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 11:45:31 -0000\r
+\r
+On Mon, 30 Apr 2012, Mark Walters <markwalters1009@gmail.com> wrote:\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..bb7db6e 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-search-line-faces '((\"delete\" . (:foreground \"red\"\r
+\r
+That should be notmuch-show-line-faces.\r
+\r
+Jani.\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r