Re: [PATCH v6 4/6] emacs/mua: Generate improved cited text for replies
[notmuch-archives.git] / 23 / 08c34c5dcd85f2ba044fc9e7937caf546cdcd8
1 Return-Path: <dme@hotblack-desiato.hh.sledj.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 olra.theworths.org (Postfix) with ESMTP id 8640A429E3C\r
6         for <notmuch@notmuchmail.org>; Fri,  2 May 2014 05:15:06 -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.379\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.379 tagged_above=-999 required=5\r
12         tests=[NO_DNS_FOR_FROM=0.379] 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 jXlfq4CNC4yD for <notmuch@notmuchmail.org>;\r
16         Fri,  2 May 2014 05:15:04 -0700 (PDT)\r
17 Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net\r
18         [81.149.164.25])\r
19         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id B2A53429E34\r
22         for <notmuch@notmuchmail.org>; Fri,  2 May 2014 05:14:59 -0700 (PDT)\r
23 Received: from hotblack-desiato.hh.sledj.net (hotblack-desiato.hh.sledj.net\r
24         [172.16.100.105])\r
25         by disaster-area.hh.sledj.net (Postfix) with ESMTPSA id 048025005F2;\r
26         Fri,  2 May 2014 13:14:57 +0100 (BST)\r
27 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
28         id AA96E10345C; Fri,  2 May 2014 13:14:56 +0100 (BST)\r
29 From: David Edmondson <dme@dme.org>\r
30 To: notmuch@notmuchmail.org\r
31 Subject: [PATCH 2/5] notmuch-new: Allow the tags of new messages to be\r
32         manipulated.\r
33 Date: Fri,  2 May 2014 13:14:44 +0100\r
34 Message-Id: <1399032887-25896-2-git-send-email-dme@dme.org>\r
35 X-Mailer: git-send-email 1.9.2\r
36 In-Reply-To: <cuniopogz2l.fsf@hotblack-desiato.hh.sledj.net>\r
37 References: <cuniopogz2l.fsf@hotblack-desiato.hh.sledj.net>\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\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: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Fri, 02 May 2014 12:15:06 -0000\r
51 \r
52 Add support for specifying a set of tags to be added/removed from\r
53 messages added to the database by 'notmuch new'. These tags are\r
54 addition to those specified in .notmuch-config. They can be used to\r
55 override the pre-configured tags (e.g. -inbox).\r
56 ---\r
57  notmuch-new.c |  5 +++++\r
58  tag-util.c    | 20 +++++++++++++++-----\r
59  tag-util.h    | 15 +++++++++++++++\r
60  3 files changed, 35 insertions(+), 5 deletions(-)\r
61 \r
62 diff --git a/notmuch-new.c b/notmuch-new.c\r
63 index 2c3d680..b49e5b2 100644\r
64 --- a/notmuch-new.c\r
65 +++ b/notmuch-new.c\r
66 @@ -951,6 +951,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
67      add_files_state.tag_ops = tag_op_list_create (config);\r
68      db_path = notmuch_config_get_database_path (config);\r
69  \r
70 +    /* Add the configured tags to the list applied. */\r
71      for (i = 0; i < new_tags_length; i++) {\r
72         const char *error_msg;\r
73  \r
74 @@ -963,6 +964,10 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
75             return EXIT_FAILURE;\r
76      }\r
77  \r
78 +    /* Add any command line tags to the list applied. */\r
79 +    if (process_tag_command_line (argc - opt_index, &argv[opt_index], add_files_state.tag_ops) < 0)\r
80 +       return EXIT_FAILURE;\r
81 +\r
82      if (!no_hooks) {\r
83         ret = notmuch_run_hook (db_path, "pre-new");\r
84         if (ret)\r
85 diff --git a/tag-util.c b/tag-util.c\r
86 index 1dee2f3..94061f3 100644\r
87 --- a/tag-util.c\r
88 +++ b/tag-util.c\r
89 @@ -151,11 +151,9 @@ parse_tag_line (void *ctx, char *line,\r
90      return ret;\r
91  }\r
92  \r
93 -tag_parse_status_t\r
94 -parse_tag_command_line (void *ctx, int argc, char **argv,\r
95 -                       char **query_str, tag_op_list_t *tag_ops)\r
96 +int\r
97 +process_tag_command_line (int argc, char **argv, tag_op_list_t *tag_ops)\r
98  {\r
99 -\r
100      int i;\r
101  \r
102      for (i = 0; i < argc; i++) {\r
103 @@ -173,12 +171,24 @@ parse_tag_command_line (void *ctx, int argc, char **argv,\r
104         msg = illegal_tag (argv[i] + 1, is_remove);\r
105         if (msg) {\r
106             fprintf (stderr, "Error: %s\n", msg);\r
107 -           return TAG_PARSE_INVALID;\r
108 +           return -1;\r
109         }\r
110  \r
111         tag_op_list_append (tag_ops, argv[i] + 1, is_remove);\r
112      }\r
113  \r
114 +    return i;\r
115 +}\r
116 +\r
117 +tag_parse_status_t\r
118 +parse_tag_command_line (void *ctx, int argc, char **argv,\r
119 +                       char **query_str, tag_op_list_t *tag_ops)\r
120 +{\r
121 +    int i = process_tag_command_line (argc, argv, tag_ops);\r
122 +\r
123 +    if (i < 0)\r
124 +       return TAG_PARSE_INVALID;\r
125 +\r
126      *query_str = query_string_from_args (ctx, argc - i, &argv[i]);\r
127  \r
128      if (*query_str == NULL) {\r
129 diff --git a/tag-util.h b/tag-util.h\r
130 index 512cfac..f757e6b 100644\r
131 --- a/tag-util.h\r
132 +++ b/tag-util.h\r
133 @@ -78,6 +78,21 @@ parse_tag_line (void *ctx, char *line,\r
134  \r
135  \r
136  \r
137 +/* Process a command line of the following format:\r
138 + *\r
139 + * +<tag>|-<tag> [...] [--]\r
140 + *\r
141 + * Return the number of tags operations, or -1 for failure to parse.\r
142 + *\r
143 + * Output Parameters:\r
144 + *     ops     contains a list of tag operations\r
145 + *\r
146 + * The ops argument is not cleared.\r
147 + */\r
148 +\r
149 +int\r
150 +process_tag_command_line (int argc, char **argv, tag_op_list_t *ops);\r
151 +\r
152  /* Parse a command line of the following format:\r
153   *\r
154   * +<tag>|-<tag> [...] [--] <search-terms>\r
155 -- \r
156 1.9.2\r
157 \r