Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f6 / 268e6a82c544c12b0bbf8a0945ef73eef46499
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 5A090431FC3\r
6         for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 13:42:03 -0800 (PST)\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 Tbz-dVxztrEv for <notmuch@notmuchmail.org>;\r
18         Sat, 11 Jan 2014 13:41:56 -0800 (PST)\r
19 Received: from mail-we0-f175.google.com (mail-we0-f175.google.com\r
20         [74.125.82.175]) (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 9E630431FD0\r
23         for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 13:41:56 -0800 (PST)\r
24 Received: by mail-we0-f175.google.com with SMTP id p61so113223wes.20\r
25         for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 13:41:52 -0800 (PST)\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:in-reply-to:references;\r
28         bh=cNt7MSxwWZEo1TF7/8WRLuR/w8/2+lcHDIUevzQ0ZpM=;\r
29         b=Fmq7GkNxZlozZlzYIP+m5gnV09wwyKXnqROx9w5YxV5EC2aPuDjfU62r11WOBDq/cx\r
30         F6h4b32dnSYNtZJ16bHiKId1mTrTBqUzToW2y0zKQCTWigBe98VmcTbLRwQ/piSE6yiV\r
31         Iwj6gtOSoiyrIy0Rui7s9v6ffwGsyB5597uHPYqfwygFHn53uvh1sSTsa4IU3/KhXnPF\r
32         i1sQ22LqmmHLnA7tlhNZ4+27XdFfPmDK/H/px0aquqLNo+IjJzDI9/Q0YhVUY24IClYE\r
33         aSK6barXbNocXPQumuREnIv6pxd1TDa1voR/JaYIL5QG7V+iVwuxGEBZdCOVYX7ibCnf\r
34         N4gA==\r
35 X-Received: by 10.180.89.193 with SMTP id bq1mr8743437wib.22.1389476512788;\r
36         Sat, 11 Jan 2014 13:41:52 -0800 (PST)\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
38         by mx.google.com with ESMTPSA id po3sm7519383wjc.3.2014.01.11.13.41.52\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Sat, 11 Jan 2014 13:41:52 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH 1/2] emacs: tree: default face for matching/non-matching\r
45         messages\r
46 Date: Sat, 11 Jan 2014 21:41:42 +0000\r
47 Message-Id: <1389476503-23682-2-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 In-Reply-To: <1389476503-23682-1-git-send-email-markwalters1009@gmail.com>\r
50 References: <1389476503-23682-1-git-send-email-markwalters1009@gmail.com>\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Sat, 11 Jan 2014 21:42:03 -0000\r
64 \r
65 This adds default faces for matching and non-matching messages. This\r
66 makes it easier for a user to do broad customization without having to\r
67 customize every field. It also fits more neatly with the next patch\r
68 which switches to using notmuch-tag-format-tags for tag formatting.\r
69 \r
70 We set the field specific face customization to nil for all the fields\r
71 which use the message default face to make it clear to a user which\r
72 fields customizations are being used.\r
73 ---\r
74  emacs/notmuch-tree.el |   36 ++++++++++++++++++++++++++----------\r
75  1 files changed, 26 insertions(+), 10 deletions(-)\r
76 \r
77 diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el\r
78 index 0ce7fa8..16f2862 100644\r
79 --- a/emacs/notmuch-tree.el\r
80 +++ b/emacs/notmuch-tree.el\r
81 @@ -70,8 +70,14 @@ Note the author string should not contain\r
82    :group 'notmuch-tree)\r
83  \r
84  ;; Faces for messages that match the query.\r
85 -(defface notmuch-tree-match-date-face\r
86 +(defface notmuch-tree-match-face\r
87    '((t :inherit default))\r
88 +  "Default face used in tree mode face for matching messages"\r
89 +  :group 'notmuch-tree\r
90 +  :group 'notmuch-faces)\r
91 +\r
92 +(defface notmuch-tree-match-date-face\r
93 +  nil\r
94    "Face used in tree mode for the date in messages matching the query."\r
95    :group 'notmuch-tree\r
96    :group 'notmuch-faces)\r
97 @@ -90,13 +96,13 @@ Note the author string should not contain\r
98    :group 'notmuch-faces)\r
99  \r
100  (defface notmuch-tree-match-subject-face\r
101 -  '((t :inherit default))\r
102 +  nil\r
103    "Face used in tree mode for the subject in messages matching the query."\r
104    :group 'notmuch-tree\r
105    :group 'notmuch-faces)\r
106  \r
107  (defface notmuch-tree-match-tree-face\r
108 -  '((t :inherit default))\r
109 +  nil\r
110    "Face used in tree mode for the thread tree block graphics in messages matching the query."\r
111    :group 'notmuch-tree\r
112    :group 'notmuch-faces)\r
113 @@ -115,32 +121,38 @@ Note the author string should not contain\r
114    :group 'notmuch-faces)\r
115  \r
116  ;; Faces for messages that do not match the query.\r
117 -(defface notmuch-tree-no-match-date-face\r
118 +(defface notmuch-tree-no-match-face\r
119    '((t (:foreground "gray")))\r
120 +  "Default face used in tree mode face for non-matching messages"\r
121 +  :group 'notmuch-tree\r
122 +  :group 'notmuch-faces)\r
123 +\r
124 +(defface notmuch-tree-no-match-date-face\r
125 +  nil\r
126    "Face used in tree mode for non-matching dates."\r
127    :group 'notmuch-tree\r
128    :group 'notmuch-faces)\r
129  \r
130  (defface notmuch-tree-no-match-subject-face\r
131 -  '((t (:foreground "gray")))\r
132 +  nil\r
133    "Face used in tree mode for non-matching subjects."\r
134    :group 'notmuch-tree\r
135    :group 'notmuch-faces)\r
136  \r
137  (defface notmuch-tree-no-match-tree-face\r
138 -  '((t (:foreground "gray")))\r
139 +  nil\r
140    "Face used in tree mode for the thread tree block graphics in messages matching the query."\r
141    :group 'notmuch-tree\r
142    :group 'notmuch-faces)\r
143  \r
144  (defface notmuch-tree-no-match-author-face\r
145 -  '((t (:foreground "gray")))\r
146 +  nil\r
147    "Face used in tree mode for the date in messages matching the query."\r
148    :group 'notmuch-tree\r
149    :group 'notmuch-faces)\r
150  \r
151  (defface notmuch-tree-no-match-tag-face\r
152 -  '((t (:foreground "gray")))\r
153 +  nil\r
154    "Face used in tree mode face for non-matching tags."\r
155    :group 'notmuch-tree\r
156    :group 'notmuch-faces)\r
157 @@ -699,10 +711,14 @@ unchanged ADDRESS if parsing fails."\r
158  \r
159  (defun notmuch-tree-format-field-list (field-list msg)\r
160    "Format fields of MSG according to FIELD-LIST and return string"\r
161 -  (let (result-string)\r
162 +  (let ((face (if (plist-get msg :match)\r
163 +                 'notmuch-tree-match-face\r
164 +               'notmuch-tree-no-match-face))\r
165 +       (result-string))\r
166      (dolist (spec field-list result-string)\r
167        (let ((field-string (notmuch-tree-format-field (car spec) (cdr spec) msg)))\r
168 -       (setq result-string (concat result-string field-string))))))\r
169 +       (setq result-string (concat result-string field-string))))\r
170 +    (notmuch-combine-face-text-property-string result-string face t)))\r
171  \r
172  (defun notmuch-tree-insert-msg (msg)\r
173    "Insert the message MSG according to notmuch-tree-result-format"\r
174 -- \r
175 1.7.9.1\r
176 \r