emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Don March <don@donmarch.net>
To: Don March <don@donmarch.net>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Reschedule "++" repeaters on same day if in future
Date: Thu, 30 Jun 2016 19:07:13 -0400	[thread overview]
Message-ID: <CABSfPEoHd-xuG-TsNkSVRWs0znehFcdKRx4AR-V=NohY0_Mdag@mail.gmail.com> (raw)
In-Reply-To: <87poqy27p5.fsf@saiph.selenimh>

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Don March <don@donmarch.net> 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 <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Don March <don@donmarch.net> 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

[-- Attachment #2: 0001-Reschedule-repeaters-on-same-day-if-in-future.patch --]
[-- Type: text/x-patch, Size: 1893 bytes --]

From 5b5fe9b5028d2074c30f271dbc2d63984da2ff19 Mon Sep 17 00:00:00 2001
From: Don March <don@ohspite.net>
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


  reply	other threads:[~2016-06-30 23:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27  6:49 [PATCH] Reschedule "++" repeaters on same day if in future Don March
2016-06-30 12:16 ` Nicolas Goaziou
2016-06-30 23:07   ` Don March [this message]
2016-07-01  9:27     ` Nicolas Goaziou
2016-07-01 16:30       ` Don March
2016-07-01 17:33         ` Nicolas Goaziou
2016-07-02  6:45           ` Don March
2016-07-02 22:24             ` Nicolas Goaziou

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CABSfPEoHd-xuG-TsNkSVRWs0znehFcdKRx4AR-V=NohY0_Mdag@mail.gmail.com' \
    --to=don@donmarch.net \
    --cc=emacs-orgmode@gnu.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://git.savannah.gnu.org/cgit/emacs/org-mode.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).