Ignacio Casso <[email protected]> writes: > I'm not sure how it should be fixed, the code looks too spaguetti > already and the fixes I can think of would only add up to that. If you > don't have a problem with that I can submit a patch with the simplest > fix I can think of, but I think this code would benefit from a > refactor from someone who really understands it.
We're always looking for help so if you're going to offer we're going to accept. That does indeed look like some complicated code that I am not familiar with. I am however familiar with the tests for this so I whipped up some test cases for you to use and attached them. As you can see, the test case with "(let ((org-todo-keywords '((sequence "TODO(!)" "DONE"))))" passes but the one with the property ":LOGGING: TODO(!)" fails. There is definitely a bug here. Confirmed. If you're using the build system make sure you pull in the latest changes first. I just pushed a fix so that tests pass when setting "BTEST_RE='test-org/org-todo-prefix'". No worries if you give up attempting this yourself. Just report back here. I know this stuff can get pretty frustrating. Good luck!
>From 0d07a8bf4d9afef29ed18bb898e2396d7b5aa72c Mon Sep 17 00:00:00 2001 From: Morgan Smith <[email protected]> Date: Wed, 30 Sep 2026 13:51:56 -0400 Subject: [PATCH] Testing: Add more tests in 'test-org/org-todo-prefix' * testing/lisp/test-org.el (test-org/org-todo-prefix): Add tests for logging with repeated tasks. --- testing/lisp/test-org.el | 50 ++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 572e6673a..36e4a1719 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -9586,18 +9586,44 @@ test-org/org-todo-prefix ;; C-u forces logging note. ;; However, logging falls back to "time" when `org-inhibit-logging' ;; is 'note. - (dolist (org-inhibit-logging '(nil t note)) - (let ((org-todo-keywords '((sequence "TODO" "DONE")))) - (org-test-with-temp-text "* TODO H\n" - (unwind-protect - (progn - (org-todo '(4)) - (should (string-match-p "DONE" (buffer-string))) - (should (member #'org-add-log-note (default-value 'post-command-hook))) - (if (eq org-inhibit-logging 'note) - (should (eq org-log-note-how 'time)) - (should (eq org-log-note-how 'note)))) - (remove-hook 'post-command-hook #'org-add-log-note)))))) + (cl-flet ((test-org-todo-logging (text expected) + (org-test-with-temp-text text + (unwind-protect + (progn + (org-todo '(4)) + (org-entry-delete nil "LAST_REPEAT") + (should (string-equal expected (buffer-string))) + (should (member #'org-add-log-note (default-value 'post-command-hook))) + (if (eq org-inhibit-logging 'note) + (should (eq org-log-note-how 'time)) + (should (eq org-log-note-how 'note)))) + (remove-hook 'post-command-hook #'org-add-log-note))))) + (dolist (org-inhibit-logging '(nil t note)) + (let ((org-todo-keywords '((sequence "TODO" "DONE")))) + (test-org-todo-logging "* TODO H\n" "* DONE H\n") + (test-org-todo-logging + "* TODO Example +SCHEDULED: <2026-09-29 Tue +1d>" + "* TODO Example +SCHEDULED: <2026-09-30 Wed +1d>\n") + (let ((org-todo-keywords '((sequence "TODO(!)" "DONE")))) + (test-org-todo-logging + "* TODO Example +SCHEDULED: <2026-09-29 Tue +1d>" + "* TODO Example +SCHEDULED: <2026-09-30 Wed +1d>\n")) + ;; FIXME: This fails. No logging done! + (test-org-todo-logging + "* TODO Example +SCHEDULED: <2026-09-30 Wed +1d> +:PROPERTIES: +:LOGGING: TODO(!) +:END:" + "* TODO Example +SCHEDULED: <2026-10-01 Thu +1d> +:PROPERTIES: +:LOGGING: TODO(!) +:END:"))))) ;;; Timestamps API -- 2.54.0
