Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / b9 / e0bcf8ff5f89b567282243914ff30df31ec42f
1 Return-Path: <keithp@keithp.com>\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 arlo.cworth.org (Postfix) with ESMTP id 1BB756DE0B64\r
6  for <notmuch@notmuchmail.org>; Wed,  9 Mar 2016 16:16:57 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.442\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.442 tagged_above=-999 required=5\r
12  tests=[AWL=-0.432, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id 8RyBEcGoNBBu for <notmuch@notmuchmail.org>;\r
16  Wed,  9 Mar 2016 16:16:54 -0800 (PST)\r
17 X-Greylist: delayed 514 seconds by postgrey-1.35 at arlo;\r
18  Wed, 09 Mar 2016 16:16:54 PST\r
19 Received: from elaine.keithp.com (home.keithp.com [63.227.221.253])\r
20  by arlo.cworth.org (Postfix) with ESMTP id 4D47C6DE005F\r
21  for <notmuch@notmuchmail.org>; Wed,  9 Mar 2016 16:16:54 -0800 (PST)\r
22 Received: from localhost (localhost [127.0.0.1])\r
23  by elaine.keithp.com (Postfix) with ESMTP id 4AA7E3F20552\r
24  for <notmuch@notmuchmail.org>; Wed,  9 Mar 2016 16:08:19 -0800 (PST)\r
25 X-Virus-Scanned: Debian amavisd-new at keithp.com\r
26 Received: from elaine.keithp.com ([127.0.0.1])\r
27  by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024)\r
28  with LMTP id 2ch7IRecElz3 for <notmuch@notmuchmail.org>;\r
29  Wed,  9 Mar 2016 16:08:18 -0800 (PST)\r
30 Received: by elaine.keithp.com (Postfix, from userid 1033)\r
31  id 815513F207E4; Wed,  9 Mar 2016 16:08:18 -0800 (PST)\r
32 Received: from hiro.keithp.com (localhost [127.0.0.1])\r
33  by elaine.keithp.com (Postfix) with ESMTP id 6523D3F20552\r
34  for <notmuch@notmuchmail.org>; Wed,  9 Mar 2016 16:08:18 -0800 (PST)\r
35 Received: by hiro.keithp.com (Postfix, from userid 1001)\r
36  id 452C37414B5; Wed,  9 Mar 2016 18:08:18 -0600 (CST)\r
37 From: "Keith Packard" <keithp@keithp.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH] Don't bother checking for mbox files\r
40 User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1\r
41  (x86_64-pc-linux-gnu)\r
42 Date: Wed, 09 Mar 2016 16:08:17 -0800\r
43 Message-ID: <86io0v9oum.fsf@hiro.keithp.com>\r
44 MIME-Version: 1.0\r
45 Content-Type: multipart/signed; boundary="=-=-=";\r
46  micalg=pgp-sha256; protocol="application/pgp-signature"\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.20\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51  <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
53  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
58  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Thu, 10 Mar 2016 00:16:57 -0000\r
60 \r
61 --=-=-=\r
62 Content-Type: text/plain\r
63 Content-Transfer-Encoding: quoted-printable\r
64 \r
65 \r
66 Postfix adds mbox-style From lines when used in combination with\r
67 maildrop or .forward files. If they have another line starting with\r
68 'From ' in them, notmuch complains about them not being mail files.\r
69 \r
70 If we assume the user hasn't screwed up and misconfigured their mail\r
71 system, then we can safely ignore whether the file started with an\r
72 mbox header and just parse it as a single-message file.\r
73 \r
74 I can't see any harm in doing this; in the worst case, you'll have a\r
75 single 'message' which contains multiple emails now, while the\r
76 alternative is to miss mail entirely.\r
77 \r
78 I could be convinced to add a config option to enable this behaviour,\r
79 but I'd really rather not.\r
80 \r
81 Signed-off-by: Keith Packard <keithp@keithp.com>\r
82 =2D--\r
83  lib/message-file.c | 29 +----------------------------\r
84  1 file changed, 1 insertion(+), 28 deletions(-)\r
85 \r
86 diff --git a/lib/message-file.c b/lib/message-file.c\r
87 index ee30520..f03e1db 100644\r
88 =2D-- a/lib/message-file.c\r
89 +++ b/lib/message-file.c\r
90 @@ -98,22 +98,6 @@ _notmuch_message_file_close (notmuch_message_file_t *mes=\r
91 sage)\r
92      talloc_free (message);\r
93  }\r
94 =20\r
95 =2Dstatic notmuch_bool_t\r
96 =2D_is_mbox (FILE *file)\r
97 =2D{\r
98 =2D    char from_buf[5];\r
99 =2D    notmuch_bool_t ret =3D FALSE;\r
100 =2D\r
101 =2D    /* Is this mbox? */\r
102 =2D    if (fread (from_buf, sizeof (from_buf), 1, file) =3D=3D 1 &&\r
103 =2D     strncmp (from_buf, "From ", 5) =3D=3D 0)\r
104 =2D     ret =3D TRUE;\r
105 =2D\r
106 =2D    rewind (file);\r
107 =2D\r
108 =2D    return ret;\r
109 =2D}\r
110 =2D\r
111  notmuch_status_t\r
112  _notmuch_message_file_parse (notmuch_message_file_t *message)\r
113  {\r
114 @@ -121,13 +105,10 @@ _notmuch_message_file_parse (notmuch_message_file_t *=\r
115 message)\r
116      GMimeParser *parser;\r
117      notmuch_status_t status =3D NOTMUCH_STATUS_SUCCESS;\r
118      static int initialized =3D 0;\r
119 =2D    notmuch_bool_t is_mbox;\r
120 =20\r
121      if (message->message)\r
122         return NOTMUCH_STATUS_SUCCESS;\r
123 =20\r
124 =2D    is_mbox =3D _is_mbox (message->file);\r
125 =2D\r
126      if (! initialized) {\r
127         g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);\r
128         initialized =3D 1;\r
129 @@ -144,7 +125,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *me=\r
130 ssage)\r
131      g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);\r
132 =20\r
133      parser =3D g_mime_parser_new_with_stream (stream);\r
134 =2D    g_mime_parser_set_scan_from (parser, is_mbox);\r
135 +    g_mime_parser_set_scan_from (parser, FALSE);\r
136 =20\r
137      message->message =3D g_mime_parser_construct_message (parser);\r
138      if (! message->message) {\r
139 @@ -152,14 +133,6 @@ _notmuch_message_file_parse (notmuch_message_file_t *m=\r
140 essage)\r
141         goto DONE;\r
142      }\r
143 =20\r
144 =2D    if (is_mbox && ! g_mime_parser_eos (parser)) {\r
145 =2D     /*\r
146 =2D      * This is a multi-message mbox. (For historical reasons, we\r
147 =2D      * do support single-message mboxes.)\r
148 =2D      */\r
149 =2D     status =3D NOTMUCH_STATUS_FILE_NOT_EMAIL;\r
150 =2D    }\r
151 =2D\r
152    DONE:\r
153      g_object_unref (stream);\r
154      g_object_unref (parser);\r
155 =2D-=20\r
156 2.7.0\r
157 \r
158 \r
159 =2D-=20\r
160 =2Dkeith\r
161 \r
162 --=-=-=\r
163 Content-Type: application/pgp-signature; name="signature.asc"\r
164 \r
165 -----BEGIN PGP SIGNATURE-----\r
166 Version: GnuPG v1\r
167 \r
168 iQIVAwUBVuC68tsiGmkAAAARAQgs8A/9FPH/S8fAm+4eKV5WhbtdqJSOH1UV1oD1\r
169 TgR/e68BoetNGXwsolvyTADYf/u6R/JxSAHQwkgRPvL/LbsG+gwrt+MCSFfburwW\r
170 rcJ7snYzpRhyvlone7wEGt2xlzuQGbZC43YSkL5npVupnKqgaoL/7x26ciF+u6Qq\r
171 OBz7CDGs530WGlgSyoQYfjLkVhY1S3zBL1+INfevK0DUIB+TZmh9bAppTxp3hewH\r
172 bF+YoZA/KaAzys0oNMHH7oMJRPYzLnKGjriqq/H2HUwKjZcf/VU+TFOcXL2RBoN4\r
173 KxUf7O6/flhb6CY40iJuhzLVuX0geckVmRchbFnIYxKpYIaf26BWK7dWJTBZCvdK\r
174 bwPJzHhVapsnk9grRYbguJHxomqBVfPqrFZYYzIzLqEbAybqcWCuZ88cnzqTdHqd\r
175 Rhqg2xlUnBYqkp8DmTv+qiNSQ0h8V8Gq5MZ7LZ9g93NCMkfD0MaoslgYaDIIDCpG\r
176 Yu8jnqet+vdvMIYE936yfRUvSSy53qjFxAg90NlMgpjGm2TorD3Z66wfI5c2Oby+\r
177 z3Tr0EHCEZYfRVbdZaFQBaSdFyUmuMB6HiL9s49Y9CkY/6ncJPqKwpNvA/WLPOow\r
178 RcP10f659lMCRVOVePTCsmXUKIhypKWGuXuge+wqnVfpCtAuvbb0FMD9vrF2sET7\r
179 YYAJ5AWJAUE=\r
180 =hHCz\r
181 -----END PGP SIGNATURE-----\r
182 --=-=-=--\r