Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 5a / 3150a936749954243fbf98dc670932f6f730ae
1 Return-Path: <dkg@fifthhorseman.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 470296DE1BB2\r
6  for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:29 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.023\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.023 tagged_above=-999 required=5\r
12  tests=[AWL=-0.023] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id cbVrmHriodYZ for <notmuch@notmuchmail.org>;\r
16  Tue, 19 Jan 2016 18:53:27 -0800 (PST)\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
18  by arlo.cworth.org (Postfix) with ESMTP id 671516DE1601\r
19  for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:16 -0800 (PST)\r
20 Received: from fifthhorseman.net (unknown [38.109.115.130])\r
21  by che.mayfirst.org (Postfix) with ESMTPSA id CD2E9F991\r
22  for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 21:53:13 -0500 (EST)\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)\r
24  id F0CA1207E3; Tue, 19 Jan 2016 18:53:10 -0800 (PST)\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>\r
27 Subject: [PATCH v2 10/16] Add n_d_add_message_with_indexopts (extension of\r
28  n_d_add_message)\r
29 Date: Tue, 19 Jan 2016 21:52:43 -0500\r
30 Message-Id: <1453258369-7366-11-git-send-email-dkg@fifthhorseman.net>\r
31 X-Mailer: git-send-email 2.7.0.rc3\r
32 In-Reply-To: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>\r
33 References: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.20\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38  <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
40  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
45  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Wed, 20 Jan 2016 02:53:29 -0000\r
47 \r
48 Expose the ability to ask for index options via the library interface.\r
49 This _add_message_with_indexopts function is now a generalized form of\r
50 the older _add_message.  It lets you specify parameters and\r
51 configurations that can affect the indexing, like indexing encrypted\r
52 messages in the clear should the user choose to do so.\r
53 \r
54 We also adjust the tests so that we test the extended function\r
55 returning bad values (since the non-extended function just calls the\r
56 extended one).\r
57 ---\r
58  lib/database.cc     | 20 ++++++++++++++++----\r
59  lib/notmuch.h       | 14 ++++++++++++++\r
60  test/T070-insert.sh |  4 ++--\r
61  3 files changed, 32 insertions(+), 6 deletions(-)\r
62 \r
63 diff --git a/lib/database.cc b/lib/database.cc\r
64 index 7d88f69..990b0b1 100644\r
65 --- a/lib/database.cc\r
66 +++ b/lib/database.cc\r
67 @@ -2393,16 +2393,16 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,\r
68  }\r
69  \r
70  notmuch_status_t\r
71 -notmuch_database_add_message (notmuch_database_t *notmuch,\r
72 -                             const char *filename,\r
73 -                             notmuch_message_t **message_ret)\r
74 +notmuch_database_add_message_with_indexopts (notmuch_database_t *notmuch,\r
75 +                                            const char *filename,\r
76 +                                            notmuch_indexopts_t *indexopts,\r
77 +                                            notmuch_message_t **message_ret)\r
78  {\r
79      notmuch_message_file_t *message_file;\r
80      notmuch_message_t *message = NULL;\r
81      notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS, ret2;\r
82      notmuch_private_status_t private_status;\r
83      notmuch_bool_t is_ghost = false;\r
84 -    notmuch_indexopts_t *indexopts = NULL;\r
85  \r
86      const char *date, *header;\r
87      const char *from, *to, *subject;\r
88 @@ -2552,6 +2552,18 @@ notmuch_database_add_message (notmuch_database_t *notmuch,\r
89      return ret;\r
90  }\r
91  \r
92 +\r
93 +notmuch_status_t\r
94 +notmuch_database_add_message (notmuch_database_t *notmuch,\r
95 +                             const char *filename,\r
96 +                             notmuch_message_t **message_ret)\r
97 +{\r
98 +    return notmuch_database_add_message_with_indexopts (notmuch, filename,\r
99 +                                                       NULL,\r
100 +                                                       message_ret);\r
101 +    \r
102 +}\r
103 +\r
104  notmuch_status_t\r
105  notmuch_database_remove_message (notmuch_database_t *notmuch,\r
106                                  const char *filename)\r
107 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
108 index 3679c54..854a451 100644\r
109 --- a/lib/notmuch.h\r
110 +++ b/lib/notmuch.h\r
111 @@ -588,6 +588,20 @@ notmuch_status_t\r
112  notmuch_database_add_message (notmuch_database_t *database,\r
113                               const char *filename,\r
114                               notmuch_message_t **message);\r
115 +/**\r
116 + * Add a new message to the given notmuch database or associate an\r
117 + * additional filename with an existing message using specified\r
118 + * options.\r
119 + * \r
120 + * This does the same thing as notmuch_database_add_message except\r
121 + * that it passes a pre-configured set of indexing options to indicate\r
122 + * how the specific message should be indexed.\r
123 + */\r
124 +notmuch_status_t\r
125 +notmuch_database_add_message_with_indexopts (notmuch_database_t *database,\r
126 +                                            const char *filename,\r
127 +                                            notmuch_indexopts_t *indexopts,\r
128 +                                            notmuch_message_t **message);\r
129  \r
130  /**\r
131   * Remove a message filename from the given notmuch database. If the\r
132 diff --git a/test/T070-insert.sh b/test/T070-insert.sh\r
133 index e7ec6a6..557f9d5 100755\r
134 --- a/test/T070-insert.sh\r
135 +++ b/test/T070-insert.sh\r
136 @@ -192,14 +192,14 @@ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \\r
137  gen_insert_msg\r
138  cat <<EOF > index-file-$code.gdb\r
139  set breakpoint pending on\r
140 -break notmuch_database_add_message\r
141 +break notmuch_database_add_message_with_indexopts\r
142  commands\r
143  return NOTMUCH_STATUS_$code\r
144  continue\r
145  end\r
146  run\r
147  EOF\r
148 -test_begin_subtest "error exit when add_message returns $code"\r
149 +test_begin_subtest "error exit when add_message_with_indexopts returns $code"\r
150  gdb --batch-silent --return-child-result -x index-file-$code.gdb \\r
151      --args notmuch insert  < $gen_msg_filename\r
152  test_expect_equal $? 1\r
153 -- \r
154 2.7.0.rc3\r
155 \r