[PATCH 1/4] Add user.other_name property to associate names with other_email.
[notmuch-archives.git] / 53 / 005cda3a4298ab34198aea43534f313f5c1f55
1 Return-Path: <bremner@tethera.net>\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 arlo.cworth.org (Postfix) with ESMTP id DD6886DE092B\r
6  for <notmuch@notmuchmail.org>; Sat, 30 Apr 2016 18:25:03 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.015\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.015 tagged_above=-999 required=5\r
12  tests=[AWL=-0.004, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]\r
13  autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id EFb3i-5C0av6 for <notmuch@notmuchmail.org>;\r
17  Sat, 30 Apr 2016 18:24:56 -0700 (PDT)\r
18 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
19  by arlo.cworth.org (Postfix) with ESMTPS id EC8EE6DE025F\r
20  for <notmuch@notmuchmail.org>; Sat, 30 Apr 2016 18:24:47 -0700 (PDT)\r
21 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
22  (envelope-from <bremner@tethera.net>) id 1awg7k-0006bD-Ms\r
23  for notmuch@notmuchmail.org; Sat, 30 Apr 2016 21:24:40 -0400\r
24 Received: (nullmailer pid 29936 invoked by uid 1000);\r
25  Sun, 01 May 2016 01:24:43 -0000\r
26 From: David Bremner <david@tethera.net>\r
27 To: notmuch@notmuchmail.org\r
28 Subject: v3 of libconfig / single argument date / named query patches\r
29 Date: Sat, 30 Apr 2016 22:24:28 -0300\r
30 Message-Id: <1462065879-29860-1-git-send-email-david@tethera.net>\r
31 X-Mailer: git-send-email 2.8.0.rc3\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.20\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36  <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
38  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
43  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Sun, 01 May 2016 01:25:04 -0000\r
45 \r
46 The main difference here is responding to Tomi's comments about\r
47 "options" and rebasing against master. Rebasing was surprisingly\r
48 messy, so I might have botched something up.\r
49 \r
50 One thing to discuss is the dump/restore format. dkg has discussed\r
51 attaching some non-tag metadata to messages, so we may want to make\r
52 sure the changes are general enough to handle that.  If desired we\r
53 could add more "pseudo-comments" with #x where x is not @ to introduce\r
54 that metadata. I'm not sure how valuable this upward compatibility is;\r
55 I guess it would mainly allow us not maintain a third dump format.\r
56 \r
57 The first 3 patches are usable on their own.\r
58 \r
59 Interdiff follows.\r
60 \r
61 diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst\r
62 index c3470a8..5a517eb 100644\r
63 --- a/doc/man1/notmuch-config.rst\r
64 +++ b/doc/man1/notmuch-config.rst\r
65 @@ -132,9 +132,9 @@ The available configuration items are described below.\r
66      \r
67          Default: ``gpg``.\r
68  \r
69 -    **options.<name>**\r
70 +    **built_with.<name>**\r
71  \r
72 -       Compile time option <name>. Current possibilities include\r
73 +       Compile time feature <name>. Current possibilities include\r
74         "compact" (see **notmuch-compact(1)**)\r
75         and "field_processor" (see **notmuch-search-terms(7)**).\r
76  \r
77 diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst\r
78 index 7474f53..223031b 100644\r
79 --- a/doc/man7/notmuch-search-terms.rst\r
80 +++ b/doc/man7/notmuch-search-terms.rst\r
81 @@ -387,7 +387,7 @@ notmuch was built against a sufficiently recent version of Xapian by running\r
82  \r
83  ::\r
84  \r
85 -  % notmuch config get options.field_processor\r
86 +  % notmuch config get built_with.field_processor\r
87  \r
88  Currently the following features require field processor support:\r
89  \r
90 diff --git a/lib/Makefile.local b/lib/Makefile.local\r
91 index fab1242..35caa3e 100644\r
92 --- a/lib/Makefile.local\r
93 +++ b/lib/Makefile.local\r
94 @@ -39,7 +39,7 @@ libnotmuch_c_srcs =           \\r
95         $(dir)/message-file.c   \\r
96         $(dir)/messages.c       \\r
97         $(dir)/sha1.c           \\r
98 -       $(dir)/options.c        \\r
99 +       $(dir)/built-with.c     \\r
100         $(dir)/tags.c\r
101  \r
102  libnotmuch_cxx_srcs =          \\r
103 diff --git a/lib/options.c b/lib/built-with.c\r
104 similarity index 69%\r
105 rename from lib/options.c\r
106 rename to lib/built-with.c\r
107 index 4e15d92..b619bed 100644\r
108 --- a/lib/options.c\r
109 +++ b/lib/built-with.c\r
110 @@ -22,28 +22,11 @@\r
111  #include "notmuch-private.h"\r
112  \r
113  notmuch_bool_t\r
114 -notmuch_options_present (notmuch_option_t mask)\r
115 -{\r
116 -    notmuch_option_t present = 0;\r
117 -\r
118 -#if HAVE_XAPIAN_COMPACT\r
119 -    present |= NOTMUCH_OPTION_COMPACT;\r
120 -#endif\r
121 -\r
122 -#if HAVE_XAPIAN_COMPACT\r
123 -    present |= NOTMUCH_OPTION_FIELD_PROCESSOR;\r
124 -#endif\r
125 -\r
126 -    return (mask & present) != 0;\r
127 -\r
128 -}\r
129 -\r
130 -notmuch_bool_t\r
131 -notmuch_options_get (const char *name) {\r
132 +notmuch_built_with (const char *name) {\r
133      if (STRNCMP_LITERAL (name, "compact") == 0) {\r
134 -       return notmuch_options_present (NOTMUCH_OPTION_COMPACT);\r
135 +       return HAVE_XAPIAN_COMPACT;\r
136      } else if (STRNCMP_LITERAL (name, "field_processor") == 0) {\r
137 -       return notmuch_options_present (NOTMUCH_OPTION_FIELD_PROCESSOR);\r
138 +       return HAVE_XAPIAN_FIELD_PROCESSOR;\r
139      } else {\r
140         return FALSE;\r
141      }\r
142 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
143 index 2278822..bd977c3 100644\r
144 --- a/lib/notmuch.h\r
145 +++ b/lib/notmuch.h\r
146 @@ -1902,16 +1902,11 @@ notmuch_config_list_move_to_next (notmuch_config_list_t *config_list);\r
147  void\r
148  notmuch_config_list_destroy (notmuch_config_list_t *config_list);\r
149  \r
150 -typedef enum {\r
151 -    NOTMUCH_OPTION_COMPACT = 1,\r
152 -    NOTMUCH_OPTION_FIELD_PROCESSOR = 2\r
153 -} notmuch_option_t;\r
154 -\r
155 -notmuch_bool_t\r
156 -notmuch_options_present (notmuch_option_t mask);\r
157 -\r
158 +/**\r
159 + * interrogate the library for compile time features\r
160 + */\r
161  notmuch_bool_t\r
162 -notmuch_options_get (const char *name);\r
163 +notmuch_built_with (const char *name);\r
164  /* @} */\r
165  \r
166  NOTMUCH_END_DECLS\r
167 diff --git a/notmuch-config.c b/notmuch-config.c\r
168 index 121fec6..e4f47e4 100644\r
169 --- a/notmuch-config.c\r
170 +++ b/notmuch-config.c\r
171 @@ -750,7 +750,7 @@ _item_split (char *item, char **group, char **key)\r
172      return 0;\r
173  }\r
174  \r
175 -#define OPTION_PREFIX "options."\r
176 +#define BUILT_WITH_PREFIX "built_with."\r
177  #define QUERY_PREFIX "query."\r
178  \r
179  static int\r
180 @@ -797,9 +797,9 @@ notmuch_config_command_get (notmuch_config_t *config, char *item)\r
181         tags = notmuch_config_get_new_tags (config, &length);\r
182         for (i = 0; i < length; i++)\r
183             printf ("%s\n", tags[i]);\r
184 -    } else if (STRNCMP_LITERAL (item, OPTION_PREFIX) == 0) {\r
185 +    } else if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) {\r
186         printf ("%s\n",\r
187 -              notmuch_options_get (item + strlen (OPTION_PREFIX)) ? "true" : "false");\r
188 +               notmuch_built_with (item + strlen (BUILT_WITH_PREFIX)) ? "true" : "false");\r
189      } else if (STRNCMP_LITERAL (item, QUERY_PREFIX) == 0) {\r
190         return _print_db_config (config, item);\r
191      } else {\r
192 @@ -866,7 +866,7 @@ notmuch_config_command_set (notmuch_config_t *config, char *item, int argc, char\r
193  {\r
194      char *group, *key;\r
195  \r
196 -    if (STRNCMP_LITERAL (item, OPTION_PREFIX) == 0) {\r
197 +    if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) {\r
198         fprintf (stderr, "Error: read only option: %s\n", item);\r
199         return 1;\r
200      }\r
201 @@ -904,10 +904,12 @@ notmuch_config_command_set (notmuch_config_t *config, char *item, int argc, char\r
202  static\r
203  void\r
204  _notmuch_config_list_options () {\r
205 -    printf("options.compact=%s\n",\r
206 -          notmuch_options_present(NOTMUCH_OPTION_COMPACT) ? "true" : "false");\r
207 -    printf("options.field_processor=%s\n",\r
208 -          notmuch_options_present(NOTMUCH_OPTION_FIELD_PROCESSOR) ? "true" : "false");\r
209 +    printf("%scompact=%s\n",\r
210 +          BUILT_WITH_PREFIX,\r
211 +          notmuch_built_with ("compact") ? "true" : "false");\r
212 +    printf("%sfield_processor=%s\n",\r
213 +          BUILT_WITH_PREFIX,\r
214 +          notmuch_built_with ("field_processor") ? "true" : "false");\r
215  }\r
216  \r
217  static int\r
218 diff --git a/test/T030-config.sh b/test/T030-config.sh\r
219 index 39ee885..b8d5a86 100755\r
220 --- a/test/T030-config.sh\r
221 +++ b/test/T030-config.sh\r
222 @@ -57,8 +57,8 @@ maildir.synchronize_flags=true\r
223  crypto.gpg_path=gpg\r
224  foo.string=this is another string value\r
225  foo.list=this;is another;list value;\r
226 -options.compact=something\r
227 -options.field_processor=something\r
228 +built_with.compact=something\r
229 +built_with.field_processor=something\r
230  EOF\r
231  test_expect_equal_file EXPECTED OUTPUT\r
232  \r
233 diff --git a/test/T040-setup.sh b/test/T040-setup.sh\r
234 index 5db03a6..be2f0db 100755\r
235 --- a/test/T040-setup.sh\r
236 +++ b/test/T040-setup.sh\r
237 @@ -19,7 +19,7 @@ another.suite@example.com\r
238  foo bar\r
239  baz\r
240  EOF\r
241 -output=$(notmuch --config=new-notmuch-config config list | notmuch_options_sanitize)\r
242 +output=$(notmuch --config=new-notmuch-config config list | notmuch_built_with_sanitize)\r
243  test_expect_equal "$output" "\\r
244  database.path=/path/to/maildir\r
245  user.name=Test Suite\r
246 @@ -30,7 +30,7 @@ new.ignore=\r
247  search.exclude_tags=baz;\r
248  maildir.synchronize_flags=true\r
249  crypto.gpg_path=gpg\r
250 -options.compact=something\r
251 -options.field_processor=something"\r
252 +built_with.compact=something\r
253 +built_with.field_processor=something"\r
254  \r
255  test_done\r
256 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
257 index b5a1941..e96c184 100644\r
258 --- a/test/test-lib.sh\r
259 +++ b/test/test-lib.sh\r
260 @@ -740,9 +740,9 @@ notmuch_uuid_sanitize ()\r
261      sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g'\r
262  }\r
263  \r
264 -notmuch_options_sanitize ()\r
265 +notmuch_built_with_sanitize ()\r
266  {\r
267 -    sed 's/^options[.]\(.*\)=.*$/options.\1=something/'\r
268 +    sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/'\r
269  }\r
270  \r
271  notmuch_config_sanitize ()\r