From: Stephen Berman Date: Wed, 8 Nov 2023 23:13:06 +0000 (+0100) Subject: Prevent an infinite loop in todo-mode (bug#66994) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b7871cefe7b94ac6a6a4fd561d41af00ae3d3578;p=emacs.git Prevent an infinite loop in todo-mode (bug#66994) * lisp/calendar/todo-mode.el (todo-item-start): Moving an item to a todo file (with `C-u m') that had not yet been read into a buffer puts point at the beginning of the file, from where it is impossible to reach todo-item-start by this function, so don't try in that case. --- diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index ad18e8f035e..393dd1851f3 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -5240,7 +5240,12 @@ changes you have made in the order of the categories. ;; Point is on done items separator. (save-excursion (beginning-of-line) (looking-at todo-category-done)) ;; Buffer is widened. - (looking-at (regexp-quote todo-category-beg))) + (looking-at (regexp-quote todo-category-beg)) + ;; Moving an item to a todo file (with `C-u m') that had + ;; not yet been read into a buffer puts point at the + ;; beginning of the file, from where it is impossible to + ;; reach todo-item-start by the loop below (bug#66994). + (= (point) 1)) (goto-char (line-beginning-position)) (while (not (looking-at todo-item-start)) (forward-line -1))