Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 74 / be989d065ff85bdcbb4e4c024b8c4d1effe3de
1 Return-Path: <tomi.ollila@iki.fi>\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 8764F431FD6\r
6         for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 09:26:50 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 ZJqxnp6EnRHP for <notmuch@notmuchmail.org>;\r
16         Thu,  7 Nov 2013 09:26:41 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id A11CA431FC3\r
19         for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 09:26:40 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id ABEEB100051;\r
22         Thu,  7 Nov 2013 19:26:32 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH v2 00/11] Fix search tagging races\r
26 In-Reply-To: <1382627951-25252-1-git-send-email-amdragon@mit.edu>\r
27 References: <1382627951-25252-1-git-send-email-amdragon@mit.edu>\r
28 User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Thu, 07 Nov 2013 19:26:32 +0200\r
34 Message-ID: <m2k3gki0mv.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Thu, 07 Nov 2013 17:26:50 -0000\r
50 \r
51 On Thu, Oct 24 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
52 \r
53 > This is v2 of id:1381185201-25197-1-git-send-email-amdragon@mit.edu.\r
54 > It fixes several comments from Mark and Jani.  This has been rebased\r
55 > on top of the tag completion changes, so doing * from a large search\r
56 > buffer will no longer crash.  Hence, this series depends on the\r
57 > (currently pending) series in\r
58 > id:1382487721-31776-1-git-send-email-amdragon@mit.edu.\r
59 >\r
60 > This version does not address what happens when you * on a search\r
61 > buffer that's still filling.  With this series, it will apply to all\r
62 > messages that have appeared when the user finishes entering tag\r
63 > changes.  This isn't ideal, but this seems pretty obscure and I'm not\r
64 > sure what the right answer is, so I'm punting it to the future.\r
65 >\r
66 > Another thing that may be worth changing in a follow-up is what\r
67 > messages * applies to.  Currently, * applies *only* to matched\r
68 > messages, not all threads in the search, which I think was an accident\r
69 > of implementation.  This series retains that behavior, but opens up\r
70 > the possibility of applying to all threads instead.  I think that\r
71 > would be much more consistent and less surprising behavior.\r
72 \r
73 LGTM. applies cleanly and tests pass\r
74 \r
75 Tomi\r
76 \r
77 \r
78 >\r
79 > An approximate diff from v1 is below.  This diff is prior to rebasing,\r
80 > since the post-rebase diff is not useful.\r
81 >\r
82 > diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
83 > index a4eec14..36937fb 100644\r
84 > --- a/emacs/notmuch-tag.el\r
85 > +++ b/emacs/notmuch-tag.el\r
86 > @@ -242,7 +242,11 @@ from TAGS if present."\r
87 >          (error "Changed tag must be of the form `+this_tag' or `-that_tag'")))))\r
88 >      (sort result-tags 'string<)))\r
89 >  \r
90 > -(defconst notmuch-tag-argument-limit 1000)\r
91 > +(defconst notmuch-tag-argument-limit 1000\r
92 > +  "Use batch tagging if the tagging query is longer than this.\r
93 > +\r
94 > +This limits the length of arguments passed to the notmuch CLI to\r
95 > +avoid system argument length limits and performance problems.")\r
96 >  \r
97 >  (defun notmuch-tag (query &optional tag-changes)\r
98 >    "Add/remove tags in TAG-CHANGES to messages matching QUERY.\r
99 > @@ -276,7 +280,6 @@ notmuch-after-tag-hook will be run."\r
100 >        ;; Use batch tag mode to avoid argument length limitations\r
101 >        (let ((batch-op (concat (mapconcat #'notmuch-hex-encode tag-changes " ")\r
102 >                             " -- " query)))\r
103 > -     (message "Batch tagging with %s" batch-op)\r
104 >       (notmuch-call-notmuch-process :stdin-string batch-op "tag" "--batch")))\r
105 >      (run-hooks 'notmuch-after-tag-hook))\r
106 >    ;; in all cases we return tag-changes as a list\r
107 > diff --git a/notmuch-client.h b/notmuch-client.h\r
108 > index 1b14910..8bc1a2a 100644\r
109 > --- a/notmuch-client.h\r
110 > +++ b/notmuch-client.h\r
111 > @@ -144,7 +144,8 @@ chomp_newline (char *str)\r
112 >  #define NOTMUCH_FORMAT_MIN 1\r
113 >  /* The minimum non-deprecated structured output format version.\r
114 >   * Requests for format versions below this will print a stern warning.\r
115 > - * Must be >= NOTMUCH_FORMAT_MIN and < NOTMUCH_FORMAT_CUR.\r
116 > + * Must be between NOTMUCH_FORMAT_MIN and NOTMUCH_FORMAT_CUR,\r
117 > + * inclusive.\r
118 >   */\r
119 >  #define NOTMUCH_FORMAT_MIN_ACTIVE 1\r
120 >  \r
121 > diff --git a/notmuch-search.c b/notmuch-search.c\r
122 > index 1d14651..7c973b3 100644\r
123 > --- a/notmuch-search.c\r
124 > +++ b/notmuch-search.c\r
125 > @@ -53,13 +53,13 @@ sanitize_string (const void *ctx, const char *str)\r
126 >   * NULL. */\r
127 >  static int\r
128 >  get_thread_query (notmuch_thread_t *thread,\r
129 > -               char **matched_out, char **unmached_out)\r
130 > +               char **matched_out, char **unmatched_out)\r
131 >  {\r
132 >      notmuch_messages_t *messages;\r
133 >      char *escaped = NULL;\r
134 >      size_t escaped_len = 0;\r
135 >  \r
136 > -    *matched_out = *unmached_out = NULL;\r
137 > +    *matched_out = *unmatched_out = NULL;\r
138 >  \r
139 >      for (messages = notmuch_thread_get_messages (thread);\r
140 >        notmuch_messages_valid (messages);\r
141 > @@ -69,17 +69,16 @@ get_thread_query (notmuch_thread_t *thread,\r
142 >       const char *mid = notmuch_message_get_message_id (message);\r
143 >       /* Determine which query buffer to extend */\r
144 >       char **buf = notmuch_message_get_flag (\r
145 > -         message, NOTMUCH_MESSAGE_FLAG_MATCH) ? matched_out : unmached_out;\r
146 > -     /* Allocate the query buffer is this is the first message */\r
147 > -     if (!*buf && (*buf = talloc_strdup (thread, "")) == NULL)\r
148 > -         return -1;\r
149 > +         message, NOTMUCH_MESSAGE_FLAG_MATCH) ? matched_out : unmatched_out;\r
150 >       /* Add this message's id: query.  Since "id" is an exclusive\r
151 >        * prefix, it is implicitly 'or'd together, so we only need to\r
152 >        * join queries with a space. */\r
153 >       if (make_boolean_term (thread, "id", mid, &escaped, &escaped_len) < 0)\r
154 >           return -1;\r
155 > -     *buf = talloc_asprintf_append_buffer (\r
156 > -         *buf, "%s%s", **buf ? " " : "", escaped);\r
157 > +     if (*buf)\r
158 > +         *buf = talloc_asprintf_append_buffer (*buf, " %s", escaped);\r
159 > +     else\r
160 > +         *buf = talloc_strdup (thread, escaped);\r
161 >       if (!*buf)\r
162 >           return -1;\r
163 >      }\r
164 >\r
165 >\r
166 > _______________________________________________\r
167 > notmuch mailing list\r
168 > notmuch@notmuchmail.org\r
169 > http://notmuchmail.org/mailman/listinfo/notmuch\r