Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 05 / b51ca05da5f90329315f355ffcfe84f8e90412
1 Return-Path: <amthrax@drake.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 2DC5E429E2A\r
6         for <notmuch@notmuchmail.org>; Thu, 17 Feb 2011 23:59:34 -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 245GJsxcANEH for <notmuch@notmuchmail.org>;\r
16         Thu, 17 Feb 2011 23:59:32 -0800 (PST)\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 6B3A0429E2F\r
20         for <notmuch@notmuchmail.org>; Thu, 17 Feb 2011 23:59:25 -0800 (PST)\r
21 X-AuditID: 1209190c-b7ba9ae0000009f8-90-4d5e26dcf885\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Brightmail Gateway) with\r
24         SMTP id 0C.A5.02552.CD62E5D4; Fri, 18 Feb 2011 02:59:25 -0500 (EST)\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 p1I7xOnh009335; \r
27         Fri, 18 Feb 2011 02:59:24 -0500\r
28 Received: from drake.mit.edu\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p1I7xNSH001533\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Fri, 18 Feb 2011 02:59:24 -0500 (EST)\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.72)\r
36         (envelope-from <amthrax@drake.mit.edu>)\r
37         id 1PqLFL-0008LB-JA; Fri, 18 Feb 2011 02:59:23 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 03/10] new: Defer updating directory mtimes until the end.\r
41 Date: Fri, 18 Feb 2011 02:58:53 -0500\r
42 Message-Id: <1298015940-31986-4-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.2.3\r
44 In-Reply-To: <1298015940-31986-1-git-send-email-amdragon@mit.edu>\r
45 References: <1298015940-31986-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker: AAAAAA==\r
47 Cc: amdragon@mit.edu\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Fri, 18 Feb 2011 07:59:34 -0000\r
61 \r
62 Previously, if notmuch new were interrupted between updating the\r
63 directory mtime and handling removals from that directory, a\r
64 subsequent notmuch new would not handle those removals until something\r
65 else changed in that directory.  This defers recording the updated\r
66 mtime until after removals are handled to eliminate this problem.\r
67 ---\r
68  notmuch-new.c |   23 +++++++++++++++++------\r
69  1 files changed, 17 insertions(+), 6 deletions(-)\r
70 \r
71 diff --git a/notmuch-new.c b/notmuch-new.c\r
72 index a910e5f..65682d8 100644\r
73 --- a/notmuch-new.c\r
74 +++ b/notmuch-new.c\r
75 @@ -24,6 +24,7 @@\r
76  \r
77  typedef struct _filename_node {\r
78      char *filename;\r
79 +    time_t mtime;\r
80      struct _filename_node *next;\r
81  } _filename_node_t;\r
82  \r
83 @@ -46,6 +47,7 @@ typedef struct {\r
84  \r
85      _filename_list_t *removed_files;\r
86      _filename_list_t *removed_directories;\r
87 +    _filename_list_t *directory_mtimes;\r
88  \r
89      notmuch_bool_t synchronize_flags;\r
90      _filename_list_t *message_ids_to_sync;\r
91 @@ -87,7 +89,7 @@ _filename_list_create (const void *ctx)\r
92      return list;\r
93  }\r
94  \r
95 -static void\r
96 +static _filename_node_t *\r
97  _filename_list_add (_filename_list_t *list,\r
98                     const char *filename)\r
99  {\r
100 @@ -100,6 +102,8 @@ _filename_list_add (_filename_list_t *list,\r
101  \r
102      *(list->tail) = node;\r
103      list->tail = &node->next;\r
104 +\r
105 +    return node;\r
106  }\r
107  \r
108  static void\r
109 @@ -505,11 +509,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
110         notmuch_filenames_move_to_next (db_subdirs);\r
111      }\r
112  \r
113 -    if (! interrupted) {\r
114 -       status = notmuch_directory_set_mtime (directory, fs_mtime);\r
115 -       if (status && ret == NOTMUCH_STATUS_SUCCESS)\r
116 -           ret = status;\r
117 -    }\r
118 +    _filename_list_add (state->directory_mtimes, path)->mtime = fs_mtime;\r
119  \r
120    DONE:\r
121      if (next)\r
122 @@ -825,6 +825,7 @@ notmuch_new_command (void *ctx, int argc, char *argv[])\r
123  \r
124      add_files_state.removed_files = _filename_list_create (ctx);\r
125      add_files_state.removed_directories = _filename_list_create (ctx);\r
126 +    add_files_state.directory_mtimes = _filename_list_create (ctx);\r
127  \r
128      if (! debugger_is_active () && add_files_state.output_is_a_tty\r
129         && ! add_files_state.verbose) {\r
130 @@ -863,8 +864,18 @@ notmuch_new_command (void *ctx, int argc, char *argv[])\r
131         }\r
132      }\r
133  \r
134 +    for (f = add_files_state.directory_mtimes->head; f && !interrupted; f = f->next) {\r
135 +       notmuch_directory_t *directory;\r
136 +       directory = notmuch_database_get_directory (notmuch, f->filename);\r
137 +       if (directory) {\r
138 +           notmuch_directory_set_mtime (directory, f->mtime);\r
139 +           notmuch_directory_destroy (directory);\r
140 +       }\r
141 +    }\r
142 +\r
143      talloc_free (add_files_state.removed_files);\r
144      talloc_free (add_files_state.removed_directories);\r
145 +    talloc_free (add_files_state.directory_mtimes);\r
146  \r
147      /* Now that removals are done (hence the database is aware of all\r
148       * renames), we can synchronize maildir_flags to tags for all\r
149 -- \r
150 1.7.2.3\r
151 \r