Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / 39 / f96dea4c325fff786c672fd2be3dced1ea7eb0
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 19DB3431FC7\r
6         for <notmuch@notmuchmail.org>; Sun,  1 Sep 2013 20:28:26 -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 BqbPAe0J2E3P for <notmuch@notmuchmail.org>;\r
18         Sun,  1 Sep 2013 20:28:21 -0700 (PDT)\r
19 Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com\r
20  [74.125.82.42])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  AF369431FC9    for <notmuch@notmuchmail.org>; Sun,  1 Sep 2013 20:28:17 -0700\r
23  (PDT)\r
24 Received: by mail-wg0-f42.google.com with SMTP id c11so1336425wgh.5\r
25         for <notmuch@notmuchmail.org>; Sun, 01 Sep 2013 20:28:16 -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:in-reply-to:references;\r
28         bh=Nir72BTilBpsLbDhhNJlPQ5m4PSaxttcr1fgrFeGmrE=;\r
29         b=J3eeZ/VtlmO1p+/2AJpwmF9c8DGAkRztsB8HrWNhGBrD2KFbrh1axIHNJUZw0H2lg/\r
30         AS3FzBYjipJGKPGCyOmjcgecmQZ616dTX/KTxZC8KWBrvX+eGKAqRT9hNzuvK9nHseBJ\r
31         DXwXYujI3aM+6hRNlW/lioVSq3xJREIcEjCxTxQSSOnqTHUOm562EYnvYzODaQWoUoEg\r
32         xDJODFNzcVPX2qNh9F8iXbzx9FWWaBMZgQnwau5NXcMgZ00KVnOYMkOyLTVIEUfAQFin\r
33         ctyc1dURsvsA2ZrwkioWAwEz9FcGWt4q2QMrzACJ9WK6bMmrzcVDwQ26/4An6DXW4gX8\r
34         yszw==\r
35 X-Received: by 10.180.205.163 with SMTP id lh3mr11750457wic.27.1378092496648; \r
36         Sun, 01 Sep 2013 20:28:16 -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 i3sm14853643wiw.7.1969.12.31.16.00.00\r
39         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
40         Sun, 01 Sep 2013 20:28:16 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH 2/4] contrib: pick: move the insertion of fields up a level\r
44 Date: Mon,  2 Sep 2013 04:28:06 +0100\r
45 Message-Id: <1378092488-32050-3-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.1\r
47 In-Reply-To: <1378092488-32050-1-git-send-email-markwalters1009@gmail.com>\r
48 References: <1378092488-32050-1-git-send-email-markwalters1009@gmail.com>\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: Mon, 02 Sep 2013 03:28:26 -0000\r
62 \r
63 This moves the actual insertion of message fields up from the field\r
64 formatting function into the message insertion function. This will be\r
65 useful in the next patch as we can apply further formatting to the\r
66 insertion string before inserting.\r
67 ---\r
68  contrib/notmuch-pick/notmuch-pick.el |   41 +++++++++++++++++++--------------\r
69  1 files changed, 24 insertions(+), 17 deletions(-)\r
70 \r
71 diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
72 index 063d660..f01be94 100644\r
73 --- a/contrib/notmuch-pick/notmuch-pick.el\r
74 +++ b/contrib/notmuch-pick/notmuch-pick.el\r
75 @@ -610,16 +610,19 @@ unchanged ADDRESS if parsing fails."\r
76      ;; If we have a name return that otherwise return the address.\r
77      (or p-name p-address)))\r
78  \r
79 -(defun notmuch-pick-insert-field (field format-string msg)\r
80 +(defun notmuch-pick-format-field (field format-string msg)\r
81 +  "Format a FIELD of MSG according to FORMAT-STRING and return string"\r
82    (let* ((headers (plist-get msg :headers))\r
83 -       (match (plist-get msg :match)))\r
84 +       (match (plist-get msg :match))\r
85 +       formatted-field)\r
86      (cond\r
87       ((string-equal field "date")\r
88        (let ((face (if match\r
89                       'notmuch-pick-match-date-face\r
90                     'notmuch-pick-no-match-date-face)))\r
91 -       (insert (propertize (format format-string (plist-get msg :date_relative))\r
92 -                           'face face))))\r
93 +       (setq formatted-field\r
94 +             (propertize (format format-string (plist-get msg :date_relative))\r
95 +                         'face face))))\r
96  \r
97       ((string-equal field "subject")\r
98        (let ((tree-status (plist-get msg :tree-status))\r
99 @@ -627,13 +630,14 @@ unchanged ADDRESS if parsing fails."\r
100             (face (if match\r
101                       'notmuch-pick-match-subject-face\r
102                     'notmuch-pick-no-match-subject-face)))\r
103 -       (insert (propertize (format format-string\r
104 -                                   (concat\r
105 -                                    (mapconcat #'identity (reverse tree-status) "")\r
106 -                                    (if (string= notmuch-pick-previous-subject bare-subject)\r
107 -                                        " ..."\r
108 -                                      bare-subject)))\r
109 -                           'face face))\r
110 +       (setq formatted-field\r
111 +             (propertize (format format-string\r
112 +                                 (concat\r
113 +                                  (mapconcat #'identity (reverse tree-status) "")\r
114 +                                  (if (string= notmuch-pick-previous-subject bare-subject)\r
115 +                                      " ..."\r
116 +                                    bare-subject)))\r
117 +                         'face face))\r
118         (setq notmuch-pick-previous-subject bare-subject)))\r
119  \r
120       ((string-equal field "authors")\r
121 @@ -644,17 +648,20 @@ unchanged ADDRESS if parsing fails."\r
122                     'notmuch-pick-no-match-author-face)))\r
123         (when (> (length author) len)\r
124           (setq author (substring author 0 len)))\r
125 -       (insert (propertize (format format-string author)\r
126 -                           'face face))))\r
127 +       (setq formatted-field\r
128 +             (propertize (format format-string author)\r
129 +                         'face face))))\r
130  \r
131       ((string-equal field "tags")\r
132        (let ((tags (plist-get msg :tags))\r
133             (face (if match\r
134                           'notmuch-pick-match-tag-face\r
135                         'notmuch-pick-no-match-tag-face)))\r
136 -       (insert (propertize (format format-string\r
137 -                                   (mapconcat #'identity tags ", "))\r
138 -                           'face face)))))))\r
139 +       (setq formatted-field\r
140 +             (propertize (format format-string\r
141 +                                 (mapconcat #'identity tags ", "))\r
142 +                         'face face)))))\r
143 +    formatted-field))\r
144  \r
145  (defun notmuch-pick-insert-msg (msg)\r
146    "Insert the message MSG according to notmuch-pick-result-format"\r
147 @@ -662,7 +669,7 @@ unchanged ADDRESS if parsing fails."\r
148    ;; by the insert-field calls.\r
149    (let ((previous-subject notmuch-pick-previous-subject))\r
150      (dolist (spec notmuch-pick-result-format)\r
151 -      (notmuch-pick-insert-field (car spec) (cdr spec) msg))\r
152 +      (insert (notmuch-pick-format-field (car spec) (cdr spec) msg)))\r
153      (notmuch-pick-set-message-properties msg)\r
154      (notmuch-pick-set-prop :previous-subject previous-subject)\r
155      (insert "\n")))\r
156 -- \r
157 1.7.9.1\r
158 \r