Re: [PATCH v3] Allow content preference based on message content.
[notmuch-archives.git] / dc / 25efde5c405026a27f9f7591c24184a4606308
1 Return-Path: <amdragon@mit.edu>\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 4A6F4429E30\r
6         for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 14:42: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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id FhmWRwzvvsTq for <notmuch@notmuchmail.org>;\r
16         Mon,  9 Jul 2012 14:42:49 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id 61D9F431FBF\r
20         for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 14:42:49 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7f306d0000008b4-17-4ffb50588fe4\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 0A.0F.02228.8505BFF4; Mon,  9 Jul 2012 17:42:48 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q69LglVQ011259; \r
27         Mon, 9 Jul 2012 17:42:47 -0400\r
28 Received: from drake.dyndns.org (26-4-176.dynamic.csail.mit.edu [18.26.4.176])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q69LgiYZ022682\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 9 Jul 2012 17:42:45 -0400 (EDT)\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1SoLj9-0004fo-Vs; Mon, 09 Jul 2012 17:42:43 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v3 1/9] emacs: Clean up notmuch-search-show-result\r
40 Date: Mon,  9 Jul 2012 17:42:34 -0400\r
41 Message-Id: <1341870162-17782-2-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10\r
43 In-Reply-To: <1341870162-17782-1-git-send-email-amdragon@mit.edu>\r
44 References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
45         <1341870162-17782-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrBsR8Nvf4OEaTYvVc3ksrt+cyWzx\r
48         ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZD18eZi14KFhxdMJ1pgbG\r
49         03xdjJwcEgImEo9e3WOEsMUkLtxbz9bFyMUhJLCPUeL57MlMEM56RondbV9YIZyTTBJ3T35l\r
50         hnDmMkrc/ruFDaSfTUBDYtv+5WCzRASkJXbenc0KYjMLxElsmfIfKM7BISzgJPF1dTZImEVA\r
51         VWLphBtMIDavgIPEp9YWJogz5CWe3u8DG8kp4Cgx5+YOsJFCAuUSn2/8Y57AyL+AkWEVo2xK\r
52         bpVubmJmTnFqsm5xcmJeXmqRrolebmaJXmpK6SZGcHBJ8u9g/HZQ6RCjAAejEg/vJpbf/kKs\r
53         iWXFlbmHGCU5mJREefM8gUJ8SfkplRmJxRnxRaU5qcWHGCU4mJVEeG+5AuV4UxIrq1KL8mFS\r
54         0hwsSuK8V1Nu+gsJpCeWpGanphakFsFkZTg4lCR4p/kDNQoWpaanVqRl5pQgpJk4OEGG8wAN\r
55         nwBSw1tckJhbnJkOkT/FqCglzjsZJCEAksgozYPrhUX/K0ZxoFeEeYtAqniAiQOu+xXQYCag\r
56         we09v0AGlyQipKQaGLOPvfh+5Zp+a9Fcr5+idrOm3q44YjanzVmYrfUE31TxjRoBx5jL/QKv\r
57         CT54G/jupDSH3LXKuj012VczwtLenV854fIUwVbpuCM30hisX0w54LPa34Mr1ub4/7feM16c\r
58         Dn3c/kipc2fFd7GYFrZr7XnmwVJrPVhPbzxq83BOb8yzV4HuQZ/eP1ViKc5INNRiLipOBACj\r
59         OpOa2QIAAA==\r
60 Cc: tomi.ollila@iki.fi\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Mon, 09 Jul 2012 21:42:50 -0000\r
74 \r
75 This simplifies the code and makes it no longer cubic in the number of\r
76 result fields.\r
77 ---\r
78  emacs/notmuch.el |   19 ++++++++++---------\r
79  1 file changed, 10 insertions(+), 9 deletions(-)\r
80 \r
81 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
82 index c6236db..8ad0b68 100644\r
83 --- a/emacs/notmuch.el\r
84 +++ b/emacs/notmuch.el\r
85 @@ -707,29 +707,30 @@ non-authors is found, assume that all of the authors match."\r
86           (overlay-put overlay 'isearch-open-invisible #'delete-overlay)))\r
87        (insert padding))))\r
88  \r
89 -(defun notmuch-search-insert-field (field date count authors subject tags)\r
90 +(defun notmuch-search-insert-field (field format-string date count authors subject tags)\r
91    (cond\r
92     ((string-equal field "date")\r
93 -    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) date)\r
94 +    (insert (propertize (format format-string date)\r
95                         'face 'notmuch-search-date)))\r
96     ((string-equal field "count")\r
97 -    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) count)\r
98 +    (insert (propertize (format format-string count)\r
99                         'face 'notmuch-search-count)))\r
100     ((string-equal field "subject")\r
101 -    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) subject)\r
102 +    (insert (propertize (format format-string subject)\r
103                         'face 'notmuch-search-subject)))\r
104  \r
105     ((string-equal field "authors")\r
106 -    (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))\r
107 +    (notmuch-search-insert-authors format-string authors))\r
108  \r
109     ((string-equal field "tags")\r
110 +    ;; Ignore format-string here because notmuch-search-set-tags\r
111 +    ;; depends on the format of this\r
112      (insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")")))))\r
113  \r
114  (defun notmuch-search-show-result (date count authors subject tags)\r
115 -  (let ((fields) (field))\r
116 -    (setq fields (mapcar 'car notmuch-search-result-format))\r
117 -    (loop for field in fields\r
118 -         do (notmuch-search-insert-field field date count authors subject tags)))\r
119 +  (dolist (spec notmuch-search-result-format)\r
120 +    (notmuch-search-insert-field (car spec) (cdr spec)\r
121 +                                date count authors subject tags))\r
122    (insert "\n"))\r
123  \r
124  (defun notmuch-search-process-filter (proc string)\r
125 -- \r
126 1.7.10\r
127 \r