Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 82 / 0afdb6dc84a5ec3a61dd826442ade6f610b9d5
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 295B6431FC9\r
6         for <notmuch@notmuchmail.org>; Fri, 25 Oct 2013 16:10:27 -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: -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 rb5jVi363LJt for <notmuch@notmuchmail.org>;\r
17         Fri, 25 Oct 2013 16:10:21 -0700 (PDT)\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 08910431FC7\r
22         for <notmuch@notmuchmail.org>; Fri, 25 Oct 2013 16:10:21 -0700 (PDT)\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 1VZqWE-0002de-S7; Sat, 26 Oct 2013 00:10:15 +0100\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.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1VZqWE-0006K6-Fk; Sat, 26 Oct 2013 00:10:14 +0100\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH v2 00/11] Fix search tagging races\r
34 In-Reply-To: <1382627951-25252-1-git-send-email-amdragon@mit.edu>\r
35 References: <1382627951-25252-1-git-send-email-amdragon@mit.edu>\r
36 User-Agent: Notmuch/0.16 (http://notmuchmail.org) Emacs/23.4.1\r
37         (x86_64-pc-linux-gnu)\r
38 Date: Sat, 26 Oct 2013 00:10:12 +0100\r
39 Message-ID: <87txg59cbv.fsf@qmul.ac.uk>\r
40 MIME-Version: 1.0\r
41 Content-Type: text/plain; charset=us-ascii\r
42 X-Sender-Host-Address: 93.97.24.31\r
43 X-QM-SPAM-Info: Sender has good ham record.  :)\r
44 X-QM-Body-MD5: d2ecb311316381e23c67ad8bf60fb53e (of first 20000 bytes)\r
45 X-SpamAssassin-Score: 0.0\r
46 X-SpamAssassin-SpamBar: /\r
47 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
48         determine if it is\r
49         spam. We require at least 5.0 points to mark a message as spam.\r
50         This message scored 0.0 points. Summary of the scoring: \r
51         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
52         provider *      (markwalters1009[at]gmail.com)\r
53         *  0.0 AWL AWL: From: address is in the auto white-list\r
54 X-QM-Scan-Virus: ClamAV says the message is clean\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Fri, 25 Oct 2013 23:10:27 -0000\r
68 \r
69 \r
70 \r
71 On Thu, 24 Oct 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
72 > This is v2 of id:1381185201-25197-1-git-send-email-amdragon@mit.edu.\r
73 > It fixes several comments from Mark and Jani.  This has been rebased\r
74 > on top of the tag completion changes, so doing * from a large search\r
75 > buffer will no longer crash.  Hence, this series depends on the\r
76 > (currently pending) series in\r
77 > id:1382487721-31776-1-git-send-email-amdragon@mit.edu.\r
78 \r
79 This looks good to me +1\r
80 \r
81 Mark\r
82 \r
83 >\r
84 > This version does not address what happens when you * on a search\r
85 > buffer that's still filling.  With this series, it will apply to all\r
86 > messages that have appeared when the user finishes entering tag\r
87 > changes.  This isn't ideal, but this seems pretty obscure and I'm not\r
88 > sure what the right answer is, so I'm punting it to the future.\r
89 >\r
90 > Another thing that may be worth changing in a follow-up is what\r
91 > messages * applies to.  Currently, * applies *only* to matched\r
92 > messages, not all threads in the search, which I think was an accident\r
93 > of implementation.  This series retains that behavior, but opens up\r
94 > the possibility of applying to all threads instead.  I think that\r
95 > would be much more consistent and less surprising behavior.\r
96 >\r
97 > An approximate diff from v1 is below.  This diff is prior to rebasing,\r
98 > since the post-rebase diff is not useful.\r
99 >\r
100 > diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
101 > index a4eec14..36937fb 100644\r
102 > --- a/emacs/notmuch-tag.el\r
103 > +++ b/emacs/notmuch-tag.el\r
104 > @@ -242,7 +242,11 @@ from TAGS if present."\r
105 >          (error "Changed tag must be of the form `+this_tag' or `-that_tag'")))))\r
106 >      (sort result-tags 'string<)))\r
107 >  \r
108 > -(defconst notmuch-tag-argument-limit 1000)\r
109 > +(defconst notmuch-tag-argument-limit 1000\r
110 > +  "Use batch tagging if the tagging query is longer than this.\r
111 > +\r
112 > +This limits the length of arguments passed to the notmuch CLI to\r
113 > +avoid system argument length limits and performance problems.")\r
114 >  \r
115 >  (defun notmuch-tag (query &optional tag-changes)\r
116 >    "Add/remove tags in TAG-CHANGES to messages matching QUERY.\r
117 > @@ -276,7 +280,6 @@ notmuch-after-tag-hook will be run."\r
118 >        ;; Use batch tag mode to avoid argument length limitations\r
119 >        (let ((batch-op (concat (mapconcat #'notmuch-hex-encode tag-changes " ")\r
120 >                             " -- " query)))\r
121 > -     (message "Batch tagging with %s" batch-op)\r
122 >       (notmuch-call-notmuch-process :stdin-string batch-op "tag" "--batch")))\r
123 >      (run-hooks 'notmuch-after-tag-hook))\r
124 >    ;; in all cases we return tag-changes as a list\r
125 > diff --git a/notmuch-client.h b/notmuch-client.h\r
126 > index 1b14910..8bc1a2a 100644\r
127 > --- a/notmuch-client.h\r
128 > +++ b/notmuch-client.h\r
129 > @@ -144,7 +144,8 @@ chomp_newline (char *str)\r
130 >  #define NOTMUCH_FORMAT_MIN 1\r
131 >  /* The minimum non-deprecated structured output format version.\r
132 >   * Requests for format versions below this will print a stern warning.\r
133 > - * Must be >= NOTMUCH_FORMAT_MIN and < NOTMUCH_FORMAT_CUR.\r
134 > + * Must be between NOTMUCH_FORMAT_MIN and NOTMUCH_FORMAT_CUR,\r
135 > + * inclusive.\r
136 >   */\r
137 >  #define NOTMUCH_FORMAT_MIN_ACTIVE 1\r
138 >  \r
139 > diff --git a/notmuch-search.c b/notmuch-search.c\r
140 > index 1d14651..7c973b3 100644\r
141 > --- a/notmuch-search.c\r
142 > +++ b/notmuch-search.c\r
143 > @@ -53,13 +53,13 @@ sanitize_string (const void *ctx, const char *str)\r
144 >   * NULL. */\r
145 >  static int\r
146 >  get_thread_query (notmuch_thread_t *thread,\r
147 > -               char **matched_out, char **unmached_out)\r
148 > +               char **matched_out, char **unmatched_out)\r
149 >  {\r
150 >      notmuch_messages_t *messages;\r
151 >      char *escaped = NULL;\r
152 >      size_t escaped_len = 0;\r
153 >  \r
154 > -    *matched_out = *unmached_out = NULL;\r
155 > +    *matched_out = *unmatched_out = NULL;\r
156 >  \r
157 >      for (messages = notmuch_thread_get_messages (thread);\r
158 >        notmuch_messages_valid (messages);\r
159 > @@ -69,17 +69,16 @@ get_thread_query (notmuch_thread_t *thread,\r
160 >       const char *mid = notmuch_message_get_message_id (message);\r
161 >       /* Determine which query buffer to extend */\r
162 >       char **buf = notmuch_message_get_flag (\r
163 > -         message, NOTMUCH_MESSAGE_FLAG_MATCH) ? matched_out : unmached_out;\r
164 > -     /* Allocate the query buffer is this is the first message */\r
165 > -     if (!*buf && (*buf = talloc_strdup (thread, "")) == NULL)\r
166 > -         return -1;\r
167 > +         message, NOTMUCH_MESSAGE_FLAG_MATCH) ? matched_out : unmatched_out;\r
168 >       /* Add this message's id: query.  Since "id" is an exclusive\r
169 >        * prefix, it is implicitly 'or'd together, so we only need to\r
170 >        * join queries with a space. */\r
171 >       if (make_boolean_term (thread, "id", mid, &escaped, &escaped_len) < 0)\r
172 >           return -1;\r
173 > -     *buf = talloc_asprintf_append_buffer (\r
174 > -         *buf, "%s%s", **buf ? " " : "", escaped);\r
175 > +     if (*buf)\r
176 > +         *buf = talloc_asprintf_append_buffer (*buf, " %s", escaped);\r
177 > +     else\r
178 > +         *buf = talloc_strdup (thread, escaped);\r
179 >       if (!*buf)\r
180 >           return -1;\r
181 >      }\r