Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / bd / 2cb0e4de02e19cdbb0048ad8244a56cb4aafab
1 Return-Path: <bremner@unb.ca>\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 030D2429E25\r
6         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 05:08:25 -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: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] 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 fWIA1bxNgt-7 for <notmuch@notmuchmail.org>;\r
16         Thu, 12 Jan 2012 05:08:24 -0800 (PST)\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 24C7F431FB6\r
21         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 05:08:23 -0800 (PST)\r
22 Received: from zancas.localnet\r
23         (fctnnbsc36w-156034076032.pppoe-dynamic.High-Speed.nb.bellaliant.net\r
24         [156.34.76.32]) (authenticated bits=0)\r
25         by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id q0CD8JVL009667\r
26         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);\r
27         Thu, 12 Jan 2012 09:08:20 -0400\r
28 Received: from bremner by zancas.localnet with local (Exim 4.77)\r
29         (envelope-from <bremner@unb.ca>)\r
30         id 1RlKOA-00042r-Tz; Thu, 12 Jan 2012 09:08:18 -0400\r
31 From: David Bremner <david@tethera.net>\r
32 To: Austin Clements <amdragon@MIT.EDU>\r
33 Subject: Re: [PATCH 2/2] notmuch-reply.c: uncrustify\r
34 In-Reply-To: <20120112035739.GW20796@mit.edu>\r
35 References: <1324135695-15487-1-git-send-email-david@tethera.net>\r
36         <1326197228-10356-1-git-send-email-david@tethera.net>\r
37         <1326197228-10356-3-git-send-email-david@tethera.net>\r
38         <20120112035739.GW20796@mit.edu>\r
39 User-Agent: Notmuch/0.11~rc3 (http://notmuchmail.org) Emacs/23.3.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Thu, 12 Jan 2012 09:08:18 -0400\r
42 Message-ID: <87r4z56pbx.fsf@zancas.localnet>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 Cc: notmuch@notmuchmail.org\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Thu, 12 Jan 2012 13:08:25 -0000\r
59 \r
60 On Wed, 11 Jan 2012 22:57:39 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
61 > > From: David Bremner <bremner@debian.org>\r
62 > > \r
63 > > This patch shows the raw result of running uncrustify on notmuch-reply.c.\r
64 > > The re-indenting of "format_reply" would probably not be desirable.\r
65\r
66 > The good news is that that structure is on its way out.\r
67\r
68 > > @@ -625,6 +612,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
69 > >      notmuch_query_t *query;\r
70 > >      char *query_string;\r
71 > >      int opt_index, ret = 0;\r
72 > > +\r
73\r
74 > This one's a little weird.  Did it get confused by the function\r
75 > prototype?\r
76 \r
77 Yes, I think it is thinking the block of variable declarations ends\r
78 there.\r
79 \r
80 > All of the other format fixes look very reasonable to me.  I think you\r
81 > managed to find one of the least canonical source files in the tree.\r
82 > Was that intentional?\r
83 \r
84 Yes, I expect there would be less changes elsewhere. Although the\r
85 changes might be more controversial, I guess. \r
86 \r
87 The corresponding diff for notmuch-search.c follows\r
88 \r
89 diff --git a/notmuch-search.c b/notmuch-search.c\r
90 index 4baab56..8928e62 100644\r
91 --- a/notmuch-search.c\r
92 +++ b/notmuch-search.c\r
93 @@ -31,16 +31,16 @@ typedef enum {\r
94  typedef struct search_format {\r
95      const char *results_start;\r
96      const char *item_start;\r
97 -    void (*item_id) (const void *ctx,\r
98 -                    const char *item_type,\r
99 -                    const char *item_id);\r
100 -    void (*thread_summary) (const void *ctx,\r
101 -                           const char *thread_id,\r
102 -                           const time_t date,\r
103 -                           const int matched,\r
104 -                           const int total,\r
105 -                           const char *authors,\r
106 -                           const char *subject);\r
107 +    void (*item_id)(const void *ctx,\r
108 +                   const char *item_type,\r
109 +                   const char *item_id);\r
110 +    void (*thread_summary)(const void *ctx,\r
111 +                          const char *thread_id,\r
112 +                          const time_t date,\r
113 +                          const int matched,\r
114 +                          const int total,\r
115 +                          const char *authors,\r
116 +                          const char *subject);\r
117      const char *tag_start;\r
118      const char *tag;\r
119      const char *tag_sep;\r
120 @@ -66,13 +66,13 @@ format_thread_text (const void *ctx,\r
121                     const char *subject);\r
122  static const search_format_t format_text = {\r
123      "",\r
124 -       "",\r
125 -           format_item_id_text,\r
126 -           format_thread_text,\r
127 -           " (",\r
128 -               "%s", " ",\r
129 -           ")", "\n",\r
130 -       "",\r
131 +    "",\r
132 +    format_item_id_text,\r
133 +    format_thread_text,\r
134 +    " (",\r
135 +    "%s", " ",\r
136 +    ")", "\n",\r
137 +    "",\r
138      "\n",\r
139      "",\r
140  };\r
141 @@ -92,13 +92,13 @@ format_thread_json (const void *ctx,\r
142                     const char *subject);\r
143  static const search_format_t format_json = {\r
144      "[",\r
145 -       "{",\r
146 -           format_item_id_json,\r
147 -           format_thread_json,\r
148 -           "\"tags\": [",\r
149 -               "\"%s\"", ", ",\r
150 -           "]", ",\n",\r
151 -       "}",\r
152 +    "{",\r
153 +    format_item_id_json,\r
154 +    format_thread_json,\r
155 +    "\"tags\": [",\r
156 +    "\"%s\"", ", ",\r
157 +    "]", ",\n",\r
158 +    "}",\r
159      "]\n",\r
160      "]\n",\r
161  };\r
162 @@ -122,7 +122,7 @@ sanitize_string (const void *ctx, const char *str)\r
163      loop = out = talloc_strdup (ctx, str);\r
164  \r
165      for (; *loop; loop++) {\r
166 -       if ((unsigned char)(*loop) < 32)\r
167 +       if ((unsigned char) (*loop) < 32)\r
168             *loop = '?';\r
169      }\r
170      return out;\r
171 @@ -160,7 +160,7 @@ format_item_id_json (const void *ctx,\r
172      printf ("%s", json_quote_str (ctx_quote, item_id));\r
173  \r
174      talloc_free (ctx_quote);\r
175 -    \r
176 +\r
177  }\r
178  \r
179  static void\r
180 @@ -221,8 +221,7 @@ do_search_threads (const search_format_t *format,\r
181  \r
182      for (i = 0;\r
183          notmuch_threads_valid (threads) && (limit < 0 || i < offset + limit);\r
184 -        notmuch_threads_move_to_next (threads), i++)\r
185 -    {\r
186 +        notmuch_threads_move_to_next (threads), i++) {\r
187         int first_tag = 1;\r
188  \r
189         thread = notmuch_threads_get (threads);\r
190 @@ -232,7 +231,7 @@ do_search_threads (const search_format_t *format,\r
191             continue;\r
192         }\r
193  \r
194 -       if (! first_thread)\r
195 +       if (!first_thread)\r
196             fputs (format->item_sep, stdout);\r
197  \r
198         if (output == OUTPUT_THREADS) {\r
199 @@ -258,9 +257,8 @@ do_search_threads (const search_format_t *format,\r
200  \r
201             for (tags = notmuch_thread_get_tags (thread);\r
202                  notmuch_tags_valid (tags);\r
203 -                notmuch_tags_move_to_next (tags))\r
204 -           {\r
205 -               if (! first_tag)\r
206 +                notmuch_tags_move_to_next (tags)) {\r
207 +               if (!first_tag)\r
208                     fputs (format->tag_sep, stdout);\r
209                 printf (format->tag, notmuch_tags_get (tags));\r
210                 first_tag = 0;\r
211 @@ -311,8 +309,7 @@ do_search_messages (const search_format_t *format,\r
212  \r
213      for (i = 0;\r
214          notmuch_messages_valid (messages) && (limit < 0 || i < offset + limit);\r
215 -        notmuch_messages_move_to_next (messages), i++)\r
216 -    {\r
217 +        notmuch_messages_move_to_next (messages), i++) {\r
218         if (i < offset)\r
219             continue;\r
220  \r
221 @@ -323,9 +320,8 @@ do_search_messages (const search_format_t *format,\r
222  \r
223             for (;\r
224                  notmuch_filenames_valid (filenames);\r
225 -                notmuch_filenames_move_to_next (filenames))\r
226 -           {\r
227 -               if (! first_message)\r
228 +                notmuch_filenames_move_to_next (filenames)) {\r
229 +               if (!first_message)\r
230                     fputs (format->item_sep, stdout);\r
231  \r
232                 format->item_id (message, "",\r
233 @@ -333,11 +329,11 @@ do_search_messages (const search_format_t *format,\r
234  \r
235                 first_message = 0;\r
236             }\r
237 -           \r
238 -           notmuch_filenames_destroy( filenames );\r
239 +\r
240 +           notmuch_filenames_destroy ( filenames );\r
241  \r
242         } else { /* output == OUTPUT_MESSAGES */\r
243 -           if (! first_message)\r
244 +           if (!first_message)\r
245                 fputs (format->item_sep, stdout);\r
246  \r
247             format->item_id (message, "id:",\r
248 @@ -385,11 +381,10 @@ do_search_tags (notmuch_database_t *notmuch,\r
249  \r
250      for (;\r
251          notmuch_tags_valid (tags);\r
252 -        notmuch_tags_move_to_next (tags))\r
253 -    {\r
254 +        notmuch_tags_move_to_next (tags)) {\r
255         tag = notmuch_tags_get (tags);\r
256  \r
257 -       if (! first_tag)\r
258 +       if (!first_tag)\r
259             fputs (format->item_sep, stdout);\r
260  \r
261         format->item_id (tags, "", tag);\r
262 @@ -425,7 +420,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
263      int limit = -1; /* unlimited */\r
264  \r
265      enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
266 -       format_sel = NOTMUCH_FORMAT_TEXT;\r
267 +    format_sel = NOTMUCH_FORMAT_TEXT;\r
268  \r
269      notmuch_opt_desc_t options[] = {\r
270         { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's',\r
271 @@ -472,7 +467,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
272      if (notmuch == NULL)\r
273         return 1;\r
274  \r
275 -    query_str = query_string_from_args (notmuch, argc-opt_index, argv+opt_index);\r
276 +    query_str = query_string_from_args (notmuch, argc - opt_index, argv + opt_index);\r
277      if (query_str == NULL) {\r
278         fprintf (stderr, "Out of memory.\n");\r
279         return 1;\r