unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: notmuch@notmuchmail.org
Subject: [PATCH 0/4] Versatile date/time parser
Date: Sun, 23 Jan 2011 12:47:23 +0100	[thread overview]
Message-ID: <1295783247-21900-1-git-send-email-sojkam1@fel.cvut.cz> (raw)

Hi all,

the following patch series brings into notmuch date/time parser stolen
from GNU coreutils. It can be applied on top of custom query parser
patches from Austin Clements.

This is RFC and it not meant for merging.

With these patches you can specify the date/time in many ways such as:
after:"last monday", after:"2 hours ago", etc. There are some
problems, though.

1) The parser is meant for parsing time instant specifications, which
   not convenient for use with before/after prepositions. For example
   after:"last Tuesday" should mean Wednesday, Thursday etc. and
   before:"last Tuesday" should mean Monday, Sunday, etc.

   Currently, "last Tuesday" means "Tuesday 00:00" and therefore,
   after:"last Tuesday" also matches mails sent on Tuesday.

2) "yesterday" means "24 hours ago" and not "yesterday midnight" as I
   would expect.

3) "Tuesday" means the "next Tuesday" instead of the "last Tuesday",
   which is natural in the context of emails (usually, there are no
   mails with future dates).

I think that all these problems could be fixed in the parser, but
maybe some others do not see them as problems or there might be a
better parser available for us to use. What do you think?

In any way, if anybody wants to try it, the whole patch serie (custom
query parser + date parse (without cworth's folder-based search)) is
available from my git repository:

   git pull git://rtime.felk.cvut.cz/notmuch.git date-parser

If we decide to use this parser, we might also want to reduce its
dependencies a bit. Since it is able to run even on DOS, there are
many compatibility functions included.

-Michal   

Michal Sojka (4):
  Import date/time parser from GNU coreutils
  Compile the date/time parser into notmuch library
  Use the time/date parser for after: and before: prefixes
  Add first date parser tests

 Makefile.local      |    3 +
 configure           |    8 +
 lib/Makefile.local  |    5 +-
 lib/c-ctype.c       |  398 ++++++
 lib/c-ctype.h       |  297 +++++
 lib/config.h        |   45 +
 lib/database.cc     |   14 +-
 lib/getdate.c       | 3534 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/getdate.h       |   31 +
 lib/getdate.y       | 1609 +++++++++++++++++++++++
 lib/gettime.c       |   48 +
 lib/intprops.h      |   83 ++
 lib/timespec.h      |   39 +
 lib/verify.h        |  140 ++
 test/Makefile.local |    9 +-
 test/basic          |    2 +-
 test/date-parser    |   37 +
 test/notmuch-test   |    2 +-
 18 files changed, 6293 insertions(+), 11 deletions(-)
 create mode 100644 lib/c-ctype.c
 create mode 100644 lib/c-ctype.h
 create mode 100644 lib/config.h
 create mode 100644 lib/getdate.c
 create mode 100644 lib/getdate.h
 create mode 100644 lib/getdate.y
 create mode 100644 lib/gettime.c
 create mode 100644 lib/gettime.h
 create mode 100644 lib/intprops.h
 create mode 100644 lib/timespec.h
 create mode 100644 lib/verify.h
 create mode 100755 test/date-parser

-- 
1.7.2.3

             reply	other threads:[~2011-01-23 11:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-23 11:47 Michal Sojka [this message]
2011-01-23 11:47 ` [PATCH 1/4] Import date/time parser from GNU coreutils Michal Sojka
2011-01-24 21:25   ` Jameson Rollins
2011-01-25  8:41     ` Michal Sojka
2011-01-23 11:47 ` [PATCH 2/4] Compile the date/time parser into notmuch library Michal Sojka
2011-01-23 11:47 ` [PATCH 3/4] Use the time/date parser for after: and before: prefixes Michal Sojka
2011-01-23 11:47 ` [PATCH 4/4] Add first date parser tests Michal Sojka
2011-01-29  4:09 ` [PATCH 0/4] Versatile date/time parser Tom Prince
2011-01-29 18:50   ` Michal Sojka
2011-01-29 19:13     ` Austin Clements
2011-02-01  8:34       ` Michal Sojka
2011-01-29 19:37     ` Sebastian Spaeth
2011-02-01  8:36       ` Michal Sojka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295783247-21900-1-git-send-email-sojkam1@fel.cvut.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).