Accidentally, I found a way that works for me:

    Even if this expression goes to next week: "Sun 7:30" => [2026-11-22 Sun 07:30]

    This expression stays on today: "7:30 Sun" => [2026-11-15 Sun 07:30]

By the way, the previous suggested function was wrong and this way works [1] (of course, too tailored for this use case, it's not a nice one for everyone).

But I don't need it anymore; I will change the format I use to express the timeboxes from "{weekday} {time}" to "{time} {weekday}" and problem solved!

I don't know if this "feature" or inconsistency is properly documented [2]

[1]
(defun my/org-today-weekday (args)
  "When today is Sunday, make \"Sun 10:30\" mean today instead of next week."
  (if (string-match "^[[:alpha:]]\\{3\\} " (car args))
    (let* ((today-name (format-time-string "%a"))
           (today-date (format-time-string "%Y-%m-%d")))
      (cons (string-replace today-name today-date (car args))
            (cdr args)))
    args))

[2] https://orgmode.org/manual/The-date_002ftime-prompt.html

On 2026-11-15 13:34, pinmacs wrote:
Oh sorry, I wrongly swapped the results:

On 2026-11-15 13:32, pinmacs wrote:

This is how it works before my patch [2]:

-Sun 7:30 => [2026-11-08 Sun 07:30]
Sun 7:30 => [2026-11-15 Sun 07:30]
+Sun 7:30 => [2026-11-22 Sun 07:30]

-Sun 7:30 => [2026-11-08 Sun 07:30]
Sun 7:30 => [2026-11-22 Sun 07:30]
+Sun 7:30 => [2026-11-22 Sun 07:30]


This is how it works after my patch [2]:

-Sun 7:30 => [2026-11-08 Sun 07:30]
Sun 7:30 => [2026-11-22 Sun 07:30]
+Sun 7:30 => [2026-11-22 Sun 07:30]

-Sun 7:30 => [2026-11-08 Sun 07:30]
Sun 7:30 => [2026-11-15 Sun 07:30]
+Sun 7:30 => [2026-11-22 Sun 07:30]



Reply via email to