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 { |
| 81 | 81 | if let kind = parts.1 { |
| 82 | 82 | let time = Self.parseTimeString(stamp).map(date)! |
| 83 | 83 | if kind == "." { |
| 84 | | if what != "h" { |
| 84 | if what == "h" { |
| 85 | try changeTimestamp(Int((now.timeIntervalSince(time) / 60).rounded(.down)), what: .minute) |
| 86 | } else { |
| 85 | 87 | let days = calendar.dateComponents([.day], from: calendar.startOfDay(for: time), to: today).day! |
| 86 | 88 | try changeTimestamp(days, what: .day) |
| 87 | 89 | } |
Tests/OrgCoreTests/ReadDateTests.swift
+2
| @@ -11,11 +11,13 @@ func frozenClock(_ seconds: Int, _ body: String) -> String { |
| 11 | 11 | (otl (symbol-function 'time-less-p)) |
| 12 | 12 | (ots (symbol-function 'time-subtract)) |
| 13 | 13 | (ota (symbol-function 'time-add)) |
| 14 | (oflt (symbol-function 'float-time)) |
| 14 | 15 | ((symbol-function 'current-time) (lambda () frozen)) |
| 15 | 16 | ((symbol-function 'org-today) (lambda () (time-to-days frozen))) |
| 16 | 17 | ((symbol-function 'time-less-p) (lambda (a b) (funcall otl (or a frozen) (or b frozen)))) |
| 17 | 18 | ((symbol-function 'time-subtract) (lambda (a b) (funcall ots (or a frozen) (or b frozen)))) |
| 18 | 19 | ((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)))) |
| 19 | 21 | ((symbol-function 'decode-time) (lambda (&optional time zone form) (funcall odt (or time frozen) zone form))) |
| 20 | 22 | ((symbol-function 'format-time-string) (lambda (f &optional time zone) (funcall oft f (or time frozen) zone)))) |
| 21 | 23 | \(body)) |
Tests/OrgCoreTests/TimestampCommandTests.swift
+3
| @@ -111,6 +111,9 @@ struct TimestampCommandTests { |
| 111 | 111 | "* P [0/1]\n** TODO a\nSCHEDULED: <2026-09-01 Tue +1w>\n* Q\n", |
| 112 | 112 | "* TODO no repeat\nSCHEDULED: <2026-09-01 Tue>\n", |
| 113 | 113 | "* 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", |
| 114 | 117 | ] |
| 115 | 118 | |
| 116 | 119 | @Test(.enabled(if: ProcessInfo.processInfo.environment["ORGSTAR_SKIP_ORACLE"] == nil)) |