aboutsummaryrefslogtreecommitdiff
path: root/.ai/scripts/todo-cleanup.el
diff options
context:
space:
mode:
Diffstat (limited to '.ai/scripts/todo-cleanup.el')
-rw-r--r--.ai/scripts/todo-cleanup.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/.ai/scripts/todo-cleanup.el b/.ai/scripts/todo-cleanup.el
index 97be96e..11851b2 100644
--- a/.ai/scripts/todo-cleanup.el
+++ b/.ai/scripts/todo-cleanup.el
@@ -254,12 +254,16 @@ are reported but not performed."
(defun tc--heading-priority-letter ()
"Return the priority letter (a character) on the heading at point, or nil
-if the heading has no priority cookie."
+if the heading has no priority cookie in canonical position.
+
+Uses `org-heading-components' rather than regexing the whole line, because
+the cookie must sit right after the stars or the optional TODO keyword —
+otherwise `[#X]'-shaped text inside the title (a dated log entry like
+\"... reprioritized =[#D]= → =[#B]= to match parent\") gets misread as a
+real cookie."
(save-excursion
(org-back-to-heading t)
- (let ((eol (line-end-position)))
- (when (re-search-forward tc--priority-cookie-regexp eol t)
- (string-to-char (match-string 1))))))
+ (nth 3 (org-heading-components))))
(defun tc--priority-lower-p (child parent)
"Non-nil when CHILD priority letter ranks lower than PARENT — i.e. later in