* Recurring TODO with hours not scheduled correctly
@ 2019-12-03 6:03 Justin Vallon
2019-12-07 16:00 ` PATCH: " Justin Vallon
0 siblings, 1 reply; 3+ messages in thread
From: Justin Vallon @ 2019-12-03 6:03 UTC (permalink / raw)
To: emacs-orgmode
Newbie org-mode user. Wondering about some odd recurrence behavior.
emacs --no-init-file
# test.org
* TODO shovel snow
M-x org-schedule RET RET
* TODO shovel show
SCHEDULED: <2019-12-03 Tue>
Add time:
* TODO shovel show
SCHEDULED: <2019-12-03 Tue 09:00 .+1h>
Complete: C-c C-t
* TODO shovel show
SCHEDULED: <2019-12-03 Tue 10:00 .+1h>
:PROPERTIES:
:LAST_REPEAT: [2019-12-03 Tue 00:52]
:END:
- State "DONE" from "TODO" [2019-12-03 Tue 00:52]
Again: complete: C-c C-t
* TODO shovel show
SCHEDULED: <2019-12-03 Tue 11:00 .+1h>
:PROPERTIES:
:LAST_REPEAT: [2019-12-03 Tue 00:57]
:END:
- State "DONE" from "TODO" [2019-12-03 Tue 00:57]
- State "DONE" from "TODO" [2019-12-03 Tue 00:52]
My understanding of .+TERM is that the new scheduled time should be now
+ term. However, from this instance and testing with other terms, it
seems to be "current date + scheduled-time" + HOURS. Completing again
advances the time by one hour, leaving the date as today.
For ".+2d", the new scheduled date/time is 2d away (at the same time),
and re-completing does not change the new schedule time.
(equal org-version "9.1.9")
--
-Justin
JustinVallon@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* PATCH: Re: Recurring TODO with hours not scheduled correctly
2019-12-03 6:03 Recurring TODO with hours not scheduled correctly Justin Vallon
@ 2019-12-07 16:00 ` Justin Vallon
2019-12-12 11:16 ` Nicolas Goaziou
0 siblings, 1 reply; 3+ messages in thread
From: Justin Vallon @ 2019-12-07 16:00 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1793 bytes --]
On 12/3/19 1:03 AM, Justin Vallon wrote:
> Newbie org-mode user. Wondering about some odd recurrence behavior.
...
> My understanding of .+TERM is that the new scheduled time should be now
> + term. However, from this instance and testing with other terms, it
> seems to be "current date + scheduled-time" + HOURS. Completing again
> advances the time by one hour, leaving the date as today.
>
> For ".+2d", the new scheduled date/time is 2d away (at the same time),
> and re-completing does not change the new schedule time.
Following up with a patch to make .+1h work "like" .+1d:
- When computing the new scheduled date, the repeater-type "." would
shift the scheduled date to today, then adjust by the interval.
Shifting the date would leave the time unchanged
- When shifting by hours, the old time would remain, and then be shifted
by the interval
- With the patch, ".+1h" will shift schedule-date to now (vs today),
then add "1h" as before. ".+1d" will have the old behavior (shift date,
but leave time alone).
- That is:
- ".+1d" is tomorrow at same scheduled time
- ".+1h" is in one hour
- ".+24h" is 24h from now.
I would argue that the old behavior is broken (".+1h" advances the
schedule time by an hour), so retaining the old behavior is not useful
(ie: no option is required).
Changes:
- org-timestamp-change: Add a 'now tag to set the current time to now
- org-auto-repeat-maybe: if interval is '.+Nh', relative time is "now"
(instead of today)
"now" might be usable when the interval is days, but I am not sure about
the difference between (org-today) and (current-time) (ie: they seem
different), so the patch only applies for intervals of hours.
Patch is relative to org 9.3.
--
-Justin
JustinVallon@gmail.com
[-- Attachment #2: org.el.patch --]
[-- Type: text/plain, Size: 1026 bytes --]
--- org.el 2019/12/07 15:36:31 1.1
+++ org.el 2019/12/07 15:37:15
@@ -10824,9 +10824,14 @@
(repeater-type (match-string 1 ts)))
(cond
((equal "." repeater-type)
- ;; Shift starting date to today.
- (org-timestamp-change (- (org-today) (time-to-days time))
- 'day))
+ (cond
+ ((equal what "h")
+ ;; adjust timestamp to now
+ (org-timestamp-change 0 'now))
+ (t
+ ;; Shift starting date to today.
+ (org-timestamp-change (- (org-today) (time-to-days time))
+ 'day))))
((equal "+" repeater-type)
(let ((nshiftmax 10)
(nshift 0))
@@ -15349,6 +15354,8 @@
(setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
(setcar (nthcdr 2 time0) (or (nth 2 time0) 0))
(setq time (apply 'encode-time time0))))
+ (when (eq what 'now)
+ (setq time (current-time)))
;; Insert the new time-stamp, and ensure point stays in the same
;; category as before (i.e. not after the last position in that
;; category).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: Re: Recurring TODO with hours not scheduled correctly
2019-12-07 16:00 ` PATCH: " Justin Vallon
@ 2019-12-12 11:16 ` Nicolas Goaziou
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2019-12-12 11:16 UTC (permalink / raw)
To: Justin Vallon; +Cc: emacs-orgmode
Hello,
Justin Vallon <justinvallon@gmail.com> writes:
> Following up with a patch to make .+1h work "like" .+1d:
>
> - When computing the new scheduled date, the repeater-type "." would
> shift the scheduled date to today, then adjust by the interval.
> Shifting the date would leave the time unchanged
> - When shifting by hours, the old time would remain, and then be shifted
> by the interval
> - With the patch, ".+1h" will shift schedule-date to now (vs today),
> then add "1h" as before. ".+1d" will have the old behavior (shift date,
> but leave time alone).
> - That is:
> - ".+1d" is tomorrow at same scheduled time
> - ".+1h" is in one hour
> - ".+24h" is 24h from now.
That seems reasonable.
Would you mind providing an entry in ORG-NEWS, possibly some pointers in
the manual, if appropriate, and add a few tests in
`test-org/auto-repeat-maybe' located in test-org.el file?
Thank you!
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-12 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-03 6:03 Recurring TODO with hours not scheduled correctly Justin Vallon
2019-12-07 16:00 ` PATCH: " Justin Vallon
2019-12-12 11:16 ` Nicolas Goaziou
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).