On 13/05/2024 17:07, Ihor Radchenko wrote:

However, there are still some issues remaining.
When updating timestamps repeating monthly across months with 30, 31,
and 28 days we get

<2025-01-31 Fri +1m>
<2025-02-28 Fri +1m>
<2025-03-28 Fri +1m>
...
<2026-01-28 Wed +1m>

Instead of using timestamp obtained on previous step, use original timestamp and multiple of the interval.

I have the following in my notes. However I have not find suitable functions in elisp:

https://debbugs.gnu.org/54764#10
Paul Eggert. Sat, 9 Apr 2022 00:52:57 -0700
Generally speaking, when Org mode is doing calendrical calculations it should use calendrical functions rather than encode-time+decode-time, which are best used for time calculations not calendar calculations.

Do you have any idea what Paul was writing about?

On 13/05/2024 17:07, Ihor Radchenko wrote:
+           (type-unit (pcase type
+                        ("h" 'hour) ("d" 'day) ("w" 'week)
+                        ("m" 'month) ("y" 'year))))
I do not mind against `pcase' here, I just expected something like `assoc' and `string-to-char'.

+             ((or "m" "y")
Another comment that may be ignored: `type-unit' values might be used here.

+          (org-encode-time
+           (list
+            (+ (if (eq unit 'second) value 0) (decoded-time-second time))
+            (+ (if (eq unit 'minute) value 0) (decoded-time-minute time))
+            (+ (if (eq unit 'hour) value 0)   (decoded-time-hour time))
+            (+ (if (eq unit 'day) value 0)    (decoded-time-day time))

Have you considered using `min' with result of `date-days-in-month' here (or its sibling from timezone.el)?

+(defun org-time-inc (unit value time)
Is there a chance that support of intervals like 1h20m will be required later?

+            (+ (if (eq unit 'month) value 0)  (decoded-time-month time))
+            (+ (if (eq unit 'year) value 0)   (decoded-time-year time))
+            (decoded-time-weekday time)
+            (if (memq unit '(day month year))
+                nil ; Avoid auto-adjustments of time when jumping across DST.

Sorry, but you have to use -1, otherwise

(format-time-string
 "%F %T %Z %z"
 (encode-time '(0 30 12 15 1 2000 'ignored nil "Africa/Juba"))
 "Africa/Juba")
(error "Specified time is not representable")

+              (decoded-time-dst time))
+            (decoded-time-zone time))))))
+    (if (not org-repeat-round-time) new-time
I am in doubts if `org-time-inc' should access `org-repeat-round-time' directly or its value should be passed as an explicit argument. Perhaps the additional argument may be optional with fallback to `org-repeat-round-time' when it is omitted.




Reply via email to