Re: NOTMUCH_STATUS_LAST_STATUS problematic across additive library upgrades
[notmuch-archives.git] / 91 / 66a0fe13ae168cd2987c30de434eb4140dc9b6
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 A6E0D431FBD\r
6         for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 21:05:23 -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.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 Unj1Q7302c8t for <notmuch@notmuchmail.org>;\r
16         Sat, 25 Feb 2012 21:05:22 -0800 (PST)\r
17 Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
18         [209.85.215.53]) (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 269FD431FAE\r
21         for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 21:05:21 -0800 (PST)\r
22 Received: by lahd3 with SMTP id d3so4359286lah.26\r
23         for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 21:05:19 -0800 (PST)\r
24 Received-SPF: pass (google.com: domain of jani@nikula.org designates\r
25         10.152.123.68 as permitted sender) client-ip=10.152.123.68; \r
26 Authentication-Results: mr.google.com;\r
27         spf=pass (google.com: domain of jani@nikula.org\r
28         designates 10.152.123.68 as permitted sender)\r
29         smtp.mail=jani@nikula.org\r
30 Received: from mr.google.com ([10.152.123.68])\r
31         by 10.152.123.68 with SMTP id ly4mr6923784lab.13.1330232719286\r
32         (num_hops = 1); Sat, 25 Feb 2012 21:05:19 -0800 (PST)\r
33 Received: by 10.152.123.68 with SMTP id ly4mr5018536lab.13.1330199611811;\r
34         Sat, 25 Feb 2012 11:53:31 -0800 (PST)\r
35 Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi.\r
36         [84.248.80.253])\r
37         by mx.google.com with ESMTPS id w10sm10806424lbe.14.2012.02.25.11.53.29\r
38         (version=SSLv3 cipher=OTHER); Sat, 25 Feb 2012 11:53:30 -0800 (PST)\r
39 From: Jani Nikula <jani@nikula.org>\r
40 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
41 Subject: Re: [RFC PATCH 0/2] natural language date range search\r
42 In-Reply-To: <m2mx87j6lz.fsf@guru.guru-group.fi>\r
43 References: <cover.1329689945.git.jani@nikula.org>\r
44         <m2mx87j6lz.fsf@guru.guru-group.fi>\r
45 User-Agent: Notmuch/0.11.1+206~gc02a53f (http://notmuchmail.org) Emacs/23.3.1\r
46         (i686-pc-linux-gnu)\r
47 Date: Sat, 25 Feb 2012 21:53:27 +0200\r
48 Message-ID: <87ehtiitag.fsf@nikula.org>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=us-ascii\r
51 X-Gm-Message-State:\r
52  ALoCoQk/WIQZLZVu84eW/JEysuCmUfDexFcrGEH+x28jHu4CXUsL1wxC3gQ0dXh2VMvGaWqdzn2U\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Sun, 26 Feb 2012 05:05:23 -0000\r
66 \r
67 On Sat, 25 Feb 2012 17:05:44 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
68 > On Mon, 20 Feb 2012 00:55:50 +0200, Jani Nikula <jani@nikula.org> wrote:\r
69 > > Hi all, these patches add support for natural language date range search\r
70 > > of the form date:since..until, where since and until can be fairly free\r
71 > > form date/time expressions in English.\r
72 > > \r
73 > > Examples:\r
74 > > \r
75 > > date:two-days..yesterday (all mail in the two days before today)\r
76 > > date:12h.. (all mail since 12 hrs ago)\r
77 > > date:november..november (all mail in previous november)\r
78 > > date:2011.. (all mail since the beginning of 2011)\r
79 > > date:last-week..this-week (all mail over last and current week)\r
80 > > date:5/10/2011-12:34:55..10pm_2012-01-14\r
81 > > \r
82 > > Plus plenty more and combinations of the above.\r
83\r
84 > Pretty c00l, the above and the code.\r
85 \r
86 Thanks! :)\r
87 \r
88 > > \r
89 > > The repository for the date/time parser with a command line tool is at\r
90 > > [1], and there's a README [2] with a bunch of details too.\r
91\r
92 > By seeing the thoughts thrown in IRC there seems to be plenty if things\r
93 > to resolve until something like this is going to be available in stock\r
94 > notmuch. In the meanwhile I provide some ideas into the soup; maybe\r
95 > our collective mind can have some use of this.\r
96\r
97\r
98 > Q: Could 'date:timestr' be converted to 'date:timestr..timestr' ?\r
99 \r
100 AFAICT this would require the custom query parser.\r
101 \r
102 > In this idea -<timestr> means relative time and <timestr> absolute\r
103 > time. The the time string consists of number and letter and assume\r
104 > the above suggestion for date:timestr (<- == date:timestr..timestr)\r
105 > Letters are s seconds  h hours  d days  w weeks  m months (more\r
106 > useful than for minutes) and  y years.\r
107 \r
108 I'll put it bluntly: show me the code! ;)\r
109 \r
110 I'll comment below how your examples can be expressed with working code\r
111 in this series, just for comparison, and to show what can be done with\r
112 this.\r
113 \r
114 > date:-2000s     email exactly 2000 seconds ago (not very useful)\r
115 \r
116 date:2000s..2000s\r
117 \r
118 > date:-2000s..   since 2000 secs in past\r
119 \r
120 date:2000s..\r
121 date:1000s500s500s.. (all accumulated)\r
122 \r
123 > date:..-2000s   up to 2000 secs in past\r
124 \r
125 date:..2000s\r
126 \r
127 > date:3600s      email with date 01:00 -- today if (local) time is\r
128 >                 more than 1am. yesterday if less. If there is not\r
129 >                 mail with date exactly that then no email matches\r
130 >                 (i.e. same usefullness applies as above)\r
131 > date:3600s..    email with date since 01:00 (same today/yesterday\r
132 >                 resolvation like above)\r
133 \r
134 Okay, there's no easy way to express it like this.\r
135 \r
136 > date:12h..      since noon, either yesterday (time less than 12pm)\r
137 >                 or today (currently afternoon)\r
138 \r
139 date:noon.. \r
140 date:12pm..\r
141 date:12:00..\r
142 date:12:00:00..\r
143 \r
144 (I think in my implementation currently refers to today regardless of\r
145 current time; there's a REVISIT comment about that. Not difficult to\r
146 fix.)\r
147 \r
148 > date:12h        like above, but since 12:00 to 13:00\r
149 > date:12h..12h   ditto\r
150 \r
151 For example date:noon..13:00\r
152 \r
153 > date:6pm..      since 18:00 either today (current time > 6pm) or yesterday\r
154 \r
155 The same.\r
156 \r
157 > date:-12h..     since 12 hours ago\r
158 \r
159 date:12h..\r
160 \r
161 > date:-12h       since 12 hours ago to 11 hours ago\r
162 \r
163 date:12h..11hrs\r
164 \r
165 > date:-1h        last hour\r
166 \r
167 date:1h..\r
168 \r
169 > date:0h         today 12am - 01am \r
170 \r
171 For example date:00:00..01am\r
172 \r
173 > date:-0d        today\r
174 \r
175 To cover the whole day, date:today..today\r
176 \r
177 > date:-0d..      ditto\r
178 \r
179 date:0d..0d (from zero days ago to zero days ago, rounded accordingly)\r
180 \r
181 In fact, in my implementation "today" is simply the same as 0 days ago.\r
182 \r
183 > date:-1d        yesterday\r
184 \r
185 date:yesterday..yesterday\r
186 \r
187 > date:-1d..      yesterday & today\r
188 \r
189 date:1d..\r
190 \r
191 > date:-2d        2 days ago\r
192 \r
193 For example date:two-days..2d\r
194 \r
195 > date:-2d..      day before yesterday, yesterday & today\r
196 \r
197 date:2d..\r
198 \r
199 > date:0d         last sunday (if today sunday, today (so being consistent))\r
200 \r
201 date:sunday..sunday (if today sunday, one week ago)\r
202 \r
203 > date:1d         last monday (like above)\r
204 > date:6d         last saturday (like above)\r
205 > date:7d         last sunday (same as 0d)\r
206 \r
207 Just weekday names.\r
208 \r
209 > date:-0w        current week (does week start sun or mon)\r
210 \r
211 For example date:0w...this-week\r
212 \r
213 > date:-1w        last week (same as above)\r
214 \r
215 For example date:last-week..1w\r
216 \r
217 > date:-2w..      since beginning of 2 weeks ago\r
218 \r
219 date:2w..\r
220 \r
221 > date:1w         (ISO) week number ? current week it this is same week  \r
222 >                 number. this week last year if current week is less.\r
223 > date:1w..     since the above date resolved.\r
224 \r
225 N/A, my parser does not support week numbers.\r
226 \r
227 > date:11m      last november (m is more useable in month than in minute)\r
228 \r
229 date:november..november, or by specifying the year date:2011-11..2011-11\r
230 \r
231 > date:11m..      since last november\r
232 \r
233 date:november..\r
234 \r
235 > date:-11m       whole month 11 months ago\r
236 \r
237 date:11mon..11M (lower case m is minutes)\r
238 \r
239 > date:-11m..   since beginning of 11 months ago\r
240 \r
241 date:11months..\r
242 \r
243 > date:70y      year 1970\r
244 \r
245 date:1970..1970\r
246 \r
247 > date:69y        year 2069\r
248 \r
249 date:2069..2069\r
250 \r
251 > date:0y         year 2000\r
252 \r
253 date:2000..2000\r
254 \r
255 > date:99y..      since beginning of 1999\r
256 \r
257 date:2000..\r
258 \r
259 (It's possible to use 2-digit years in combination with some more\r
260 context, e.g. 1.1.99)\r
261 \r
262 > date:-0y        this year\r
263 \r
264 date:this-year..this-year\r
265 \r
266 > date:-1y        last year\r
267 \r
268 date:last-year..1y\r
269 \r
270 > This is incomplete, but pretty easy to use format. Letters from English\r
271 > language. What is missing letter for month (M?) ar mday (D?). All thought\r
272 > as in local time...\r
273\r
274 > ... strings could be concatenated: for example: -3d11h (meaning second\r
275 > always absolute). Need to be in granularity order (or something). Timezone\r
276 > could be added (pst, utc, eest, z -- and even like -11 or +4\r
277 > ( -2y11m+7 meaning year 2010 november in timezone utc + 7 (this year: 2012))\r
278 \r
279 My implementation allows adding any number of relative dates, and they\r
280 are accumulated, but only towards past. Relative date can be combined\r
281 with absolute date, as long as the same absolute unit is not specified\r
282 twice (can't say "january february", but "january one month" is one\r
283 month back from january).\r
284 \r
285 (With a couple of small further patches still in my local tree) you can\r
286 specify time zone for all of the above.\r
287 \r
288 \r
289 BR,\r
290 Jani.\r
291 \r
292 \r
293 \r
294\r
295 > Of course range date:-2d..-5h would be supported.\r
296\r
297 > > BR,\r
298 > > Jani.\r
299 > > \r
300 > > \r
301 > > [1] https://gitorious.org/parse-time-string/parse-time-string\r
302 > > [2] https://gitorious.org/parse-time-string/parse-time-string/blobs/master/README\r
303 > > \r
304\r
305 > Tomi\r
306\r