Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / a2 / 3481b5bb55a7a55d4fee3beed478dfaf530afa
1 Return-Path: <bgamari.foss@gmail.com>\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 9E8BF431FC2\r
6         for <notmuch@notmuchmail.org>; Mon, 20 Aug 2012 08:31:56 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id HuMc7I9uRH6a for <notmuch@notmuchmail.org>;\r
17         Mon, 20 Aug 2012 08:31:56 -0700 (PDT)\r
18 Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com\r
19         [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id EA1BB431FBD\r
22         for <notmuch@notmuchmail.org>; Mon, 20 Aug 2012 08:31:55 -0700 (PDT)\r
23 Received: by vbbfc26 with SMTP id fc26so5986842vbb.26\r
24         for <notmuch@notmuchmail.org>; Mon, 20 Aug 2012 08:31:55 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
27         :mime-version:content-type:content-transfer-encoding;\r
28         bh=W4VCSYkTSHtM0q7CnkAV8Hnjg8fIkYv34UXj92C2Dlw=;\r
29         b=0dcjPiOL6PFt5EiyktbPaHf8cysztAiUU3NWQF62wrP/EXF/PpZxIh1Z3zewTzFMln\r
30         /qzpZCc6cxkB2jDt7MIi24MCtTgwSOr4o3Sk5WLhS3rVlwO4/MppjoZGWbehfd9IswsS\r
31         KiIXti+sPbZnoef4fhbJ7X1ABjaWtJ5Shka6OFO94WHhbVjkEAvJkEhwVVQz7YAYRnZ7\r
32         6+nBU0YnljQb+TmI2Zd/Y1JPvJUBYqp+NDt5AoEhz6LqVxVD8cZHkAg3hkH/fWWoGxBt\r
33         iTZoZfHi76Bw6F5pz11LB4DDX5yrN3CqcXr7NH7aY58EJv040OvGh6PFHgyLI71LcwMo\r
34         jy7A==\r
35 Received: by 10.52.72.44 with SMTP id a12mr3953564vdv.124.1345476715154;\r
36         Mon, 20 Aug 2012 08:31:55 -0700 (PDT)\r
37 Received: from localhost.localdomain\r
38         (pool-108-8-230-85.spfdma.east.verizon.net. [108.8.230.85])\r
39         by mx.google.com with ESMTPS id g10sm5430786vdk.2.2012.08.20.08.31.54\r
40         (version=SSLv3 cipher=OTHER); Mon, 20 Aug 2012 08:31:54 -0700 (PDT)\r
41 From: Ben Gamari <bgamari.foss@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: =?UTF-8?q?=5BPATCH=203/3=5D=20Add=20notmuch=20compact=20command?=\r
44 Date: Mon, 20 Aug 2012 11:31:44 -0400\r
45 Message-Id: <1345476704-17091-4-git-send-email-bgamari.foss@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.5\r
47 In-Reply-To: <1345476704-17091-1-git-send-email-bgamari.foss@gmail.com>\r
48 References: <1345476704-17091-1-git-send-email-bgamari.foss@gmail.com>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=UTF-8\r
51 Content-Transfer-Encoding: 8bit\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Mon, 20 Aug 2012 15:31:56 -0000\r
65 \r
66 ---\r
67  Makefile.local    |    1 +\r
68  notmuch-client.h  |    3 +++\r
69  notmuch-compact.c |   43 +++++++++++++++++++++++++++++++++++++++++++\r
70  notmuch.c         |    3 +++\r
71  4 files changed, 50 insertions(+)\r
72  create mode 100644 notmuch-compact.c\r
73 \r
74 diff --git a/Makefile.local b/Makefile.local\r
75 index de984ab..848605d 100644\r
76 --- a/Makefile.local\r
77 +++ b/Makefile.local\r
78 @@ -278,6 +278,7 @@ notmuch_client_srcs =               \\r
79         gmime-filter-headers.c  \\r
80         hooks.c                 \\r
81         notmuch.c               \\r
82 +       notmuch-compact.c       \\r
83         notmuch-config.c        \\r
84         notmuch-count.c         \\r
85         notmuch-dump.c          \\r
86 diff --git a/notmuch-client.h b/notmuch-client.h\r
87 index ae9344b..a6c624b 100644\r
88 --- a/notmuch-client.h\r
89 +++ b/notmuch-client.h\r
90 @@ -157,6 +157,9 @@ int\r
91  notmuch_cat_command (void *ctx, int argc, char *argv[]);\r
92  \r
93  int\r
94 +notmuch_compact_command (void *ctx, int argc, char *argv[]);\r
95 +\r
96 +int\r
97  notmuch_config_command (void *ctx, int argc, char *argv[]);\r
98  \r
99  const char *\r
100 diff --git a/notmuch-compact.c b/notmuch-compact.c\r
101 new file mode 100644\r
102 index 0000000..6deb2ec\r
103 --- /dev/null\r
104 +++ b/notmuch-compact.c\r
105 @@ -0,0 +1,43 @@\r
106 +/* notmuch - Not much of an email program, (just index and search)\r
107 + *\r
108 + * Copyright © 2009 Carl Worth\r
109 + *\r
110 + * This program is free software: you can redistribute it and/or modify\r
111 + * it under the terms of the GNU General Public License as published by\r
112 + * the Free Software Foundation, either version 3 of the License, or\r
113 + * (at your option) any later version.\r
114 + *\r
115 + * This program is distributed in the hope that it will be useful,\r
116 + * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
117 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
118 + * GNU General Public License for more details.\r
119 + *\r
120 + * You should have received a copy of the GNU General Public License\r
121 + * along with this program.  If not, see http://www.gnu.org/licenses/ .\r
122 + *\r
123 + * Author: Carl Worth <cworth@cworth.org>\r
124 + */\r
125 +\r
126 +#include "notmuch-client.h"\r
127 +\r
128 +int\r
129 +notmuch_compact_command (void *ctx, unused (int argc), unused (char *argv[]))\r
130 +{\r
131 +    notmuch_config_t *config;\r
132 +    notmuch_database_t *notmuch;\r
133 +\r
134 +    config = notmuch_config_open (ctx, NULL, NULL);\r
135 +    if (config == NULL)\r
136 +       return 1;\r
137 +\r
138 +    if (notmuch_database_open (notmuch_config_get_database_path (config),\r
139 +                              NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch))\r
140 +       return 1;\r
141 +\r
142 +    printf ("Compacting database... ");\r
143 +    notmuch_database_close_compact (notmuch);\r
144 +    printf ("Done.\n");\r
145 +    notmuch_database_destroy (notmuch);\r
146 +\r
147 +    return 0;\r
148 +}\r
149 diff --git a/notmuch.c b/notmuch.c\r
150 index 477a09c..7b6c5ae 100644\r
151 --- a/notmuch.c\r
152 +++ b/notmuch.c\r
153 @@ -74,6 +74,9 @@ static command_t commands[] = {\r
154      { "restore", notmuch_restore_command,\r
155        "[--accumulate] [<filename>]",\r
156        "Restore the tags from the given dump file (see 'dump')." },\r
157 +    { "compact", notmuch_compact_command,\r
158 +      NULL,\r
159 +      "Compacts the database." },\r
160      { "config", notmuch_config_command,\r
161        "[get|set] <section>.<item> [value ...]",\r
162        "Get or set settings in the notmuch configuration file." },\r
163 -- \r
164 1.7.9.5\r
165 \r