--- todo-mode.el.old 2023-10-07 14:28:59.000000000 -0500 +++ todo-mode.el 2023-10-07 14:30:20.000000000 -0500 @@ -5242,8 +5242,8 @@ ;; Buffer is widened. (looking-at (regexp-quote todo-category-beg))) (goto-char (line-beginning-position)) - (while (not (looking-at todo-item-start)) - (forward-line -1)) + (while (and (not (looking-at todo-item-start)) + (= (forward-line -1) 0))) (point))) (defun todo-item-end ()