Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2c / aa9e1c42a38e41410089405f3976112536a69d
1 Return-Path: <m.walters@qmul.ac.uk>\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 0DEBC41ED96\r
6         for <notmuch@notmuchmail.org>; Tue, 31 Jan 2012 04:29:32 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 wAjogMq19Maq for <notmuch@notmuchmail.org>;\r
17         Tue, 31 Jan 2012 04:29:31 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 1D7EA41ED91\r
22         for <notmuch@notmuchmail.org>; Tue, 31 Jan 2012 04:29:31 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1RsCq1-0001Jd-Eu; Tue, 31 Jan 2012 12:29:29 +0000\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1RsCq0-0001sk-UV; Tue, 31 Jan 2012 12:29:29 +0000\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>\r
34 Subject: Re: [PATCH 5/7] cli: Make notmuch-show respect excludes.\r
35 In-Reply-To: <20120131045624.GB17991@mit.edu>\r
36 References: <8762fu4aqt.fsf@qmul.ac.uk>\r
37         <1327862394-14334-5-git-send-email-markwalters1009@gmail.com>\r
38         <20120131045624.GB17991@mit.edu>\r
39 User-Agent: Notmuch/0.11+137~g98adc3d (http://notmuchmail.org) Emacs/23.2.1\r
40         (i486-pc-linux-gnu)\r
41 Date: Tue, 31 Jan 2012 12:30:35 +0000\r
42 Message-ID: <87sjiwcavo.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-Sender-Host-Address: 94.192.233.223\r
46 X-QM-SPAM-Info: Sender has good ham record.  :)\r
47 X-QM-Body-MD5: 68a5891608c30e81d4b0c855c7a2a397 (of first 20000 bytes)\r
48 X-SpamAssassin-Score: -1.8\r
49 X-SpamAssassin-SpamBar: -\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
51         determine if it is\r
52         spam. We require at least 5.0 points to mark a message as spam.\r
53         This message scored -1.8 points.\r
54         Summary of the scoring: \r
55         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
56         *      medium trust\r
57         *      [138.37.6.40 listed in list.dnswl.org]\r
58         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
59         provider *      (markwalters1009[at]gmail.com)\r
60         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
61         *      domain\r
62         *  0.5 AWL AWL: From: address is in the auto white-list\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 Cc: notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Tue, 31 Jan 2012 12:29:32 -0000\r
78 \r
79 On Mon, 30 Jan 2012 23:56:24 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
80 > Quoth Mark Walters on Jan 29 at  6:39 pm:\r
81 > > This adds the excludes to notmuch-show.c. We do not exclude when only\r
82 > > a single message (or part) is requested. notmuch-show will output the\r
83 > > exclude information when either text or json format is requested. As\r
84 > > this changes the output from notmuch-show it breaks many tests (in a\r
85 > > trivial and expected fashion).\r
86 > > ---\r
87 > >  notmuch-show.c |   26 +++++++++++++++++++++-----\r
88 > >  1 files changed, 21 insertions(+), 5 deletions(-)\r
89 > > \r
90 > > diff --git a/notmuch-show.c b/notmuch-show.c\r
91 > > index dec799c..681827f 100644\r
92 > > --- a/notmuch-show.c\r
93 > > +++ b/notmuch-show.c\r
94 > > @@ -193,10 +193,12 @@ _get_one_line_summary (const void *ctx, notmuch_message_t *message)\r
95 > >  static void\r
96 > >  format_message_text (unused (const void *ctx), notmuch_message_t *message, int indent)\r
97 > >  {\r
98 > > -    printf ("id:%s depth:%d match:%d filename:%s\n",\r
99 > > +    /* Could changing this could break users ? */\r
100\r
101 > I don't think anybody seriously tries to parse the text format, so I\r
102 > wouldn't worry about breaking anything.\r
103 \r
104 Right: I will remove the comment.\r
105 \r
106 > > +    printf ("id:%s depth:%d match:%d excluded:%d filename:%s\n",\r
107 > >         notmuch_message_get_message_id (message),\r
108 > >         indent,\r
109 > > -       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),\r
110 > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? 1 : 0,\r
111 > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? 1 : 0,\r
112 > >         notmuch_message_get_filename (message));\r
113 > >  }\r
114 > >  \r
115 > > @@ -212,9 +214,10 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in\r
116 > >      date = notmuch_message_get_date (message);\r
117 > >      relative_date = notmuch_time_relative_date (ctx, date);\r
118 > >  \r
119 > > -    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
120 > > +    printf ("\"id\": %s, \"match\": %s, \"excluded\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
121\r
122 > I wonder if it would be better to switch to an array of flag names...\r
123 > That obviously would break consumers, but it's worth thinking about in\r
124 > the longer term.\r
125 \r
126 Unless you have a strong feeling for this I will leave that for a later\r
127 patch.\r
128 \r
129 > >         json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),\r
130 > >         notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",\r
131 > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? "true" : "false",\r
132 > >         json_quote_str (ctx_quote, notmuch_message_get_filename (message)),\r
133 > >         date, relative_date);\r
134 > >  \r
135 > > @@ -1059,9 +1062,13 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
136 > >      char *opt;\r
137 > >      const notmuch_show_format_t *format = &format_text;\r
138 > >      notmuch_show_params_t params;\r
139 > > +    const char **search_exclude_tags;\r
140 > > +    size_t search_exclude_tags_length;\r
141 > >      int mbox = 0;\r
142 > >      int format_specified = 0;\r
143 > >      int i;\r
144 > > +    notmuch_bool_t do_not_exclude = FALSE;\r
145 > > +    unsigned int j;\r
146 > >  \r
147 > >      params.entire_thread = 0;\r
148 > >      params.raw = 0;\r
149 > > @@ -1098,6 +1105,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
150 > >         params.part = atoi(argv[i] + sizeof ("--part=") - 1);\r
151 > >     } else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {\r
152 > >         params.entire_thread = 1;\r
153 > > +   } else if (STRNCMP_LITERAL (argv[i], "--do-not-exclude") == 0) {\r
154 > > +       do_not_exclude = TRUE;\r
155\r
156 > "no-exclude" if you change the others.\r
157 \r
158 See comment on first patch: will make sure they are consistent.\r
159 \r
160 > >     } else if ((STRNCMP_LITERAL (argv[i], "--verify") == 0) ||\r
161 > >                (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {\r
162 > >         if (params.cryptoctx == NULL) {\r
163 > > @@ -1105,7 +1114,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
164 > >             /* TODO: GMimePasswordRequestFunc */\r
165 > >             if (NULL == (params.cryptoctx = g_mime_gpg_context_new(NULL, "gpg")))\r
166 > >  #else\r
167 > > -           GMimeSession* session = g_object_new(g_mime_session_get_type(), NULL);\r
168 > > +               GMimeSession* session = g_object_new(g_mime_session_get_type(), NULL);\r
169\r
170 > Accidental reindent?\r
171 \r
172 Yes will fix.\r
173 \r
174 > >             if (NULL == (params.cryptoctx = g_mime_gpg_context_new(session, "gpg")))\r
175 > >  #endif\r
176 > >                 fprintf (stderr, "Failed to construct gpg context.\n");\r
177 > > @@ -1167,10 +1176,17 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
178 > >      if (params.raw && params.part < 0)\r
179 > >     params.part = 0;\r
180 > >  \r
181 > > +    /* if a single message is requested we do not use search_excludes */\r
182\r
183 > Capital and period.\r
184 \r
185 Will fix.\r
186 \r
187 > >      if (params.part >= 0)\r
188 > >     return do_show_single (ctx, query, format, &params);\r
189 > >      else\r
190 > > -   return do_show (ctx, query, format, &params);\r
191 > > +   if (!do_not_exclude) {\r
192 > > +       search_exclude_tags = notmuch_config_get_search_exclude_tags\r
193 > > +           (config, &search_exclude_tags_length);\r
194 > > +       for (j = 0; j < search_exclude_tags_length; j++)\r
195 > > +           notmuch_query_add_tag_exclude (query, search_exclude_tags[j]);\r
196 > > +       return do_show (ctx, query, format, &params);\r
197 > > +   }\r
198\r
199 > I don't think this is the control flow you meant.  With\r
200 > --do-not-exclude, there won't be any output.\r
201 \r
202 Good catch! Will fix.\r
203 \r
204 Thanks \r
205 \r
206 Mark\r
207 \r