Re: notmuch-emacs should correctly handle signature status on reply
[notmuch-archives.git] / 77 / 123ae0a85e92902b1a28cc5f2972344caa2bdb
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 D82BD6DE092E\r
6  for <notmuch@notmuchmail.org>; Sat, 30 Apr 2016 18:25:05 -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 xjT_tt67AqQ5 for <notmuch@notmuchmail.org>;\r
17  Sat, 30 Apr 2016 18:24:58 -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 D74D86DE02AF\r
20  for <notmuch@notmuchmail.org>; Sat, 30 Apr 2016 18:24:48 -0700 (PDT)\r
21 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
22  (envelope-from <bremner@tethera.net>)\r
23  id 1awg7n-0006bj-Rf; Sat, 30 Apr 2016 21:24:43 -0400\r
24 Received: (nullmailer pid 29943 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: [Patch v3 03/11] lib/cli: add library API / CLI for compile time\r
29  options\r
30 Date: Sat, 30 Apr 2016 22:24:31 -0300\r
31 Message-Id: <1462065879-29860-4-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 2.8.0.rc3\r
33 In-Reply-To: <1462065879-29860-1-git-send-email-david@tethera.net>\r
34 References: <1462065879-29860-1-git-send-email-david@tethera.net>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain; charset=UTF-8\r
37 Content-Transfer-Encoding: 8bit\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.20\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42  <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
44  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
49  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sun, 01 May 2016 01:25:05 -0000\r
51 \r
52 This is intentionally low tech; if we have more than two options it may\r
53 make sense to build up what infrastructure is provided.\r
54 ---\r
55  doc/man1/notmuch-config.rst |  5 +++++\r
56  lib/Makefile.local          |  1 +\r
57  lib/built-with.c            | 33 +++++++++++++++++++++++++++++++++\r
58  lib/notmuch.h               |  5 +++++\r
59  notmuch-config.c            | 22 ++++++++++++++++++++++\r
60  test/T030-config.sh         |  6 ++++--\r
61  test/T040-setup.sh          |  6 ++++--\r
62  test/test-lib.sh            |  6 ++++++\r
63  8 files changed, 80 insertions(+), 4 deletions(-)\r
64  create mode 100644 lib/built-with.c\r
65 \r
66 diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst\r
67 index 40c1272..26a8eb1 100644\r
68 --- a/doc/man1/notmuch-config.rst\r
69 +++ b/doc/man1/notmuch-config.rst\r
70 @@ -132,6 +132,11 @@ The available configuration items are described below.\r
71      \r
72          Default: ``gpg``.\r
73  \r
74 +    **built_with.<name>**\r
75 +\r
76 +       Compile time feature <name>. Current possibilities include\r
77 +       "compact" (see **notmuch-compact(1)**)\r
78 +       and "field_processor" (see **notmuch-search-terms(7)**).\r
79  \r
80  ENVIRONMENT\r
81  ===========\r
82 diff --git a/lib/Makefile.local b/lib/Makefile.local\r
83 index 3a07090..36c3924 100644\r
84 --- a/lib/Makefile.local\r
85 +++ b/lib/Makefile.local\r
86 @@ -39,6 +39,7 @@ libnotmuch_c_srcs =           \\r
87         $(dir)/message-file.c   \\r
88         $(dir)/messages.c       \\r
89         $(dir)/sha1.c           \\r
90 +       $(dir)/built-with.c     \\r
91         $(dir)/tags.c\r
92  \r
93  libnotmuch_cxx_srcs =          \\r
94 diff --git a/lib/built-with.c b/lib/built-with.c\r
95 new file mode 100644\r
96 index 0000000..b619bed\r
97 --- /dev/null\r
98 +++ b/lib/built-with.c\r
99 @@ -0,0 +1,33 @@\r
100 +/* notmuch - Not much of an email program, (just index and search)\r
101 + *\r
102 + * Copyright © 2016 David Bremner\r
103 + *\r
104 + * This program is free software: you can redistribute it and/or modify\r
105 + * it under the terms of the GNU General Public License as published by\r
106 + * the Free Software Foundation, either version 3 of the License, or\r
107 + * (at your option) any later version.\r
108 + *\r
109 + * This program is distributed in the hope that it will be useful,\r
110 + * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
111 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
112 + * GNU General Public License for more details.\r
113 + *\r
114 + * You should have received a copy of the GNU General Public License\r
115 + * along with this program.  If not, see http://www.gnu.org/licenses/ .\r
116 + *\r
117 + * Author: David Bremner <david@tethera.net>\r
118 + */\r
119 +\r
120 +#include "notmuch.h"\r
121 +#include "notmuch-private.h"\r
122 +\r
123 +notmuch_bool_t\r
124 +notmuch_built_with (const char *name) {\r
125 +    if (STRNCMP_LITERAL (name, "compact") == 0) {\r
126 +       return HAVE_XAPIAN_COMPACT;\r
127 +    } else if (STRNCMP_LITERAL (name, "field_processor") == 0) {\r
128 +       return HAVE_XAPIAN_FIELD_PROCESSOR;\r
129 +    } else {\r
130 +       return FALSE;\r
131 +    }\r
132 +}\r
133 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
134 index cb46fc0..3a092ef 100644\r
135 --- a/lib/notmuch.h\r
136 +++ b/lib/notmuch.h\r
137 @@ -1838,6 +1838,11 @@ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);\r
138  void\r
139  notmuch_filenames_destroy (notmuch_filenames_t *filenames);\r
140  \r
141 +/**\r
142 + * interrogate the library for compile time features\r
143 + */\r
144 +notmuch_bool_t\r
145 +notmuch_built_with (const char *name);\r
146  /* @} */\r
147  \r
148  NOTMUCH_END_DECLS\r
149 diff --git a/notmuch-config.c b/notmuch-config.c\r
150 index d252bb2..97a46fa 100644\r
151 --- a/notmuch-config.c\r
152 +++ b/notmuch-config.c\r
153 @@ -750,6 +750,8 @@ _item_split (char *item, char **group, char **key)\r
154      return 0;\r
155  }\r
156  \r
157 +#define BUILT_WITH_PREFIX "built_with."\r
158 +\r
159  static int\r
160  notmuch_config_command_get (notmuch_config_t *config, char *item)\r
161  {\r
162 @@ -773,6 +775,9 @@ notmuch_config_command_get (notmuch_config_t *config, char *item)\r
163         tags = notmuch_config_get_new_tags (config, &length);\r
164         for (i = 0; i < length; i++)\r
165             printf ("%s\n", tags[i]);\r
166 +    } else if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) {\r
167 +       printf ("%s\n",\r
168 +               notmuch_built_with (item + strlen (BUILT_WITH_PREFIX)) ? "true" : "false");\r
169      } else {\r
170         char **value;\r
171         size_t i, length;\r
172 @@ -804,6 +809,11 @@ notmuch_config_command_set (notmuch_config_t *config, char *item, int argc, char\r
173  {\r
174      char *group, *key;\r
175  \r
176 +    if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) {\r
177 +       fprintf (stderr, "Error: read only option: %s\n", item);\r
178 +       return 1;\r
179 +    }\r
180 +\r
181      if (_item_split (item, &group, &key))\r
182         return 1;\r
183  \r
184 @@ -830,6 +840,17 @@ notmuch_config_command_set (notmuch_config_t *config, char *item, int argc, char\r
185      return notmuch_config_save (config);\r
186  }\r
187  \r
188 +static\r
189 +void\r
190 +_notmuch_config_list_options () {\r
191 +    printf("%scompact=%s\n",\r
192 +          BUILT_WITH_PREFIX,\r
193 +          notmuch_built_with ("compact") ? "true" : "false");\r
194 +    printf("%sfield_processor=%s\n",\r
195 +          BUILT_WITH_PREFIX,\r
196 +          notmuch_built_with ("field_processor") ? "true" : "false");\r
197 +}\r
198 +\r
199  static int\r
200  notmuch_config_command_list (notmuch_config_t *config)\r
201  {\r
202 @@ -865,6 +886,7 @@ notmuch_config_command_list (notmuch_config_t *config)\r
203  \r
204      g_strfreev (groups);\r
205  \r
206 +    _notmuch_config_list_options ();\r
207      return 0;\r
208  }\r
209  \r
210 diff --git a/test/T030-config.sh b/test/T030-config.sh\r
211 index f404908..a4e24c3 100755\r
212 --- a/test/T030-config.sh\r
213 +++ b/test/T030-config.sh\r
214 @@ -44,7 +44,7 @@ test_expect_equal "$(notmuch config get foo.nonexistent)" ""\r
215  \r
216  test_begin_subtest "List all items"\r
217  notmuch config set database.path "/canonical/path"\r
218 -output=$(notmuch config list)\r
219 +output=$(notmuch config list | notmuch_options_sanitize)\r
220  test_expect_equal "$output" "\\r
221  database.path=/canonical/path\r
222  user.name=Notmuch Test Suite\r
223 @@ -56,7 +56,9 @@ search.exclude_tags=\r
224  maildir.synchronize_flags=true\r
225  crypto.gpg_path=gpg\r
226  foo.string=this is another string value\r
227 -foo.list=this;is another;list value;"\r
228 +foo.list=this;is another;list value;\r
229 +built_with.compact=something\r
230 +built_with.field_processor=something"\r
231  \r
232  test_begin_subtest "Top level --config=FILE option"\r
233  cp "${NOTMUCH_CONFIG}" alt-config\r
234 diff --git a/test/T040-setup.sh b/test/T040-setup.sh\r
235 index cf0c00b..be2f0db 100755\r
236 --- a/test/T040-setup.sh\r
237 +++ b/test/T040-setup.sh\r
238 @@ -19,7 +19,7 @@ another.suite@example.com\r
239  foo bar\r
240  baz\r
241  EOF\r
242 -output=$(notmuch --config=new-notmuch-config config list)\r
243 +output=$(notmuch --config=new-notmuch-config config list | notmuch_built_with_sanitize)\r
244  test_expect_equal "$output" "\\r
245  database.path=/path/to/maildir\r
246  user.name=Test Suite\r
247 @@ -29,6 +29,8 @@ new.tags=foo;bar;\r
248  new.ignore=\r
249  search.exclude_tags=baz;\r
250  maildir.synchronize_flags=true\r
251 -crypto.gpg_path=gpg"\r
252 +crypto.gpg_path=gpg\r
253 +built_with.compact=something\r
254 +built_with.field_processor=something"\r
255  \r
256  test_done\r
257 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
258 index ac04b15..09f8731 100644\r
259 --- a/test/test-lib.sh\r
260 +++ b/test/test-lib.sh\r
261 @@ -733,6 +733,12 @@ notmuch_uuid_sanitize ()\r
262  {\r
263      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
264  }\r
265 +\r
266 +notmuch_built_with_sanitize ()\r
267 +{\r
268 +    sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/'\r
269 +}\r
270 +\r
271  # End of notmuch helper functions\r
272  \r
273  # Use test_set_prereq to tell that a particular prerequisite is available.\r
274 -- \r
275 2.8.0.rc3\r
276 \r