1 Return-Path: <sojkam1@fel.cvut.cz>
\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 C07FB431FB6
\r
6 for <notmuch@notmuchmail.org>; Sun, 23 Jan 2011 03:47:41 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 cLoGVSL-Fzbm for <notmuch@notmuchmail.org>;
\r
16 Sun, 23 Jan 2011 03:47:40 -0800 (PST)
\r
17 Received: from mail.loccal.net (gw.loccal.net [94.142.235.206])
\r
18 by olra.theworths.org (Postfix) with ESMTP id C4F9D431FD0
\r
19 for <notmuch@notmuchmail.org>; Sun, 23 Jan 2011 03:47:40 -0800 (PST)
\r
20 Received: from localhost (localhost [127.0.0.1])
\r
21 by mail.loccal.net (Postfix) with ESMTP id 4254A1BDAE;
\r
22 Sun, 23 Jan 2011 13:00:56 +0100 (CET)
\r
23 X-Virus-Scanned: amavisd-new at loccal.net
\r
24 Received: from mail.loccal.net ([127.0.0.1])
\r
25 by localhost (mail.loccal.net [127.0.0.1]) (amavisd-new, port 10024)
\r
26 with LMTP id i7W6RjjnJYob; Sun, 23 Jan 2011 13:00:51 +0100 (CET)
\r
27 Received: from steelpick.2x.cz (unknown [10.21.129.4])
\r
28 by mail.loccal.net (Postfix) with ESMTPS id 6D54A1043A;
\r
29 Sun, 23 Jan 2011 13:00:51 +0100 (CET)
\r
30 Received: from wsh by steelpick.2x.cz with local (Exim 4.72)
\r
31 (envelope-from <sojkam1@fel.cvut.cz>)
\r
32 id 1PgyPu-0005hv-6K; Sun, 23 Jan 2011 12:47:34 +0100
\r
33 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH 0/4] Versatile date/time parser
\r
36 Date: Sun, 23 Jan 2011 12:47:23 +0100
\r
37 Message-Id: <1295783247-21900-1-git-send-email-sojkam1@fel.cvut.cz>
\r
38 X-Mailer: git-send-email 1.7.2.3
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Sun, 23 Jan 2011 11:47:41 -0000
\r
55 the following patch series brings into notmuch date/time parser stolen
\r
56 from GNU coreutils. It can be applied on top of custom query parser
\r
57 patches from Austin Clements.
\r
59 This is RFC and it not meant for merging.
\r
61 With these patches you can specify the date/time in many ways such as:
\r
62 after:"last monday", after:"2 hours ago", etc. There are some
\r
65 1) The parser is meant for parsing time instant specifications, which
\r
66 not convenient for use with before/after prepositions. For example
\r
67 after:"last Tuesday" should mean Wednesday, Thursday etc. and
\r
68 before:"last Tuesday" should mean Monday, Sunday, etc.
\r
70 Currently, "last Tuesday" means "Tuesday 00:00" and therefore,
\r
71 after:"last Tuesday" also matches mails sent on Tuesday.
\r
73 2) "yesterday" means "24 hours ago" and not "yesterday midnight" as I
\r
76 3) "Tuesday" means the "next Tuesday" instead of the "last Tuesday",
\r
77 which is natural in the context of emails (usually, there are no
\r
78 mails with future dates).
\r
80 I think that all these problems could be fixed in the parser, but
\r
81 maybe some others do not see them as problems or there might be a
\r
82 better parser available for us to use. What do you think?
\r
84 In any way, if anybody wants to try it, the whole patch serie (custom
\r
85 query parser + date parse (without cworth's folder-based search)) is
\r
86 available from my git repository:
\r
88 git pull git://rtime.felk.cvut.cz/notmuch.git date-parser
\r
90 If we decide to use this parser, we might also want to reduce its
\r
91 dependencies a bit. Since it is able to run even on DOS, there are
\r
92 many compatibility functions included.
\r
97 Import date/time parser from GNU coreutils
\r
98 Compile the date/time parser into notmuch library
\r
99 Use the time/date parser for after: and before: prefixes
\r
100 Add first date parser tests
\r
102 Makefile.local | 3 +
\r
104 lib/Makefile.local | 5 +-
\r
105 lib/c-ctype.c | 398 ++++++
\r
106 lib/c-ctype.h | 297 +++++
\r
107 lib/config.h | 45 +
\r
108 lib/database.cc | 14 +-
\r
109 lib/getdate.c | 3534 +++++++++++++++++++++++++++++++++++++++++++++++++++
\r
110 lib/getdate.h | 31 +
\r
111 lib/getdate.y | 1609 +++++++++++++++++++++++
\r
112 lib/gettime.c | 48 +
\r
113 lib/intprops.h | 83 ++
\r
114 lib/timespec.h | 39 +
\r
115 lib/verify.h | 140 ++
\r
116 test/Makefile.local | 9 +-
\r
118 test/date-parser | 37 +
\r
119 test/notmuch-test | 2 +-
\r
120 18 files changed, 6293 insertions(+), 11 deletions(-)
\r
121 create mode 100644 lib/c-ctype.c
\r
122 create mode 100644 lib/c-ctype.h
\r
123 create mode 100644 lib/config.h
\r
124 create mode 100644 lib/getdate.c
\r
125 create mode 100644 lib/getdate.h
\r
126 create mode 100644 lib/getdate.y
\r
127 create mode 100644 lib/gettime.c
\r
128 create mode 100644 lib/gettime.h
\r
129 create mode 100644 lib/intprops.h
\r
130 create mode 100644 lib/timespec.h
\r
131 create mode 100644 lib/verify.h
\r
132 create mode 100755 test/date-parser
\r