Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / d7 / 4aa7fdd5b670548462c8edc30fd5f3e91ab9b6
1 Return-Path: <jani@nikula.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 56210431FB6\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 11:57:34 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 YMAOLH5fwSJ7 for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Feb 2012 11:57:30 -0800 (PST)\r
17 Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
18         [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id B9D03431FAE\r
21         for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 11:57:29 -0800 (PST)\r
22 Received: by lahd3 with SMTP id d3so3838995lah.26\r
23         for <notmuch@notmuchmail.org>; Mon, 06 Feb 2012 11:57:26 -0800 (PST)\r
24 Received: by 10.112.26.6 with SMTP id h6mr5230184lbg.6.1328558246792;\r
25         Mon, 06 Feb 2012 11:57:26 -0800 (PST)\r
26 Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi.\r
27         [84.248.80.253])\r
28         by mx.google.com with ESMTPS id mc3sm13757805lab.12.2012.02.06.11.57.24\r
29         (version=SSLv3 cipher=OTHER); Mon, 06 Feb 2012 11:57:25 -0800 (PST)\r
30 From: Jani Nikula <jani@nikula.org>\r
31 To: notmuch@notmuchmail.org\r
32 Subject: [PATCH 0/3] notmuch show argument parsing\r
33 Date: Mon,  6 Feb 2012 21:57:20 +0200\r
34 Message-Id: <cover.1328558175.git.jani@nikula.org>\r
35 X-Mailer: git-send-email 1.7.5.4\r
36 In-Reply-To:\r
37  <df2e9bd7682e9c81e1b205cc1d92a1526cdd1a9b.1328308635.git.jani@nikula.org>\r
38 References:\r
39  <df2e9bd7682e9c81e1b205cc1d92a1526cdd1a9b.1328308635.git.jani@nikula.org>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Mon, 06 Feb 2012 19:57:34 -0000\r
53 \r
54 Hi all, \r
55 \r
56 v2 addressing Austin's comments in id:"20120206041205.GP10898@mit.edu".\r
57 Separate the bool cleanup into a new patch, cleaning up notmuch reply\r
58 while at it. No functional changes since v1.\r
59 \r
60 For reviewing convenience, the diff between v1 and v2 is at the end of\r
61 this cover letter.\r
62 \r
63 BR,\r
64 Jani.\r
65 \r
66 Jani Nikula (3):\r
67   cli: use notmuch_bool_t for boolean fields in notmuch_show_params_t\r
68   cli: convert "notmuch show" to use the new argument parser\r
69   cli: reach previously unreachable cleanup code in "notmuch show"\r
70 \r
71  notmuch-client.h |    6 +-\r
72  notmuch-reply.c  |    7 +--\r
73  notmuch-show.c   |  155 +++++++++++++++++++++++++++---------------------------\r
74  3 files changed, 84 insertions(+), 84 deletions(-)\r
75 \r
76 -- \r
77 1.7.5.4\r
78 \r
79 diff --git a/notmuch-client.h b/notmuch-client.h\r
80 index e0eb594..60828aa 100644\r
81 --- a/notmuch-client.h\r
82 +++ b/notmuch-client.h\r
83 @@ -98,15 +98,15 @@ typedef struct notmuch_show_format {\r
84  } notmuch_show_format_t;\r
85  \r
86  typedef struct notmuch_show_params {\r
87 -    int entire_thread;\r
88 -    int raw;\r
89 +    notmuch_bool_t entire_thread;\r
90 +    notmuch_bool_t raw;\r
91      int part;\r
92  #ifdef GMIME_ATLEAST_26\r
93      GMimeCryptoContext* cryptoctx;\r
94  #else\r
95      GMimeCipherContext* cryptoctx;\r
96  #endif\r
97 -    int decrypt;\r
98 +    notmuch_bool_t decrypt;\r
99  } notmuch_show_params_t;\r
100  \r
101  /* There's no point in continuing when we've detected that we've done\r
102 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
103 index f55b1d2..6b244e6 100644\r
104 --- a/notmuch-reply.c\r
105 +++ b/notmuch-reply.c\r
106 @@ -661,7 +661,6 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
107      notmuch_show_params_t params = { .part = -1 };\r
108      int format = FORMAT_DEFAULT;\r
109      int reply_all = TRUE;\r
110 -    notmuch_bool_t decrypt = FALSE;\r
111  \r
112      notmuch_opt_desc_t options[] = {\r
113         { NOTMUCH_OPT_KEYWORD, &format, "format", 'f',\r
114 @@ -672,7 +671,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
115           (notmuch_keyword_t []){ { "all", TRUE },\r
116                                   { "sender", FALSE },\r
117                                   { 0, 0 } } },\r
118 -       { NOTMUCH_OPT_BOOLEAN, &decrypt, "decrypt", 'd', 0 },\r
119 +       { NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },\r
120         { 0, 0, 0, 0, 0 }\r
121      };\r
122  \r
123 @@ -687,7 +686,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
124      else\r
125         reply_format_func = notmuch_reply_format_default;\r
126  \r
127 -    if (decrypt) {\r
128 +    if (params.decrypt) {\r
129  #ifdef GMIME_ATLEAST_26\r
130         /* TODO: GMimePasswordRequestFunc */\r
131         params.cryptoctx = g_mime_gpg_context_new (NULL, "gpg");\r
132 @@ -697,8 +696,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
133  #endif\r
134         if (params.cryptoctx) {\r
135             g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE);\r
136 -           params.decrypt = TRUE;\r
137         } else {\r
138 +           params.decrypt = FALSE;\r
139             fprintf (stderr, "Failed to construct gpg context.\n");\r
140         }\r
141  #ifndef GMIME_ATLEAST_26\r
142 diff --git a/notmuch-show.c b/notmuch-show.c\r
143 index b18e279..c8fbd79 100644\r
144 --- a/notmuch-show.c\r
145 +++ b/notmuch-show.c\r
146 @@ -1068,9 +1068,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
147      const notmuch_show_format_t *format = &format_text;\r
148      notmuch_show_params_t params = { .part = -1 };\r
149      int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;\r
150 -    notmuch_bool_t decrypt = FALSE;\r
151      notmuch_bool_t verify = FALSE;\r
152 -    notmuch_bool_t entire_thread = FALSE;\r
153  \r
154      notmuch_opt_desc_t options[] = {\r
155         { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',\r
156 @@ -1080,8 +1078,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
157                                   { "raw", NOTMUCH_FORMAT_RAW },\r
158                                   { 0, 0 } } },\r
159         { NOTMUCH_OPT_INT, &params.part, "part", 'p', 0 },\r
160 -       { NOTMUCH_OPT_BOOLEAN, &entire_thread, "entire-thread", 't', 0 },\r
161 -       { NOTMUCH_OPT_BOOLEAN, &decrypt, "decrypt", 'd', 0 },\r
162 +       { NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },\r
163 +       { NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },\r
164         { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },\r
165         { 0, 0, 0, 0, 0 }\r
166      };\r
167 @@ -1092,8 +1090,6 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
168         return 1;\r
169      }\r
170  \r
171 -    params.entire_thread = entire_thread;\r
172 -\r
173      if (format_sel == NOTMUCH_FORMAT_NOT_SPECIFIED) {\r
174         /* if part was requested and format was not specified, use format=raw */\r
175         if (params.part >= 0)\r
176 @@ -1105,7 +1101,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
177      switch (format_sel) {\r
178      case NOTMUCH_FORMAT_JSON:\r
179         format = &format_json;\r
180 -       params.entire_thread = 1;\r
181 +       params.entire_thread = TRUE;\r
182         break;\r
183      case NOTMUCH_FORMAT_TEXT:\r
184         format = &format_text;\r
185 @@ -1123,11 +1119,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
186          * output single message, so set part=0 */\r
187         if (params.part < 0)\r
188             params.part = 0;\r
189 -       params.raw = 1;\r
190 +       params.raw = TRUE;\r
191         break;\r
192      }\r
193  \r
194 -    if (decrypt || verify) {\r
195 +    if (params.decrypt || verify) {\r
196  #ifdef GMIME_ATLEAST_26\r
197         /* TODO: GMimePasswordRequestFunc */\r
198         params.cryptoctx = g_mime_gpg_context_new (NULL, "gpg");\r
199 @@ -1137,8 +1133,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
200  #endif\r
201         if (params.cryptoctx) {\r
202             g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE);\r
203 -           params.decrypt = decrypt;\r
204         } else {\r
205 +           params.decrypt = FALSE;\r
206             fprintf (stderr, "Failed to construct gpg context.\n");\r
207         }\r
208  #ifndef GMIME_ATLEAST_26\r