[O] [PATCH] Reschedule "++" repeaters on same day if in future
If you have a task with the following timestamp: SCHEDULED: <2016-06-19 Sun 21:00 ++1w> then marking it as DONE at [2016-06-27 at 07:00] should (debatably) result in SCHEDULED: <2016-06-26 Sun 21:00 ++1w> but instead it becomes SCHEDULED: <2016-07-03 Sun 21:00 ++1w> The attached patch changes the behavior to not skip a repeat occurrence that would occur on the day that a task is completed, if there is a time in the timestamp and it is after the current time. This is really useful, at least for me, and also matches a literal reading of the docs. They say (regarding a "++1w" repeater) #+BEGIN_QUOTE Marking this DONE will shift the date by at least one week, but also by as many weeks as it takes to get this date into the future. #+END_QUOTE With a time before the repeater SCHEDULED: <2016-06-19 Sun 21:00 ++1w> you seem to be saying that you don't start working on this task until Sunday evening every week. If you get busy and don't mark it DONE until the next Sunday morning, then you must be talking about the previous instance, not the repeat occurrence which will become available later that day. So it makes sense to increase the timestamp to later that day: SCHEDULED: <2016-06-26 Sun 21:00 ++1w> For another example, suppose you empty the kitchen trash every night: SCHEDULED: <2016-06-19 Sun 22:00 ++1d> If you don't complete that occurrence for two days and then empty the trash on Tuesday morning, you would still want to empty it that night: SCHEDULED: <2016-06-21 Tue 22:00 ++1d> as opposed to skipping Tuesday night and repeating on Wednesday. These examples seem useful to me. But this change could, in theory, lead to the absurd situation of rescheduling a task for just a couple minutes after its completion. But to me that seems the lesser of two evils; you just mark it DONE again, versus the alternative of thinking that you'll be reminded of a task only to forget all about it. If the task is *already* scheduled for later today, this patch does not affect the current behavior--the task will still be rescheduled on the next occurrence on some future day. From 59328aa0089bb376df86c89128a741a59d41c378 Mon Sep 17 00:00:00 2001 From: Don March Date: Sun, 26 Jun 2016 23:35:44 -0700 Subject: [PATCH] Reschedule "++" repeaters on same day if in future * lisp/org.el (org-auto-repeat-maybe): Include a time in a timestamp (hours and minutes) when checking if a repeat occurrence is in the future. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e13e82d..0b102fb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13287,8 +13287,8 @@ has been set" (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) - (<= (time-to-days time) - (time-to-days (current-time + (or (time-less-p time (current-time)) + (equal time (current-time (when (= (cl-incf nshift) nshiftmax) (or (y-or-n-p (format "%d repeater intervals were not \ -- 2.8.1
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Hello, Don March writes: > If you have a task with the following timestamp: > > SCHEDULED: <2016-06-19 Sun 21:00 ++1w> > > then marking it as DONE at [2016-06-27 at 07:00] should (debatably) > result in ISYM [2016-06-26 at 07:00]. > SCHEDULED: <2016-06-26 Sun 21:00 ++1w> > > but instead it becomes > > SCHEDULED: <2016-07-03 Sun 21:00 ++1w> With the correction above, it makes sense, indeed. > - (<= (time-to-days time) > - (time-to-days (current-time > + (or (time-less-p time (current-time)) > + (equal time (current-time You should merge both `or'. Also, (equal time (current-time)) is always nil since they don't have the same structure. You could write instead (while (or (= nshift 0) (not (time-less-p (current-time) time))) ...) It would be nice to add an explanation along with an example about that in the manual, too. WDYT? Thank you for your patch. Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Nicolas Goaziou writes: > Don March writes: >> If you have a task with the following timestamp: >> >> SCHEDULED: <2016-06-19 Sun 21:00 ++1w> >> >> then marking it as DONE at [2016-06-27 at 07:00] should [...] > ISYM [2016-06-26 at 07:00]. Yes :) Thanks for understanding anyway. (and ITYM "ITYM", maybe?) > You should merge both `or'. Also, (equal time (current-time)) is always > nil since they don't have the same structure. You're right about both things. I updated the patch, and also added an example to the manual. If that's not what you had it mind, let me know or feel free to edit. On Thu, Jun 30, 2016 at 8:16 AM, Nicolas Goaziou wrote: > Hello, > > Don March writes: > >> If you have a task with the following timestamp: >> >> SCHEDULED: <2016-06-19 Sun 21:00 ++1w> >> >> then marking it as DONE at [2016-06-27 at 07:00] should (debatably) >> result in > > ISYM [2016-06-26 at 07:00]. > >> SCHEDULED: <2016-06-26 Sun 21:00 ++1w> >> >> but instead it becomes >> >> SCHEDULED: <2016-07-03 Sun 21:00 ++1w> > > With the correction above, it makes sense, indeed. > >> - (<= (time-to-days time) >> - (time-to-days (current-time >> + (or (time-less-p time (current-time)) >> + (equal time (current-time > > You should merge both `or'. Also, (equal time (current-time)) is always > nil since they don't have the same structure. > > You could write instead > > (while (or (= nshift 0) > (not (time-less-p (current-time) time))) > ...) > > It would be nice to add an explanation along with an example about that > in the manual, too. WDYT? > > Thank you for your patch. > > Regards, > > -- > Nicolas Goaziou From 5b5fe9b5028d2074c30f271dbc2d63984da2ff19 Mon Sep 17 00:00:00 2001 From: Don March Date: Sun, 26 Jun 2016 23:35:44 -0700 Subject: [PATCH] Reschedule "++" repeaters on same day if in future * lisp/org.el (org-auto-repeat-maybe): Include the time in a timestamp (hours and minutes) when checking if a repeat occurrence is in the future. * doc/org.texi (Repeated Tasks): Document repeat occurrences with a time in the timestamp. --- doc/org.texi | 7 +++ lisp/org.el | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index ae9a738..9d8eb8f 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -6412,6 +6412,13 @@ special repeaters @samp{++} and @samp{.+}. For example: but also by as many weeks as it takes to get this date into the future. However, it stays on a Sunday, even if you called and marked it done on Saturday. +** TODO Empty kitchen trash + DEADLINE: <2008-02-08 Fri 20:00 ++1d> + Marking this DONE will shift the date by at least one day, and + also by as many days as it takes to get the timestamp into the + future. Since there is a time in the timestamp, the next + deadline in the future will be on today's date if you + complete the task before 20:00. ** TODO Check the batteries in the smoke detectors DEADLINE: <2005-11-01 Tue .+1m> Marking this DONE will shift the date to one month after diff --git a/lisp/org.el b/lisp/org.el index e13e82d..c266709 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13287,8 +13287,7 @@ has been set" (let ((nshiftmax 10) (nshift 0)) (while (or (= nshift 0) - (<= (time-to-days time) - (time-to-days (current-time + (time-less-p time (current-time))) (when (= (cl-incf nshift) nshiftmax) (or (y-or-n-p (format "%d repeater intervals were not \ -- 2.8.1
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Hello, Don March writes: > You're right about both things. I updated the patch, and also added an > example to the manual. If that's not what you had it mind, let me know > or feel free to edit. Thank you. I used (not (time-less-p (current-time) time)) as suggested instead, so as to take into consideration the (granted, highly unlikely) case of time equality, and pushed to master. Would you mind providing a note about this change in ORG-NEWS? Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Nicolas Goaziou writes: > Would you mind providing a note about this change in ORG-NEWS? No problem. Would you put that in "new features" or "miscellaneous"?
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Don March writes: > No problem. Would you put that in "new features" or "miscellaneous"? I'd say "miscellaneous" since this is a minor change. Regards,
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Here is a patch with that addition to ORG-NEWS. From 18d0d67f7f0efd635351056c185b46e2c2a54d5e Mon Sep 17 00:00:00 2001 From: Don March Date: Sat, 2 Jul 2016 02:39:58 -0400 Subject: [PATCH] ORG-NEWS: document last "++" repeater change --- etc/ORG-NEWS | 9 + 1 file changed, 9 insertions(+) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index ea9e4de..71f44f5 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -447,6 +447,15 @@ Thus the new behavior is to generate this HTML link instead: : http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#List-Buffers";>emacs#List Buffers All emacs related info links are similarly translated plus few other =gnu.org= manuals. +*** Repeaters with a "++" interval and a time can be shifted to later today +Previously, if a recurring task had a timestamp of +=<2016-01-01 Fri 20:00 ++1d>= and was completed on 2016-01-02 at +08:00, the task would skip 2016-01-02 and would be rescheduled for +2016-01-03. Timestamps with "++" cookies and a specific time will now +shift to the first possible future occurrence, even if the occurrence +is later the same day the task is completed. (Timestamps already in +the future are still shifted one time further into the future.) + * Version 8.3 ** Incompatible changes -- 2.8.1
Re: [O] [PATCH] Reschedule "++" repeaters on same day if in future
Hello, Don March writes: > Here is a patch with that addition to ORG-NEWS. Applied. Thank you. Regards, -- Nicolas Goaziou