[PATCH v2 11/14] cli/reply: return internet address list from get header funcs
[notmuch-archives.git] / 30 / fb250090dcd4e1adaca2a0d02a0d48655af688
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 30118431FC9\r
6         for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:11 -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: 2.7\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.7 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         FREEMAIL_REPLY=2.499, 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 Ge3pxO3KeIP5 for <notmuch@notmuchmail.org>;\r
18         Tue, 11 Mar 2014 21:10:05 -0700 (PDT)\r
19 Received: from mail-we0-f172.google.com (mail-we0-f172.google.com\r
20         [74.125.82.172]) (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 5ABD7431FBD\r
23         for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:05 -0700 (PDT)\r
24 Received: by mail-we0-f172.google.com with SMTP id t61so10935384wes.31\r
25         for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 21:10:02 -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;\r
28         bh=ushI8sUyDdfc3tZh/Ec3wHxTnIQti1POySXlq7loy8M=;\r
29         b=cn6p7+5AqY+v7+OUNAasM1W2dybTInO6NQZ30cEdkJzjV6HpbZZJ9Mjo4LU3vwokJM\r
30         Y48hpt2BGZeQj8OpZGJvE45fOjhB70Dvii8acQp23onSYgEHaimJDmqPtCj3HkC8nIzk\r
31         z/EmrME60hzrHGhs+962npirUrzjkw6/j+nH/G10gv6LmXBb5YVXauA4Pe0MijpzDdwc\r
32         AwGeDQjTyqoaB/qjJ+MmWK5jRm9IhdCL3FVUDwMf4HbRWoHHIxIZlu5+4SQfEsxl4f7s\r
33         /VhrMGbiwKJuGmtPFrL7qCNn22vEQIx73dQluKR+4HVPWnyJE3j3B15zi8P2j3+ftMPR\r
34         ZZXA==\r
35 X-Received: by 10.194.1.242 with SMTP id 18mr2235058wjp.22.1394597401363;\r
36         Tue, 11 Mar 2014 21:10:01 -0700 (PDT)\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 12sm66447776wjm.10.2014.03.11.21.10.00\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Tue, 11 Mar 2014 21:10:00 -0700 (PDT)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org,\r
44         amdragon@mit.edu\r
45 Subject: [Patch v3 0/8] emacs: show tag changes in buffer\r
46 Date: Wed, 12 Mar 2014 04:09:49 +0000\r
47 Message-Id: <1394597397-8486-1-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Wed, 12 Mar 2014 04:10:11 -0000\r
62 \r
63 This is version 3 of this patch set. Version 2 is at\r
64 id:1392841212-8494-1-git-send-email-markwalters1009@gmail.com.\r
65 \r
66 This includes a (very) slightly tweaked version of Austin's\r
67 notmuch-apply-face patch so that face properties for deleted/added\r
68 tags get applied on top of rather than instead of the default face for\r
69 that tag.\r
70 \r
71 Otherwise I think this addesses all of Austin's review comments.\r
72 \r
73 A diff from v2 is below: I have deleted the parts related to the\r
74 notmuch-apply-face addition.\r
75 \r
76 Best wishes\r
77 \r
78 Mark\r
79 \r
80 diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
81 index 869b97d..cfccb8e 100644\r
82 --- a/emacs/notmuch-tag.el\r
83 +++ b/emacs/notmuch-tag.el\r
84 @@ -28,18 +28,6 @@\r
85  (require 'crm)\r
86  (require 'notmuch-lib)\r
87  \r
88 -;; (notmuch-tag-clear-cache will be called by the defcustom\r
89 -;; notmuch-tag-formats, so it has to be defined first.)\r
90 -\r
91 -(defvar notmuch-tag--format-cache (make-hash-table :test 'equal)\r
92 -  "Cache of tag format lookup.  Internal to `notmuch-tag-format-tag'.")\r
93 -\r
94 -(defun notmuch-tag-clear-cache ()\r
95 -  "Clear the internal cache of tag formats.\r
96 -\r
97 -This must be called after changes to `notmuch-tag-formats'."\r
98 -  (clrhash notmuch-tag--format-cache))\r
99 -\r
100  (define-widget 'notmuch-tag-format-type 'lazy\r
101    "Customize widget for notmuch-tag-format and friends"\r
102    :type '(alist :key-type (regexp :tag "Tag")\r
103 @@ -51,7 +39,7 @@ (define-widget 'notmuch-tag-format-type 'lazy\r
104                             (string :tag "Display as")\r
105                             (list :tag "Face" :extra-offset -4\r
106                                   (const :format "" :inline t\r
107 -                                        (propertize tag 'face))\r
108 +                                        (notmuch-apply-face tag))\r
109                                   (list :format "%v"\r
110                                         (const :format "" quote)\r
111                                         custom-face-edit))\r
112 @@ -102,7 +90,11 @@ (defcustom notmuch-tag-formats\r
113    :type 'notmuch-tag-format-type)\r
114  \r
115  (defcustom notmuch-tag-deleted-formats\r
116 -  '((".*" (propertize tag 'face\r
117 +  '(("unread" (notmuch-apply-face "unread"\r
118 +                     (if (display-supports-face-attributes-p '(:strike-through "red"))\r
119 +                         '(:strike-through "red")\r
120 +                       '(:inverse-video t))))\r
121 +    (".*" (notmuch-apply-face tag\r
122                       (if (display-supports-face-attributes-p '(:strike-through "red"))\r
123                           '(:strike-through "red")\r
124                         '(:inverse-video t)))))\r
125 @@ -115,14 +107,14 @@ (defcustom notmuch-tag-deleted-formats\r
126  unless strike-through is not available (e.g., emacs is running in\r
127  a terminal) in which case it uses inverse video. To hide deleted\r
128  tags completely set this to\r
129 -  '((\"\" nil))\r
130 +  '((\".*\" nil))\r
131  \r
132  See `notmuch-tag-formats' for full documentation."\r
133    :group 'notmuch-show\r
134    :type 'notmuch-tag-format-type)\r
135  \r
136  (defcustom notmuch-tag-added-formats\r
137 -  '((".*" (propertize tag 'face '(:underline "green"))))\r
138 +  '((".*" (notmuch-apply-face tag '(:underline "green"))))\r
139    "Custom formats for tags when added.\r
140  \r
141  For added tags the formats in `notmuch-tag-formats` are applied\r
142 @@ -185,8 +177,15 @@ (defun notmuch-tag-tag-icon ()\r
143    </g>\r
144  </svg>")\r
145  \r
146 +(defvar notmuch-tag--format-cache (make-hash-table :test 'equal)\r
147 +  "Cache of tag format lookup.  Internal to `notmuch-tag-format-tag'.")\r
148 +\r
149 +(defun notmuch-tag-clear-cache ()\r
150 +  "Clear the internal cache of tag formats."\r
151 +  (clrhash notmuch-tag--format-cache))\r
152 +\r
153  (defun notmuch-tag-format-tag-by-state (tag formatted-tag tag-state)\r
154 -  "Format TAG by looking into the appropriate `notmuch-tag-formats`.\r
155 +  "Format TAG according to the appropriate `notmuch-tag-formats`.\r
156  \r
157  Applies formats for TAG from the appropriate one of\r
158  `notmuch-tag-formats`, `notmuch-tag-deleted-formats` and\r
159 @@ -194,11 +193,15 @@ (defun notmuch-tag-format-tag-by-state (tag formatted-tag tag-state)\r
160  formatted tag FORMATTED-TAG."\r
161    (let ((formatted (gethash (cons tag tag-state) notmuch-tag--format-cache 'missing)))\r
162      (when (eq formatted 'missing)\r
163 -      (let* ((tag-formats (cond ((null tag-state) notmuch-tag-formats)\r
164 -                               ((eq 'deleted tag-state) notmuch-tag-deleted-formats)\r
165 -                               ((eq 'added tag-state) notmuch-tag-added-formats)))\r
166 +      (let* ((tag-formats (case tag-state\r
167 +                               ((list nil) notmuch-tag-formats)\r
168 +                               (deleted notmuch-tag-deleted-formats)\r
169 +                               (added notmuch-tag-added-formats)))\r
170              (formats\r
171               (save-match-data\r
172 +               ;; Don't use assoc-default since there's no way to\r
173 +               ;; distinguish a missing key from a present key with a\r
174 +               ;; null cdr:.\r
175                 (assoc* tag tag-formats\r
176                         :test (lambda (tag key)\r
177                                 (and (eq (string-match key tag) 0)\r
178 @@ -224,7 +227,7 @@ (defun notmuch-tag-format-tag-by-state (tag formatted-tag tag-state)\r
179      formatted))\r
180  \r
181  (defun notmuch-tag-format-tag (tags orig-tags tag)\r
182 -  "Format TAG by looking into `notmuch-tag-formats'.\r
183 +  "Format TAG according to `notmuch-tag-formats'.\r
184  \r
185  TAGS and ORIG-TAGS are lists of the current tags and the original\r
186  tags; tags which have been deleted (i.e., are in ORIG-TAGS but\r
187 @@ -246,7 +249,7 @@ (defun notmuch-tag-format-tags (tags orig-tags &optional face)\r
188    "Return a string representing formatted TAGS."\r
189    (let ((face (or face 'notmuch-tag-face))\r
190         (all-tags (sort (delete-dups (append tags orig-tags nil)) #'string<)))\r
191 -    (notmuch-combine-face-text-property-string\r
192 +    (notmuch-apply-face\r
193       (mapconcat #'identity\r
194                 ;; nil indicated that the tag was deliberately hidden\r
195                 (delq nil (mapcar\r
196  \r
197 \r
198 \r
199 \r
200 Austin Clements (2):\r
201   emacs: Combine notmuch-combine-face-text-property{,-string}\r
202   Make keys of notmuch-tag-formats regexps and use caching\r
203 \r
204 Mark Walters (6):\r
205   emacs: tag split customise option for format-tags into a widget\r
206   emacs: tag: add customize for deleted/added tag formats\r
207   emacs: show: mark tags changed since buffer loaded\r
208   emacs: show: use orig-tags for tag display\r
209   emacs: search: use orig-tags in search\r
210   emacs: tree: use orig-tags in search\r
211 \r
212  emacs/notmuch-lib.el  |   35 +++++----\r
213  emacs/notmuch-show.el |    7 +-\r
214  emacs/notmuch-tag.el  |  194 +++++++++++++++++++++++++++++++++++++------------\r
215  emacs/notmuch-tree.el |   12 ++-\r
216  emacs/notmuch.el      |   44 +++++++----\r
217  test/test-lib.el      |    5 +\r
218  6 files changed, 210 insertions(+), 87 deletions(-)\r
219 \r
220 -- \r
221 1.7.9.1\r
222 \r