Re: [WIP PATCH] emacs: query: completion for from: in searches
[notmuch-archives.git] / 17 / 50c09bafecb4176a5f1fc40f68a2c86f3c9191
1 Return-Path: <adrien@bustany.org>\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 06E6B431FC4\r
6         for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 14:52:40 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 TdOMsd1PTqUk for <notmuch@notmuchmail.org>;\r
16         Wed, 17 Oct 2012 14:52:39 -0700 (PDT)\r
17 Received: from mail.bustany.org (bustany.org [176.31.244.208])\r
18         by olra.theworths.org (Postfix) with ESMTP id D48CC431FBD\r
19         for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 14:52:38 -0700 (PDT)\r
20 Received: from localhost.localdomain (91-158-5-86.elisa-laajakaista.fi\r
21         [91.158.5.86])\r
22         by mail.bustany.org (Postfix) with ESMTPSA id 319321401ED\r
23         for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 23:56:26 +0200 (CEST)\r
24 From: Adrien Bustany <adrien@bustany.org>\r
25 To: notmuch@notmuchmail.org\r
26 Subject: [PATCH 2/2] Add notmuch_database_reopen method\r
27 Date: Thu, 18 Oct 2012 00:52:22 +0300\r
28 Message-Id: <1350510742-13447-3-git-send-email-adrien@bustany.org>\r
29 X-Mailer: git-send-email 1.7.11.7\r
30 In-Reply-To: <1350510742-13447-1-git-send-email-adrien@bustany.org>\r
31 References: <1342723401-26103-1-git-send-email-adrien@bustany.org>\r
32         <1350510742-13447-1-git-send-email-adrien@bustany.org>\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Wed, 17 Oct 2012 21:52:40 -0000\r
46 \r
47 Calling notmuch_database_reopen is needed to refresh the database\r
48 contents when the database on disk was modified by another\r
49 notmuch_database_t instance, for example in a different thread.\r
50 ---\r
51  lib/database.cc | 17 +++++++++++++++++\r
52  lib/notmuch.h   |  8 ++++++++\r
53  2 files changed, 25 insertions(+)\r
54 \r
55 diff --git a/lib/database.cc b/lib/database.cc\r
56 index 1b680ab..f27d57f 100644\r
57 --- a/lib/database.cc\r
58 +++ b/lib/database.cc\r
59 @@ -763,6 +763,23 @@ notmuch_database_flush(notmuch_database_t *notmuch)\r
60      return status;\r
61  }\r
62  \r
63 +notmuch_status_t\r
64 +notmuch_database_reopen(notmuch_database_t *notmuch)\r
65 +{\r
66 +    notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;\r
67 +\r
68 +    try {\r
69 +       if (notmuch->xapian_db != NULL)\r
70 +           (notmuch->xapian_db)->reopen ();\r
71 +    } catch (const Xapian::Error &error) {\r
72 +       fprintf(stderr, "A Xapian exception occured reopening the database: %s\n",\r
73 +               error.get_msg().c_str());\r
74 +       status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
75 +    }\r
76 +\r
77 +    return status;\r
78 +}\r
79 +\r
80  void\r
81  notmuch_database_close (notmuch_database_t *notmuch)\r
82  {\r
83 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
84 index aef5c56..51d6a9a 100644\r
85 --- a/lib/notmuch.h\r
86 +++ b/lib/notmuch.h\r
87 @@ -205,6 +205,14 @@ notmuch_database_open (const char *path,\r
88  notmuch_status_t\r
89  notmuch_database_flush (notmuch_database_t *database);\r
90  \r
91 +/* Refresh the database contents to the latest version.\r
92 + *\r
93 + * This is needed only if another instance of notmuch_database_t has\r
94 + * modified the database contents on disk.\r
95 + */\r
96 +notmuch_status_t\r
97 +notmuch_database_reopen (notmuch_database_t *database);\r
98 +\r
99  /* Close the given notmuch database.\r
100   *\r
101   * After notmuch_database_close has been called, calls to other\r
102 -- \r
103 1.7.11.7\r
104 \r