[PATCH 3/7] emacs: hello: store previous saved-search results
[notmuch-archives.git] / 31 / 3a520750f255971f10b8260635fbd1fa9e6059
1 Return-Path: <jani@nikula.org>\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 61C3D431FBF\r
6         for <notmuch@notmuchmail.org>; Mon,  1 Apr 2013 12:38:09 -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 ASc43MD-JSaF for <notmuch@notmuchmail.org>;\r
16         Mon,  1 Apr 2013 12:38:07 -0700 (PDT)\r
17 Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com\r
18         [209.85.217.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 07F1A431FAE\r
21         for <notmuch@notmuchmail.org>; Mon,  1 Apr 2013 12:38:06 -0700 (PDT)\r
22 Received: by mail-lb0-f182.google.com with SMTP id z13so2265488lbh.27\r
23         for <notmuch@notmuchmail.org>; Mon, 01 Apr 2013 12:38:05 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=x-received:from:to:cc:subject:in-reply-to:references:user-agent\r
27         :date:message-id:mime-version:content-type:x-gm-message-state;\r
28         bh=3WHwMNrTInsmxWpNB0YfF9ysF7kB8VOwCYl9cIJc0Lc=;\r
29         b=EdyUcttnlO521BjJiZFenoZnI2u+s99Co9DX/QS9dUQaP0Wtzeiqv1zQNrZKFPsfxR\r
30         ial6vSZ4BLZjJY/2P5mYbExomzt9yBFiKrhbrQqCE4r+odHjl43Ij6eTEwAkPSLCtMzv\r
31         xj2g/yDvQpNuB4N+Fs0E2FGff0jB9I+1StpfF6olld8DwpLqxeol6yqHTDFX0VdHrNCj\r
32         yvAyO01hBnzVaqQSxNQclATecHbSLSRmoIuI1RPv6pimWJuWhybguKoS9D3UY7QjSVih\r
33         QxAmd8nYfh2CrtzLwbyzzQ9okAlBgXXbs7Wpp/FGXuFYuCizqajTQYhzMBLHxzBlCims\r
34         DHUQ==\r
35 X-Received: by 10.112.180.105 with SMTP id dn9mr6260468lbc.10.1364845085490;\r
36         Mon, 01 Apr 2013 12:38:05 -0700 (PDT)\r
37 Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
38         [80.223.81.27])\r
39         by mx.google.com with ESMTPS id c7sm2795312lbe.6.2013.04.01.12.38.03\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Mon, 01 Apr 2013 12:38:04 -0700 (PDT)\r
42 From: Jani Nikula <jani@nikula.org>\r
43 To: Peter Wang <novalazy@gmail.com>, David Bremner <david@tethera.net>\r
44 Subject: Re: [PATCH v4 06/12] test: add tests for insert\r
45 In-Reply-To: <20130330150537.GA1971@hili.localdomain>\r
46 References: <1359029288-12132-1-git-send-email-novalazy@gmail.com>\r
47         <1359029288-12132-7-git-send-email-novalazy@gmail.com>\r
48         <87d2uhiwoz.fsf@maritornes.cs.unb.ca>\r
49         <20130330150537.GA1971@hili.localdomain>\r
50 User-Agent: Notmuch/0.15.2+70~g2eeb96a (http://notmuchmail.org) Emacs/24.2.1\r
51         (x86_64-pc-linux-gnu)\r
52 Date: Mon, 01 Apr 2013 22:38:02 +0300\r
53 Message-ID: <87wqsmnisl.fsf@nikula.org>\r
54 MIME-Version: 1.0\r
55 Content-Type: text/plain\r
56 X-Gm-Message-State:\r
57  ALoCoQlG3y/LzKPrOUx5eu5Eheunc1ZyNPZt0hywh8mdI2jCBO4/NDGyGpTUSc2BmYX4zUViBfzc\r
58 Cc: notmuch@notmuchmail.org\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Mon, 01 Apr 2013 19:38:09 -0000\r
72 \r
73 On Sat, 30 Mar 2013, Peter Wang <novalazy@gmail.com> wrote:\r
74 > On Fri, 29 Mar 2013 19:59:56 -0400, David Bremner <david@tethera.net> wrote:\r
75 >> \r
76 >> It took longer than I thought (of course) but I finally finished looking\r
77 >> at the first 6 patches. \r
78 >> \r
79 >> I already mentioned a minor man page issue in a seperate message.\r
80 >> \r
81 >> I took a second pass through 03/12, and I think I would prefer thethe\r
82 >> control flow of insert_message be closer to the standard style in\r
83 >> notmuch of using a return value variable and a single cleanup block at\r
84 >> the end.  Reasonable people can disagree about issues of style, but in\r
85 >> the end consistency of the code base is also important.\r
86 \r
87 I think sync_dir() was worse than insert_message() in this regard.\r
88 \r
89 >> \r
90 >> d\r
91 >       \r
92 > static notmuch_bool_t\r
93 > insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,\r
94 >               const char *dir, tag_op_list_t *tag_ops)\r
95 > {\r
96 >     char *tmppath;\r
97 >     char *newpath;\r
98 >     char *newdir;\r
99 >     int fdout;\r
100 >     char *cleanup_path;\r
101 >\r
102 >     fdout = maildir_open_tmp_file (ctx, dir, &tmppath, &newpath, &newdir);\r
103 >     if (fdout < 0)\r
104 >       return FALSE;\r
105 >\r
106 >     cleanup_path = tmppath;\r
107 >\r
108 >     if (! copy_stdin (fdin, fdout))\r
109 >       goto DONE;\r
110 >\r
111 >     if (fsync (fdout) != 0) {\r
112 >       fprintf (stderr, "Error: fsync failed: %s\n", strerror (errno));\r
113 >       goto DONE;\r
114 >     }\r
115 >\r
116 >     close (fdout);\r
117 >     fdout = -1;\r
118 >\r
119 >     /* Atomically move the new message file from the Maildir 'tmp' directory\r
120 >      * to the 'new' directory.  We follow the Dovecot recommendation to\r
121 >      * simply use rename() instead of link() and unlink().\r
122 >      * See also: http://wiki.dovecot.org/MailboxFormat/Maildir#Mail_delivery\r
123 >      */\r
124 >     if (rename (tmppath, newpath) != 0) {\r
125 >       fprintf (stderr, "Error: rename() failed: %s\n", strerror (errno));\r
126 >       goto DONE;\r
127 >     }\r
128 >\r
129 >     cleanup_path = newpath;\r
130 >\r
131 >     if (! add_file_to_database (notmuch, newpath, tag_ops)) {\r
132 >       /* XXX add an option to keep the file in maildir? */\r
133 >       goto DONE;\r
134 >     }\r
135 >\r
136 >     if (! sync_dir (newdir))\r
137 >       goto DONE;\r
138 >\r
139 >     cleanup_path = NULL; /* success */\r
140 \r
141 Put the happy day return TRUE here, and don't bother with the above\r
142 statement.\r
143 \r
144 >\r
145 >   DONE:\r
146 >     if (fdout >= 0)\r
147 >       close (fdout);\r
148 >\r
149 >     if (cleanup_path) {\r
150 >       unlink (cleanup_path);\r
151 >       return FALSE;\r
152 >     }\r
153 >\r
154 >     return TRUE;\r
155 \r
156 Only have the return FALSE path here. You can unconditionally unlink\r
157 (cleanup_path) too AFAICS.\r
158 \r
159 > }\r
160 > _______________________________________________\r
161 > notmuch mailing list\r
162 > notmuch@notmuchmail.org\r
163 > http://notmuchmail.org/mailman/listinfo/notmuch\r