Subject: Re: bug#66994: 30.0.50; Emacs hangs in Todo mode when moving an item to another todo file

From: Stephen Berman <[email-masked]>
Date: Thu, 09 Nov 2023 00:23:54 +0100

On Wed, 08 Nov 2023 14:27:33 +0200 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Date: Wed, 08 Nov 2023 00:13:36 +0100
>>
>> Given that it's an old bug that has apparently never been triggered in
>> normal use of todo-mode, I have no problem committing the fix to master.
>> But since an infinite loop is always nasty and the fix is
>> straightforward and AFAICT safe, I think it's suitable for the release
>> branch.  I'll wait for the maintainers' decision.
>
> I'm okay with installing this on the emacs-29 branch, but please
> improve the comment to the line you added, so that it explains better
> why this condition is needed and how it is related to "C-u m":

Done.

>> -	   (looking-at (regexp-quote todo-category-beg)))
>> +	   (looking-at (regexp-quote todo-category-beg))
>> +           ;; With `C-u m' to a file that is then loaded into a buffer.
>> +	   (= (point) 1))
>
> Also, should this test point-min instead of literally 1?

No, the infinite loop happens when point is at the start of the file.
Todo mode uses narrowing to display categories, and in that case the
problem does not arise, because then point-min is the location of the
start of the first item in the category.

Fixed in commit b7871cefe7b to emacs-29.  Thanks.

Steve Berman