[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 7f / 06253cf835b6d6ac8d8d2d3ca4918d817db8b5
1 Return-Path: <jan@ryngle.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 6D3D7431FBF\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 14:10:35 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id pMATWfm5RZ+h for <notmuch@notmuchmail.org>;\r
11         Tue, 24 Nov 2009 14:10:35 -0800 (PST)\r
12 Received: from mail-fx0-f214.google.com (mail-fx0-f214.google.com\r
13         [209.85.220.214])\r
14         by olra.theworths.org (Postfix) with ESMTP id 35FB2431FC0\r
15         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 14:10:34 -0800 (PST)\r
16 Received: by mail-fx0-f214.google.com with SMTP id 6so7397311fxm.0\r
17         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 14:10:34 -0800 (PST)\r
18 Received: by 10.102.165.24 with SMTP id n24mr3020096mue.47.1259100633651;\r
19         Tue, 24 Nov 2009 14:10:33 -0800 (PST)\r
20 Received: from x61s.janakj (r2c34.net.upc.cz [62.245.66.34])\r
21         by mx.google.com with ESMTPS id b9sm3192794mug.9.2009.11.24.14.10.31\r
22         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
23         Tue, 24 Nov 2009 14:10:32 -0800 (PST)\r
24 Received: by x61s.janakj (Postfix, from userid 1000)\r
25         id BDB8044065A; Tue, 24 Nov 2009 23:10:30 +0100 (CET)\r
26 From: Jan Janak <jan@ryngle.com>\r
27 To: notmuch@notmuchmail.org\r
28 Date: Tue, 24 Nov 2009 23:10:30 +0100\r
29 Message-Id: <1259100630-13673-5-git-send-email-jan@ryngle.com>\r
30 X-Mailer: git-send-email 1.6.3.3\r
31 In-Reply-To: <1259100630-13673-4-git-send-email-jan@ryngle.com>\r
32 References: <1259100630-13673-1-git-send-email-jan@ryngle.com>\r
33         <1259100630-13673-2-git-send-email-jan@ryngle.com>\r
34         <1259100630-13673-3-git-send-email-jan@ryngle.com>\r
35         <1259100630-13673-4-git-send-email-jan@ryngle.com>\r
36 Subject: [notmuch] [PATCH 4/4] notmuch-new: New cmdline option --tag=<name>.\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.12\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Tue, 24 Nov 2009 22:10:35 -0000\r
50 \r
51 The list of tags to be applied by 'notmuch new' can be configured in\r
52 the configuration file. This command line option can be used to\r
53 override the list of tags from the coonfiguration file on the command\r
54 line. You may repeat the option several times if you want to apply\r
55 more than one tag:\r
56 \r
57   notmuch new --tag=apple --tag=orange\r
58 \r
59 This is useful, for example, if you have an archive of messages you\r
60 would like to add to the database with a special tag so that they can\r
61 be easily identified later. To do that, you could simply copy the files\r
62 from the archive to the database directory and then index them all with:\r
63 \r
64   notmuch new --tag=prehistory\r
65 \r
66 Tags to be applied every time 'notmuch new' is run can be specified in\r
67 the configuration file. One-time tags for individual runs can be\r
68 specified on the command line with this new option.\r
69 \r
70 Signed-off-by: Jan Janak <jan@ryngle.com>\r
71 ---\r
72  notmuch-new.c |   40 ++++++++++++++++++++++++++++++++++------\r
73  notmuch.c     |    8 +++++++-\r
74  2 files changed, 41 insertions(+), 7 deletions(-)\r
75 \r
76 diff --git a/notmuch-new.c b/notmuch-new.c\r
77 index 10745e8..94036da 100644\r
78 --- a/notmuch-new.c\r
79 +++ b/notmuch-new.c\r
80 @@ -26,6 +26,9 @@ static volatile sig_atomic_t do_add_files_print_progress = 0;\r
81  \r
82  static notmuch_config_t *config = NULL;\r
83  \r
84 +static char **cmdline_tags = NULL;\r
85 +static unsigned int cmdline_tags_count = 0;\r
86 +\r
87  static void\r
88  handle_sigalrm (unused (int signal))\r
89  {\r
90 @@ -76,12 +79,19 @@ apply_tags (notmuch_message_t *message)\r
91      char** tags;\r
92      unsigned int count, i;\r
93  \r
94 -    if ((tags = notmuch_config_get_new_tags (config, &count)) == NULL)\r
95 -       return;\r
96 +    if (cmdline_tags_count) {\r
97 +       for (i = 0; i < cmdline_tags_count; i++) {\r
98 +           if (cmdline_tags[i])\r
99 +               notmuch_message_add_tag (message, cmdline_tags[i]);\r
100 +       }\r
101 +    } else {\r
102 +       if ((tags = notmuch_config_get_new_tags (config, &count)) == NULL)\r
103 +           return;\r
104  \r
105 -    for (i = 0; i < count; i++) {\r
106 -       if (tags[i])\r
107 -           notmuch_message_add_tag (message, tags[i]);\r
108 +       for (i = 0; i < count; i++) {\r
109 +           if (tags[i])\r
110 +               notmuch_message_add_tag (message, tags[i]);\r
111 +       }\r
112      }\r
113  }\r
114  \r
115 @@ -413,7 +423,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[])\r
116      int ret = 0;\r
117      struct stat st;\r
118      const char *db_path;\r
119 -    char *dot_notmuch_path;\r
120 +    char *dot_notmuch_path, *opt;\r
121 +    char **tmp;\r
122      struct sigaction action;\r
123      int i;\r
124  \r
125 @@ -423,6 +434,23 @@ notmuch_new_command (void *ctx, int argc, char *argv[])\r
126      for (i = 0; i < argc && argv[i][0] == '-'; i++) {\r
127         if (STRNCMP_LITERAL (argv[i], "--verbose") == 0) {\r
128             add_files_state.verbose = 1;\r
129 +       } else if (STRNCMP_LITERAL (argv[i], "--tag=") == 0) {\r
130 +           opt = argv[i] + sizeof ("--tag=") - 1;\r
131 +           /* FIXME: We should check for leading and trailing white-space in\r
132 +            * option value here and remove it.\r
133 +            */\r
134 +           if (*opt == '\0') {\r
135 +               fprintf (stderr, "Option value missing: %s\n", argv[i]);\r
136 +               return 1;\r
137 +           }\r
138 +           tmp = talloc_realloc (ctx, cmdline_tags, char*,\r
139 +                                 cmdline_tags_count + 1);\r
140 +           if (tmp == NULL) {\r
141 +               fprintf (stderr, "Notmuch ran out of memory.\n");\r
142 +               return 1;\r
143 +           }\r
144 +           tmp[cmdline_tags_count++] = opt;\r
145 +           cmdline_tags = tmp;\r
146         } else {\r
147             fprintf (stderr, "Unrecognized option: %s\n", argv[i]);\r
148             return 1;\r
149 diff --git a/notmuch.c b/notmuch.c\r
150 index b84e284..fb0c2a7 100644\r
151 --- a/notmuch.c\r
152 +++ b/notmuch.c\r
153 @@ -123,7 +123,7 @@ command_t commands[] = {\r
154        "\t\tInvoking notmuch with no command argument will run setup if\n"\r
155        "\t\tthe setup command has not previously been completed." },\r
156      { "new", notmuch_new_command,\r
157 -      "[--verbose]",\r
158 +      "[--verbose] [--tag=<name>]",\r
159        "\t\tFind and import new messages to the notmuch database.",\r
160        "\t\tScans all sub-directories of the mail directory, performing\n"\r
161        "\t\tfull-text indexing on new messages that are found. Each new\n"\r
162 @@ -145,6 +145,12 @@ command_t commands[] = {\r
163        "\t\t\tVerbose operation. Shows paths of message files as\n"\r
164        "\t\t\tthey are being indexed.\n"\r
165        "\n"\r
166 +      "\t\t--tag=<name>\n"\r
167 +      "\n"\r
168 +      "\t\t\tAdd the tag <name> to all messages newly added to the\n"\r
169 +      "\t\t\tdatabase. You may repeat this option several times if\n"\r
170 +      "\t\t\tyou want to add more tags.\n"\r
171 +      "\n"\r
172        "\t\tNote: \"notmuch new\" runs (other than the first run) will\n"\r
173        "\t\tskip any read-only directories, so you can use that to mark\n"\r
174        "\t\tdirectories that will not receive any new mail (and make\n"\r
175 -- \r
176 1.6.3.3\r
177 \r