Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / df / a13115639b10afe4338b162afd01b282519a49
1 Return-Path: <lists@informa.tiker.net>\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 625D0431FBD\r
6         for <notmuch@notmuchmail.org>; Mon, 14 Dec 2009 11:28:07 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id oOr2qMlFOKTu for <notmuch@notmuchmail.org>;\r
11         Mon, 14 Dec 2009 11:28:06 -0800 (PST)\r
12 X-Greylist: delayed 399 seconds by postgrey-1.32 at olra;\r
13         Mon, 14 Dec 2009 11:28:06 PST\r
14 Received: from outbound-mail-13.bluehost.com (outbound-mail-13.bluehost.com\r
15         [69.89.18.113])\r
16         by olra.theworths.org (Postfix) with SMTP id 4318A431FAE\r
17         for <notmuch@notmuchmail.org>; Mon, 14 Dec 2009 11:28:06 -0800 (PST)\r
18 Received: (qmail 5184 invoked by uid 0); 14 Dec 2009 19:21:26 -0000\r
19 Received: from unknown (HELO host304.hostmonster.com) (74.220.215.104)\r
20         by outboundproxy1.bluehost.com with SMTP; 14 Dec 2009 19:21:26 -0000\r
21 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default;\r
22  d=informa.tiker.net;\r
23         h=Received:From:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:X-Identified-User;\r
24         b=Vz72pF1VkS4iE6Y8Wik61cuUXzFLq6VGDO+N8oSn6WplA9tsgh7bDpky0HpbSfU/stLbcqwAMy3SA3eyF0J9vFy7djl8lJqW4lOWxAVgUqAAn8AoQWeA7dAANFMmNRcG;\r
25 Received: from ip72-221-120-106.ri.ri.cox.net ([72.221.120.106]\r
26         helo=grizzly.localnet)\r
27         by host304.hostmonster.com with esmtpsa (TLSv1:AES256-SHA:256)\r
28         (Exim 4.69) (envelope-from <lists@informa.tiker.net>)\r
29         id 1NKGU2-00079r-E0\r
30         for notmuch@notmuchmail.org; Mon, 14 Dec 2009 12:21:26 -0700\r
31 From: Andreas =?iso-8859-1?q?Kl=F6ckner?= <lists@informa.tiker.net>\r
32 To: notmuch@notmuchmail.org\r
33 Date: Mon, 14 Dec 2009 14:21:50 -0500\r
34 User-Agent: KMail/1.12.2 (Linux/2.6.31-trunk-686; KDE/4.3.2; i686; ; )\r
35 MIME-Version: 1.0\r
36 Content-Type: multipart/signed; boundary="nextPart1983344.e7oaIR2PZV";\r
37         protocol="application/pgp-signature"; micalg=pgp-sha1\r
38 Content-Transfer-Encoding: 7bit\r
39 Message-Id: <200912141421.52561.lists@informa.tiker.net>\r
40 X-Identified-User: {11749:host304.hostmonster.com:tikernet:tiker.net}\r
41         {sentby:smtp auth 72.221.120.106 authed with\r
42         andreas-store+tiker.net}\r
43 X-Mailman-Approved-At: Mon, 14 Dec 2009 14:44:28 -0800\r
44 Subject: [notmuch] [patch] store folder information\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.12\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Mon, 14 Dec 2009 19:28:07 -0000\r
58 \r
59 --nextPart1983344.e7oaIR2PZV\r
60 Content-Type: multipart/mixed;\r
61   boundary="Boundary-01=_OBpJLuJNt54jnVC"\r
62 Content-Transfer-Encoding: 7bit\r
63 \r
64 \r
65 --Boundary-01=_OBpJLuJNt54jnVC\r
66 Content-Type: Text/Plain;\r
67   charset="us-ascii"\r
68 Content-Transfer-Encoding: quoted-printable\r
69 Content-Disposition: inline\r
70 \r
71 Hi there,\r
72 \r
73 I've patched notmuch to retain information on which folder emails are store=\r
74 d=20\r
75 in. This makes the transition from a folders-and-procmail model somewhat=20\r
76 easier. The resulting changes are attached.\r
77 \r
78 Andreas\r
79 \r
80 --Boundary-01=_OBpJLuJNt54jnVC\r
81 Content-Type: text/x-patch;\r
82   charset="UTF-8";\r
83   name="0001-Preseve-folder-information-when-indexing.patch"\r
84 Content-Transfer-Encoding: quoted-printable\r
85 Content-Disposition: attachment;\r
86         filename="0001-Preseve-folder-information-when-indexing.patch"\r
87 \r
88 =46rom 179af7f436d8c21bad90e7eb88fc17c56f83c26c Mon Sep 17 00:00:00 2001\r
89 =46rom: Andreas Kloeckner <inform@tiker.net>\r
90 Date: Mon, 14 Dec 2009 14:16:20 -0500\r
91 Subject: [PATCH] Preseve folder information when indexing.\r
92 \r
93 =2D--\r
94  lib/database.cc |   14 +++++++++-----\r
95  lib/index.cc    |    2 ++\r
96  lib/notmuch.h   |    1 +\r
97  notmuch-new.c   |   35 ++++++++++++++++++++++++++++++++++-\r
98  4 files changed, 46 insertions(+), 6 deletions(-)\r
99 \r
100 diff --git a/lib/database.cc b/lib/database.cc\r
101 index b6c4d07..e6b4272 100644\r
102 =2D-- a/lib/database.cc\r
103 +++ b/lib/database.cc\r
104 @@ -70,10 +70,9 @@ typedef struct {\r
105   *\r
106   *     MESSAGE_ID:     The unique ID of the mail mess (see "id" above)\r
107   *\r
108 =2D * In addition, terms from the content of the message are added with\r
109 =2D * "from", "to", "attachment", and "subject" prefixes for use by the\r
110 =2D * user in searching. But the database doesn't really care itself\r
111 =2D * about any of these.\r
112 + * In addition, terms from the content of the message are added with "from=\r
113 ",\r
114 + * "to", "attachment", "subject", and "folder" prefixes for use by the use=\r
115 r in\r
116 + * searching. But the database doesn't really care itself about any of the=\r
117 se.\r
118   *\r
119   * Timestamp document\r
120   * ------------------\r
121 @@ -124,7 +123,8 @@ prefix_t PROBABILISTIC_PREFIX[]=3D {\r
122      { "from", "XFROM" },\r
123      { "to", "XTO" },\r
124      { "attachment", "XATTACHMENT" },\r
125 =2D    { "subject", "XSUBJECT"}\r
126 +    { "subject", "XSUBJECT"},\r
127 +    { "folder", "XFOLDER"}\r
128  };\r
129 =20\r
130  int\r
131 @@ -889,6 +889,7 @@ _notmuch_database_link_message (notmuch_database_t *not=\r
132 much,\r
133  notmuch_status_t\r
134  notmuch_database_add_message (notmuch_database_t *notmuch,\r
135                               const char *filename,\r
136 +                             const char *folder_name,\r
137                               notmuch_message_t **message_ret)\r
138  {\r
139      notmuch_message_file_t *message_file;\r
140 @@ -1006,6 +1007,9 @@ notmuch_database_add_message (notmuch_database_t *not=\r
141 much,\r
142 =20\r
143         _notmuch_message_index_file (message, filename);\r
144 =20\r
145 +        if (folder_name !=3D NULL)\r
146 +            _notmuch_message_gen_terms (message, "folder", folder_name);\r
147 +\r
148         _notmuch_message_sync (message);\r
149      } catch (const Xapian::Error &error) {\r
150         fprintf (stderr, "A Xapian exception occurred adding message: %s.\n",\r
151 diff --git a/lib/index.cc b/lib/index.cc\r
152 index 125fa6c..55f3fbc 100644\r
153 =2D-- a/lib/index.cc\r
154 +++ b/lib/index.cc\r
155 @@ -116,6 +116,8 @@ skip_re_in_subject (const char *subject)\r
156             s++;\r
157         if (strncasecmp (s, "re:", 3) =3D=3D 0)\r
158             s +=3D 3;\r
159 +        else if (strncasecmp (s, "aw:", 3) =3D=3D 0)\r
160 +           s +=3D 3;\r
161         else\r
162             break;\r
163      }\r
164 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
165 index 60834fb..5d3b3c6 100644\r
166 =2D-- a/lib/notmuch.h\r
167 +++ b/lib/notmuch.h\r
168 @@ -265,6 +265,7 @@ notmuch_database_get_timestamp (notmuch_database_t *dat=\r
169 abase,\r
170  notmuch_status_t\r
171  notmuch_database_add_message (notmuch_database_t *database,\r
172                               const char *filename,\r
173 +                             const char *folder_name,\r
174                               notmuch_message_t **message);\r
175 =20\r
176  /* Find a message with the given message_id.\r
177 diff --git a/notmuch-new.c b/notmuch-new.c\r
178 index 9d20616..bc8adc8 100644\r
179 =2D-- a/notmuch-new.c\r
180 +++ b/notmuch-new.c\r
181 @@ -21,6 +21,7 @@\r
182  #include "notmuch-client.h"\r
183 =20\r
184  #include <unistd.h>\r
185 +#include <glib.h>\r
186 =20\r
187  static volatile sig_atomic_t do_add_files_print_progress =3D 0;\r
188 =20\r
189 @@ -144,6 +145,34 @@ add_files_recursive (notmuch_database_t *notmuch,\r
190      struct dirent **namelist =3D NULL;\r
191      int num_entries;\r
192 =20\r
193 +    gchar *full_folder_name =3D NULL;\r
194 +    gchar *folder_base_name =3D NULL;\r
195 +\r
196 +    /* Find name of "folder" containing the email. */\r
197 +    full_folder_name =3D g_strdup(path);\r
198 +    while (1)\r
199 +    {\r
200 +        folder_base_name =3D g_path_get_basename(full_folder_name);\r
201 +\r
202 +        if (strcmp(folder_base_name, "cur") =3D=3D 0\r
203 +                || strcmp(folder_base_name, "new") =3D=3D 0)\r
204 +        {\r
205 +            gchar *parent_name =3D g_path_get_dirname(full_folder_name);\r
206 +            g_free(full_folder_name);\r
207 +            full_folder_name =3D parent_name;\r
208 +        }\r
209 +        else\r
210 +            break;\r
211 +    }\r
212 +\r
213 +    g_free(full_folder_name);\r
214 +\r
215 +    if (strcmp(folder_base_name, ".") =3D=3D 0)\r
216 +    {\r
217 +        g_free(folder_base_name);\r
218 +        folder_base_name =3D NULL;\r
219 +    }\r
220 +\r
221      /* If we're told to, we bail out on encountering a read-only\r
222       * directory, (with this being a clear clue from the user to\r
223       * Notmuch that new mail won't be arriving there and we need not\r
224 @@ -235,7 +264,9 @@ add_files_recursive (notmuch_database_t *notmuch,\r
225                     fflush (stdout);\r
226                 }\r
227 =20\r
228 =2D             status =3D notmuch_database_add_message (notmuch, next, &message);\r
229 +               status =3D notmuch_database_add_message (notmuch, next,=20\r
230 +                                                       folder_base_name,=20\r
231 +                                                       &message);\r
232                 switch (status) {\r
233                     /* success */\r
234                     case NOTMUCH_STATUS_SUCCESS:\r
235 @@ -301,6 +332,8 @@ add_files_recursive (notmuch_database_t *notmuch,\r
236         closedir (dir);\r
237      if (namelist)\r
238         free (namelist);\r
239 +    if (folder_base_name)\r
240 +        g_free(folder_base_name);\r
241 =20\r
242      return ret;\r
243  }\r
244 =2D-=20\r
245 1.6.5\r
246 \r
247 \r
248 --Boundary-01=_OBpJLuJNt54jnVC--\r
249 \r
250 --nextPart1983344.e7oaIR2PZV\r
251 Content-Type: application/pgp-signature; name=signature.asc \r
252 Content-Description: This is a digitally signed message part.\r
253 \r
254 -----BEGIN PGP SIGNATURE-----\r
255 Version: GnuPG v1.4.10 (GNU/Linux)\r
256 \r
257 iD8DBQBLJpBOJZ7T4Hn4+FIRAv5IAJ9Yd+fs8bxZiQ05CTfh8ZEQYo2yLQCgg+pP\r
258 sPs3672uLyTZNkcIZlj0zR8=\r
259 =vdx5\r
260 -----END PGP SIGNATURE-----\r
261 \r
262 --nextPart1983344.e7oaIR2PZV--\r