Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2c / abb8fe057f4f58162fe1bf55b0dd5a1b287f12
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 0018A431FAF\r
6         for <notmuch@notmuchmail.org>; Sun, 23 Dec 2012 00:19:30 -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 MlAfxwpVKgnL for <notmuch@notmuchmail.org>;\r
17         Sun, 23 Dec 2012 00:19:28 -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 66E6E431FAE\r
22         for <notmuch@notmuchmail.org>; Sun, 23 Dec 2012 00:19:28 -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 1TmgmG-0005A0-3l; Sun, 23 Dec 2012 08:19:22 +0000\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1TmgmF-0004BE-LS; Sun, 23 Dec 2012 08:19:19 +0000\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: david@tethera.net, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH] simplify unhex_and_quote\r
34 In-Reply-To: <1356231570-28232-1-git-send-email-david@tethera.net>\r
35 References: <87txrdhd7g.fsf@oiva.home.nikula.org>\r
36         <1356231570-28232-1-git-send-email-david@tethera.net>\r
37 User-Agent: Notmuch/0.14+236~g1d0044f (http://notmuchmail.org) Emacs/23.4.1\r
38         (x86_64-pc-linux-gnu)\r
39 Date: Sun, 23 Dec 2012 08:19:20 +0000\r
40 Message-ID: <87a9t5p4dz.fsf@qmul.ac.uk>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-Sender-Host-Address: 93.97.24.31\r
44 X-QM-SPAM-Info: Sender has good ham record.  :)\r
45 X-QM-Body-MD5: daa53310a90217d87a28cd2cc186fe1a (of first 20000 bytes)\r
46 X-SpamAssassin-Score: -1.8\r
47 X-SpamAssassin-SpamBar: -\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
49         determine if it is\r
50         spam. We require at least 5.0 points to mark a message as spam.\r
51         This message scored -1.8 points.\r
52         Summary of the scoring: \r
53         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
54         *      medium trust\r
55         *      [138.37.6.40 listed in list.dnswl.org]\r
56         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
57         provider *      (markwalters1009[at]gmail.com)\r
58         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
59         *      domain\r
60         *  0.5 AWL AWL: From: address is in the auto white-list\r
61 X-QM-Scan-Virus: ClamAV says the message is clean\r
62 Cc: David Bremner <bremner@unb.ca>\r
63 X-BeenThere: notmuch@notmuchmail.org\r
64 X-Mailman-Version: 2.1.13\r
65 Precedence: list\r
66 List-Id: "Use and development of the notmuch mail system."\r
67         <notmuch.notmuchmail.org>\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
71 List-Post: <mailto:notmuch@notmuchmail.org>\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
75 X-List-Received-Date: Sun, 23 Dec 2012 08:19:31 -0000\r
76 \r
77 \r
78 On Sun, 23 Dec 2012, david@tethera.net wrote:\r
79 > From: David Bremner <bremner@unb.ca>\r
80 >\r
81 > the overgeneral definition of a prefix can be replaced by lower case\r
82 > alphabetic, and still work fine with current notmuch query syntax.\r
83 >\r
84 > token_len++ is moved to the end, and we restore the delimiter just so\r
85 > we can leave the string as as we found it.\r
86 > ---\r
87 >\r
88 > As always, Jani has a keen eye for muddle. Except he's wrong about \r
89 > tok_len - prefix_len, and Mark and I are right. Hopefully ;).\r
90 >\r
91 > Restoring the delimiter at the end might be pointless (since the rest\r
92 > of the input line is modified), but it is one less surprise for somebody \r
93 > repurposing the function.\r
94 \r
95 I am now worried about side bit of Xapian syntax, in particular, what\r
96 about brackets. I think we could have\r
97 \r
98 (tag:inbox or tag:tag%20with%20spaces) and <something>\r
99 \r
100 In which case the first token is (tag:inbox which does not\r
101 match. Additionally the third token is tag:tag%20with%20spaces) which\r
102 presumably gets quoted to tag:"tag with spaces)" and I am guessing\r
103 Xapian  treats this differently than with bracket after the quote.\r
104 \r
105 Finally, I don't know if a query can contain a : without being a prefix\r
106 query. If it can that could end up being misquoted.\r
107 \r
108 One possible way round the first problem might be to require the Xapian\r
109 syntax to be space separated from the rest but that does mean we are\r
110 diverging from the command line syntax.\r
111 \r
112 (I am not very familiar with Xapian syntax nor with quite where this\r
113 function is used so I may be worrying about nothing)\r
114 \r
115 Best wishes\r
116 \r
117 Mark\r
118 \r
119 \r
120 \r
121 \r
122 \r
123 >\r
124 > Patches 5 and 6 can be ignored now.\r
125 >  tag-util.c |   12 ++++++++----\r
126 >  1 file changed, 8 insertions(+), 4 deletions(-)\r
127 >\r
128 > diff --git a/tag-util.c b/tag-util.c\r
129 > index b0a846b..ee28512 100644\r
130 > --- a/tag-util.c\r
131 > +++ b/tag-util.c\r
132 > @@ -78,11 +78,13 @@ unhex_and_quote (void *ctx, char *encoded, const char *line_for_error,\r
133 >       size_t prefix_len;\r
134 >       char delim = *(tok + tok_len);\r
135 >  \r
136 > -     *(tok + tok_len++) = '\0';\r
137 > +     *(tok + tok_len) = '\0';\r
138 >  \r
139 > -     prefix_len = hex_invariant (tok, tok_len);\r
140 > +     /* The following matches a superset of prefixes currently\r
141 > +      * used by notmuch */\r
142 > +     prefix_len = strspn (tok, "abcdefghijklmnopqrstuvwxyz");\r
143 >  \r
144 > -     if ((strcmp (tok, "*") == 0) || prefix_len >= tok_len - 1) {\r
145 > +     if ((strcmp (tok, "*") == 0) || prefix_len == tok_len) {\r
146 >  \r
147 >           /* pass some things through without quoting or decoding.\r
148 >            * Note for '*' this is mandatory.\r
149 > @@ -98,7 +100,7 @@ unhex_and_quote (void *ctx, char *encoded, const char *line_for_error,\r
150 >  \r
151 >       } else {\r
152 >           /* potential prefix: one for ':', then something after */\r
153 > -         if ((tok_len - prefix_len > 2) && *(tok + prefix_len) == ':') {\r
154 > +         if ((tok_len - prefix_len >= 2) && *(tok + prefix_len) == ':') {\r
155 >               if (! (*query_string = talloc_strndup_append (*query_string,\r
156 >                                                             tok,\r
157 >                                                             prefix_len + 1))) {\r
158 > @@ -129,6 +131,8 @@ unhex_and_quote (void *ctx, char *encoded, const char *line_for_error,\r
159 >               goto DONE;\r
160 >           }\r
161 >       }\r
162 > +     /* restore the string and skip delimiter */\r
163 > +     *(tok + tok_len++) = delim;\r
164 >      }\r
165 >  \r
166 >    DONE:\r
167 > -- \r
168 > 1.7.10.4\r
169 >\r
170 > _______________________________________________\r
171 > notmuch mailing list\r
172 > notmuch@notmuchmail.org\r
173 > http://notmuchmail.org/mailman/listinfo/notmuch\r