krz/orgstar

A native macOS editor for org-mode files. editor org-mode swift

Commit f727fd9a17

f727fd9a173713dbcafb6f945343b717614b6c6c

parent: d2c4913a70

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-08 03:34 UTC

Repeat .+Nh from the current time

org-auto-repeat-maybe moves an hourly .+ timestamp to now before
adding the interval. The oracle clock now also freezes float-time.

Layout: unified · split

Sources/OrgCore/Commands/Repeat.swift +3 −1
@@ -81,7 +81,9 @@ extension EmacsBuffer {
8181 if let kind = parts.1 {
8282 let time = Self.parseTimeString(stamp).map(date)!
8383 if kind == "." {
84 if what != "h" {
84 if what == "h" {
85 try changeTimestamp(Int((now.timeIntervalSince(time) / 60).rounded(.down)), what: .minute)
86 } else {
8587 let days = calendar.dateComponents([.day], from: calendar.startOfDay(for: time), to: today).day!
8688 try changeTimestamp(days, what: .day)
8789 }
Tests/OrgCoreTests/ReadDateTests.swift +2
@@ -11,11 +11,13 @@ func frozenClock(_ seconds: Int, _ body: String) -> String {
1111 (otl (symbol-function 'time-less-p))
1212 (ots (symbol-function 'time-subtract))
1313 (ota (symbol-function 'time-add))
14 (oflt (symbol-function 'float-time))
1415 ((symbol-function 'current-time) (lambda () frozen))
1516 ((symbol-function 'org-today) (lambda () (time-to-days frozen)))
1617 ((symbol-function 'time-less-p) (lambda (a b) (funcall otl (or a frozen) (or b frozen))))
1718 ((symbol-function 'time-subtract) (lambda (a b) (funcall ots (or a frozen) (or b frozen))))
1819 ((symbol-function 'time-add) (lambda (a b) (funcall ota (or a frozen) (or b frozen))))
20 ((symbol-function 'float-time) (lambda (&optional time) (funcall oflt (or time frozen))))
1921 ((symbol-function 'decode-time) (lambda (&optional time zone form) (funcall odt (or time frozen) zone form)))
2022 ((symbol-function 'format-time-string) (lambda (f &optional time zone) (funcall oft f (or time frozen) zone))))
2123 \(body))
Tests/OrgCoreTests/TimestampCommandTests.swift +3
@@ -111,6 +111,9 @@ struct TimestampCommandTests {
111111 "* P [0/1]\n** TODO a\nSCHEDULED: <2026-09-01 Tue +1w>\n* Q\n",
112112 "* TODO no repeat\nSCHEDULED: <2026-09-01 Tue>\n",
113113 "* TODO hourly\nSCHEDULED: <2026-09-10 Thu 00:00 +1h>\n",
114 "* TODO from now\nSCHEDULED: <2026-09-08 Tue 10:00 .+2h>\n",
115 "* TODO from now\n<2026-09-10 Thu 03:15-04:00 .+1h>\n",
116 "* TODO catch up\nSCHEDULED: <2026-09-09 Wed 23:00 ++2h>\n",
114117 ]
115118
116119 @Test(.enabled(if: ProcessInfo.processInfo.environment["ORGSTAR_SKIP_ORACLE"] == nil))