Subject: bug#66395: 28.2; Todo-mode locks up when trying to edit an entry

From: LdBeth <[email-masked]>
Date: Sat, 07 Oct 2023 14:37:00 -0500

As we have discussed on IRC, the nonstandard timestamp format is the cause.
The hang is cause by the while loop `todo-item-start' not properly handle fail
case, however.

This patch would at least fix the hang.

---
LdBeth

--- 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 ()