Re: notmuch-emacs should correctly handle signature status on reply
[notmuch-archives.git] / d6 / 7acf922f8df03bef2ebaf52af5fd3aa2a9eab7
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 892E7431FC9\r
6         for <notmuch@notmuchmail.org>; Sat,  5 May 2012 06:39:50 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id YW5hurwn-XSp for <notmuch@notmuchmail.org>;\r
18         Sat,  5 May 2012 06:39:49 -0700 (PDT)\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
20         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 76DF5431FC7\r
23         for <notmuch@notmuchmail.org>; Sat,  5 May 2012 06:39:48 -0700 (PDT)\r
24 Received: by werm13 with SMTP id m13so2702719wer.26\r
25         for <notmuch@notmuchmail.org>; Sat, 05 May 2012 06:39:47 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=DPGmWp7F6nMRKhFdG4KmKYpQLCAlbv/iqYHlsehlwWU=;\r
29         b=YV3wv+nkeAoKBmO+vyE5SRx/LpbuLLvPf0sinqmc/g9jWMXe7MKOS4UhquonZCWmqq\r
30         ZYaUbxbm/DYzMHVns/d0tgSYFffCy/eJPR4O9SxadVhj2/iwVrzqyX7EiLj+o9t4sG7z\r
31         5/+xU0elVAc+upJykUilsVPzXGxsj0nJfd8+G7EYozxl8PEU/tJx+53DVd9Pc8t6yN63\r
32         1w6r+CMOHwYw9Hkhqx0HH89fqy4PhAmffA889KPvpAJo00U6oVc4JZsvTU8mqO091T9i\r
33         KnFk+Td19Zm5UgU1g78495/squDNm56FBwH9ZPuDrqQCUXJuO8TWJVhg2UBaiHY+vxjK\r
34         HiMA==\r
35 Received: by 10.180.90.233 with SMTP id bz9mr20566468wib.21.1336225187128;\r
36         Sat, 05 May 2012 06:39:47 -0700 (PDT)\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
38  [94.192.233.223])      by mx.google.com with ESMTPS id\r
39  e6sm5781484wix.8.2012.05.05.06.39.45   (version=TLSv1/SSLv3 cipher=OTHER);     Sat,\r
40  05 May 2012 06:39:46 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [Patch v3 4/4] emacs: allow notmuch-show-line-faces to use flags for\r
44         colouring\r
45 Date: Sat,  5 May 2012 14:39:47 +0100\r
46 Message-Id: <1336225187-8772-5-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1336225187-8772-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1336225187-8772-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sat, 05 May 2012 13:39:50 -0000\r
63 \r
64 This allows header-lines `notmuch-show-mode' buffers to be coloured\r
65 based on the flags (match/excluded) of the message. It supplies the\r
66 line colouring function with a list of tags each prefixed with "tag:"\r
67 and a list of flags ("match" or "excluded") each prefixed with\r
68 "flag:".\r
69 \r
70 The match flag is obviously not equivalent to a tag; the excluded flag\r
71 looks equivalent but is subtly different: a message is not marked\r
72 excluded if that tag appeared in the query.\r
73 ---\r
74  emacs/notmuch-show.el |   28 ++++++++++++++++++++++------\r
75  1 files changed, 22 insertions(+), 6 deletions(-)\r
76 \r
77 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
78 index e62f0a0..94399c5 100644\r
79 --- a/emacs/notmuch-show.el\r
80 +++ b/emacs/notmuch-show.el\r
81 @@ -96,17 +96,24 @@ any given message."\r
82  (defcustom notmuch-show-line-faces nil\r
83    "Tag to face mapping for header line highlighting in `notmuch-show-mode'.\r
84  \r
85 -Here is an example of how to color search results based on tags.\r
86 +Here is an example of how to color search results based on tags\r
87 +and flags (match and excluded).\r
88   (the following text would be placed in your ~/.emacs file):\r
89  \r
90 - (setq notmuch-show-line-faces '((\"deleted\" . (:foreground \"red\"\r
91 + (setq notmuch-show-line-faces '((\"tag:deleted\" . (:foreground \"red\"\r
92                                                   :background \"blue\"))\r
93 -                                   (\"unread\" . (:foreground \"green\"))))\r
94 +                                   (\"tag:unread\" . (:foreground \"green\"))\r
95 +                                   (\"flag:excluded\" . (:background \"grey\"))))\r
96  \r
97 -The attributes defined for matching tags are merged, with later\r
98 +The attributes defined for matching tags/flags are merged, with later\r
99  attributes overriding earlier. A message having both \"delete\"\r
100  and \"unread\" tags with the above settings would have a green\r
101 -foreground and blue background."\r
102 +foreground and blue background.\r
103 +\r
104 +Alternatively, here is an example of colouring using the same\r
105 +criteria as for search results:\r
106 + (setq notmuch-show-line-faces notmuch-search-line-faces)"\r
107 +\r
108    :type '(alist :key-type (string) :value-type (custom-face-edit))\r
109    :group 'notmuch-show\r
110    :group 'notmuch-faces)\r
111 @@ -871,11 +878,20 @@ current buffer, if possible."\r
112          content-start content-end\r
113          headers-start headers-end\r
114          body-start body-end\r
115 +        tags-and-flags\r
116          (headers-invis-spec (notmuch-show-make-symbol "header"))\r
117          (message-invis-spec (notmuch-show-make-symbol "message"))\r
118          (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))\r
119          (tags (plist-get msg :tags)))\r
120  \r
121 +    (mapc (lambda (tag)\r
122 +           (setq tags-and-flags (cons (concat "tag:" tag) tags-and-flags)))\r
123 +         tags)\r
124 +    (if (plist-get msg :match)\r
125 +       (setq tags-and-flags (cons "flag:match" tags-and-flags)))\r
126 +    (if (plist-get msg :excluded)\r
127 +       (setq tags-and-flags (cons "flag:excluded" tags-and-flags)))\r
128 +\r
129      ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise\r
130      ;; removing items from `buffer-invisibility-spec' (which is what\r
131      ;; `notmuch-show-headers-visible' and\r
132 @@ -904,8 +920,7 @@ current buffer, if possible."\r
133      (setq content-start (point-marker))\r
134  \r
135      ;; Colour the header line according to the tags of the message.\r
136 -    (notmuch-color-line message-start content-start tags notmuch-show-line-faces)\r
137 +    (notmuch-color-line message-start content-start tags-and-flags notmuch-show-line-faces)\r
138  \r
139      (plist-put msg :headers-invis-spec headers-invis-spec)\r
140      (plist-put msg :message-invis-spec message-invis-spec)\r
141 -- \r
142 1.7.9.1\r
143 \r