Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / d0 / de643cf35db814149f5e2e09aabbfcacb4a9f4
1 Return-Path: <amdragon@mit.edu>\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 83580429E26\r
6         for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 13:07:34 -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: -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 2S4AJVSJZhI0 for <notmuch@notmuchmail.org>;\r
16         Mon, 11 Jul 2011 13:07:33 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id 6654D431FD0\r
20         for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 13:07:33 -0700 (PDT)\r
21 X-AuditID: 1209190c-b7c65ae00000117c-a5-4e1b5808f572\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 32.E4.04476.8085B1E4; Mon, 11 Jul 2011 16:07:36 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id p6BK7Qt2003027; \r
27         Mon, 11 Jul 2011 16:07:26 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p6BK7MqJ024260\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 11 Jul 2011 16:07:25 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1QgMl6-00037M-3O; Mon, 11 Jul 2011 16:07:12 -0400\r
37 Date: Mon, 11 Jul 2011 16:07:12 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Louis Rilling <l.rilling@av7.net>\r
40 Subject: Re: [PATCH 2/2] tags_to_maildir_flags: Don't rename if no flags\r
41  change\r
42 Message-ID: <20110711200712.GB25558@mit.edu>\r
43 References: <87d3hzgemi.fsf@yoom.home.cworth.org>\r
44         <1310394978-11883-3-git-send-email-l.rilling@av7.net>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <1310394978-11883-3-git-send-email-l.rilling@av7.net>\r
49 User-Agent: Mutt/1.5.20 (2009-06-14)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFuplleLIzCtJLcpLzFFi42IRYrdT1+WNkPYzOH6M1eLmzzlsFudbXrFY\r
52         XL85k9mB2ePuunXsHrs3P2DxeLbqFnMAcxSXTUpqTmZZapG+XQJXxusPP5kK3klWLDrWxNrA\r
53         +Eu4i5GTQ0LAROLA7TOMELaYxIV769m6GLk4hAT2MUr0n/jJCOFsYJR4c+sqVOYkk0TD9bvM\r
54         EM4SRomGt9uAyjg4WARUJWZ/5gMZxSagIbFt/3KwsSJA4Z3tR9lBbGYBa4ldPV+ZQWxhgUCJ\r
55         QzN2MoHYvAI6Esd2tYLVCwlkSjz/8JwdIi4ocXLmExaIXi2JG/9eMoGsYhaQllj+jwMkzCng\r
56         JDHj+22wElEBFYlr+9vZJjAKzULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0\r
57         DfVyM0v0UlNKNzGCQp1TkmcH45uDSocYBTgYlXh4V0pL+wmxJpYVV+YeYpTkYFIS5WUOBQrx\r
58         JeWnVGYkFmfEF5XmpBYfYpTgYFYS4d3NDpTjTUmsrEotyodJSXOwKInzlnv/9xUSSE8sSc1O\r
59         TS1ILYLJynBwKEnwvg8DahQsSk1PrUjLzClBSDNxcIIM5wEa/gCkhre4IDG3ODMdIn+KUVFK\r
60         nPcbSEIAJJFRmgfXC0tFrxjFgV4R5n0HUsUDTGNw3a+ABjMBDX4tLQkyuCQRISXVwOgyKTTm\r
61         RM/zdTUl8999fuove/OhsmCaW6jcuQyVbW9WF9r42roYH/zcoROX0jq9aaKCfca+sE3Hb9+f\r
62         IysTOWXDsr1svZuFQ0QnfXzo4vXzgLFq8JIND8RCSv5+1127IY1pjylP4JNOXZ2oo/7WbP2H\r
63         zwV8k3s7JSrgxHUn9t98bkmbJ3IbvlNiKc5INNRiLipOBAByGLZyIAMAAA==\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: Mon, 11 Jul 2011 20:07:34 -0000\r
78 \r
79 I worry that this may compound the confusion caused by mutt's handling\r
80 of the new flag, but I suppose people aren't likely to manipulate any\r
81 of the other maildir-synchronized flags without also marking the\r
82 message as seen.  At any rate, the change is certainly correct\r
83 technically.  A few nits below.\r
84 \r
85 Quoth Louis Rilling on Jul 11 at  4:36 pm:\r
86 > notmuch_message_tags_to_maildir_flags() unconditionally moves messages from\r
87 > maildir directory "new/" to maildir directory "cur/", which makes messages lose\r
88 > their "new" status in the MUA. However some users want to keep this "new"\r
89 > status after, for instance, an auto-tagging of new messages.\r
90\r
91 > However, as Austin mentioned and according to the maildir specification,\r
92 > messages living in "new/" are not allowed to have flags, even if mutt allows it\r
93 > to happen. For this reason, this patch prevents moving messages from "new/" to\r
94 > "cur/", only if no flags have to be changed. It's hopefully enough to satisfy\r
95 > mutt (and maybe other MUAs showing the "new" status) users checking the "new"\r
96 > status.\r
97\r
98 > Signed-off-by: Louis Rilling <l.rilling@av7.net>\r
99 > ---\r
100 >  lib/message.cc |   12 +++++++++++-\r
101 >  1 files changed, 11 insertions(+), 1 deletions(-)\r
102\r
103 > diff --git a/lib/message.cc b/lib/message.cc\r
104 > index 64b6cf8..131d99b 100644\r
105 > --- a/lib/message.cc\r
106 > +++ b/lib/message.cc\r
107 > @@ -1139,7 +1139,7 @@ _get_maildir_flag_actions (notmuch_message_t *message,\r
108 >   * compute the new maildir filename.\r
109 >   *\r
110 >   * If the existing filename is in the directory "new", the new\r
111 > - * filename will be in the directory "cur".\r
112 > + * filename will be in the directory "cur", unless no flags are changed.\r
113 >   *\r
114 >   * After a sequence of ":2," in the filename, any subsequent\r
115 >   * single-character flags will be added or removed according to the\r
116 > @@ -1162,6 +1162,7 @@ _new_maildir_filename (void *ctx,\r
117 >      char *filename_new, *dir;\r
118 >      char flag_map[128];\r
119 >      int flags_in_map = 0;\r
120 > +    bool flags_changed = false;\r
121 \r
122 The convention in notmuch is to use notmuch_bool_t, TRUE, and FALSE\r
123 (though, admittedly, I don't know why; avoiding C99-isms?)\r
124 \r
125 >      unsigned int i;\r
126 >      char *s;\r
127 >  \r
128 > @@ -1202,6 +1203,7 @@ _new_maildir_filename (void *ctx,\r
129 >       if (flag_map[flag] == 0) {\r
130 >           flag_map[flag] = 1;\r
131 >           flags_in_map++;\r
132 > +         flags_changed = true;\r
133 >       }\r
134 >      }\r
135 >  \r
136 > @@ -1210,9 +1212,17 @@ _new_maildir_filename (void *ctx,\r
137 >       if (flag_map[flag]) {\r
138 >           flag_map[flag] = 0;\r
139 >           flags_in_map--;\r
140 > +         flags_changed = true;\r
141 >       }\r
142 >      }\r
143 >  \r
144 > +    /* No need to rename. Messages in new/ can be kept in new/.\r
145 > +     * Note: We don't even try to fix buggy messages having flags and living in\r
146 > +     * new/. It's not our business.\r
147 > +     */\r
148 > +    if (!flags_changed)\r
149 > +     return NULL;\r
150 > +\r
151 \r
152 NULL generally indicates an error in notmuch and is currently used\r
153 that way in _new_maildir_filename, so even though the caller currently\r
154 doesn't really care, I'd lean against overloading it to indicate that\r
155 the filename doesn't need to change.  Despite the slight inefficiency,\r
156 I would recommend returning talloc_strdup (ctx, filename).\r
157 \r
158 >      filename_new = (char *) talloc_size (ctx,\r
159 >                                        info - filename +\r
160 >                                        strlen (":2,") + flags_in_map + 1);\r