[PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 7b / 02eeb415485e08f59f7603fd731ceff0c9d7a5
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 C474B431FBD\r
6         for <notmuch@notmuchmail.org>; Wed,  4 Jul 2012 09:22:49 -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 rkcFGi0jdmjj for <notmuch@notmuchmail.org>;\r
16         Wed,  4 Jul 2012 09:22:48 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id B5B7D431FAE\r
20         for <notmuch@notmuchmail.org>; Wed,  4 Jul 2012 09:22:46 -0700 (PDT)\r
21 X-AuditID: 1209190c-b7f806d000006b87-bf-4ff46dd6eea7\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 35.A6.27527.6DD64FF4; Wed,  4 Jul 2012 12:22:46 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q64GMjcp002277; \r
27         Wed, 4 Jul 2012 12:22:45 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\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 q64GMiBA006235\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Wed, 4 Jul 2012 12:22:44 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@MIT.EDU>)\r
36         id 1SmSLj-0000Db-Vu; Wed, 04 Jul 2012 12:22:44 -0400\r
37 Date: Wed, 4 Jul 2012 12:22:43 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH 1/8] emacs: Clean up notmuch-search-show-result\r
41 Message-ID: <20120704162243.GC21653@mit.edu>\r
42 References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
43         <1341354059-29396-2-git-send-email-amdragon@mit.edu>\r
44         <87lij0gdwt.fsf@qmul.ac.uk>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <87lij0gdwt.fsf@qmul.ac.uk>\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42IRYrdT172W+8XfYOJKEYvVc3ksrt+cyWzx\r
52         ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZ3/dfYim4K1Hx8v4G1gbG\r
53         U8JdjJwcEgImEsfOf2SFsMUkLtxbz9bFyMUhJLCPUeLg97OMEM56Rokl2++ygVQJCZxgkjje\r
54         7ASRWMIo8W9KLwtIgkVARWLZlFvMIDabgIbEtv3LGUFsEQEdiduHFrCD2MwC+hIrT84EqxEW\r
55         cJa43LEKqJeDgxeoZudvX4iZUxklmvYsBavhFRCUODnzCQtEr5bEjX8vmUDqmQWkJZb/4wAJ\r
56         cwKt2n/sOBOILQp0wpST29gmMArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JS\r
57         i3QN9XIzS/RSU0o3MYICnVOSZwfjm4NKhxgFOBiVeHiTFT77C7EmlhVX5h5ilORgUhLl3ZT1\r
58         xV+ILyk/pTIjsTgjvqg0J7X4EKMEB7OSCK99OFCONyWxsiq1KB8mJc3BoiTOeznlpr+QQHpi\r
59         SWp2ampBahFMVoaDQ0mCVxYY0UKCRanpqRVpmTklCGkmDk6Q4TxAw5fkgAwvLkjMLc5Mh8if\r
60         YlSUEuflA2kWAElklObB9cIS0StGcaBXhHn/gLTzAJMYXPcroMFMQIPzFn8CGVySiJCSamDU\r
61         rWvd0mjCJP/6ziOPEKkdEXOvZsh/PNDHNp/vOKPKvKlf3jZ4fzt86P6MbVtOLPl7Z+vs6Qf/\r
62         ay0+uCQ+YdYFq5Ac4YyTzyqOG4vbi26aE2trPf9I3objoZryj0svfI28Kia6JU7+YMk2NYOo\r
63         Xyzf80yTrr/2VdtkGbP9jmvckeKlvSz3vnS8U2Ipzkg01GIuKk4EAFtVQMofAwAA\r
64 Cc: tomi.ollila@iki.fi, notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Wed, 04 Jul 2012 16:22:50 -0000\r
78 \r
79 Quoth Mark Walters on Jul 04 at  8:53 am:\r
80 > On Tue, 03 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
81 > > This simplifies the code and makes it no longer cubic in the number of\r
82 > > result fields.\r
83\r
84 > This looks good to me and all tests pass, and I agree that this patch\r
85 > can be pushed independently of the later patches in the series.\r
86\r
87 > My one comment is that I, as a lisp beginner, found the use of "format"\r
88 > as a function and a variable confusing (particularly as I had not come\r
89 > across the dolist macro and that use really makes format look like a\r
90 > function).\r
91 \r
92 I can see how that would be confusing.  Unless this version of the\r
93 series is somehow perfect, I'll rename it in the second version.\r
94 Perhaps result-format for the loop variable and spec for the format\r
95 string argument?\r
96 \r
97 > Best wishes\r
98\r
99 > Mark\r
100\r
101 > > ---\r
102 > >  emacs/notmuch.el |   20 ++++++++++----------\r
103 > >  1 file changed, 10 insertions(+), 10 deletions(-)\r
104 > >\r
105 > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
106 > > index c6236db..be217a2 100644\r
107 > > --- a/emacs/notmuch.el\r
108 > > +++ b/emacs/notmuch.el\r
109 > > @@ -707,29 +707,29 @@ non-authors is found, assume that all of the authors match."\r
110 > >       (overlay-put overlay 'isearch-open-invisible #'delete-overlay)))\r
111 > >        (insert padding))))\r
112 > >  \r
113 > > -(defun notmuch-search-insert-field (field date count authors subject tags)\r
114 > > +(defun notmuch-search-insert-field (field format date count authors subject tags)\r
115 > >    (cond\r
116 > >     ((string-equal field "date")\r
117 > > -    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) date)\r
118 > > +    (insert (propertize (format format date)\r
119 > >                     'face 'notmuch-search-date)))\r
120 > >     ((string-equal field "count")\r
121 > > -    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) count)\r
122 > > +    (insert (propertize (format format count)\r
123 > >                     'face 'notmuch-search-count)))\r
124 > >     ((string-equal field "subject")\r
125 > > -    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) subject)\r
126 > > +    (insert (propertize (format format subject)\r
127 > >                     'face 'notmuch-search-subject)))\r
128 > >  \r
129 > >     ((string-equal field "authors")\r
130 > > -    (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))\r
131 > > +    (notmuch-search-insert-authors format authors))\r
132 > >  \r
133 > >     ((string-equal field "tags")\r
134 > > -    (insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")")))))\r
135 > > +    (insert\r
136 > > +     (format format (propertize tags 'font-lock-face 'notmuch-tag-face))))))\r
137 > >  \r
138 > >  (defun notmuch-search-show-result (date count authors subject tags)\r
139 > > -  (let ((fields) (field))\r
140 > > -    (setq fields (mapcar 'car notmuch-search-result-format))\r
141 > > -    (loop for field in fields\r
142 > > -     do (notmuch-search-insert-field field date count authors subject tags)))\r
143 > > +  (dolist (format notmuch-search-result-format)\r
144 > > +    (notmuch-search-insert-field (car format) (cdr format)\r
145 > > +                            date count authors subject tags))\r
146 > >    (insert "\n"))\r
147 > >  \r
148 > >  (defun notmuch-search-process-filter (proc string)\r