From unknown Thu Sep 11 06:07:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#66994 <66994@debbugs.gnu.org> To: bug#66994 <66994@debbugs.gnu.org> Subject: Status: 30.0.50; Emacs hangs in Todo mode when moving an item to another todo file Reply-To: bug#66994 <66994@debbugs.gnu.org> Date: Thu, 11 Sep 2025 13:07:41 +0000 retitle 66994 30.0.50; Emacs hangs in Todo mode when moving an item to anot= her todo file reassign 66994 emacs submitter 66994 Stephen Berman severity 66994 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 07 18:14:29 2023 Received: (at submit) by debbugs.gnu.org; 7 Nov 2023 23:14:29 +0000 Received: from localhost ([127.0.0.1]:43733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0VHA-0003E6-Mp for submit@debbugs.gnu.org; Tue, 07 Nov 2023 18:14:29 -0500 Received: from lists.gnu.org ([2001:470:142::17]:56540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0VH8-0003Ds-2k for submit@debbugs.gnu.org; Tue, 07 Nov 2023 18:14:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0VGQ-0008Tr-8h for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 18:13:42 -0500 Received: from mout.gmx.net ([212.227.15.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0VGO-0006gv-6p for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 18:13:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1699398816; x=1700003616; i=stephen.berman@gmx.net; bh=HKVerjUHu0tI+i0TTtDfd5jxIpi3SRzvqGagFnyR+xI=; h=X-UI-Sender-Class:From:To:Subject:Date; b=d4LjVq7qzZE9zQV92Lry7FzpQodnpA/4godMjMp0haJ5o36GuiYUkSA5KudPNGCB b1tU8G3yG5LaO69AF9Id8IxUHWFqoxuMR9wzA4X3QNvXZUSqwlr2iF7m8XF+1lKTI Y+G5i+qHNql9u+oHxCVeLoTER3NV9aGa9knINnpN6QA8QITE3w8eiANG3QdTK8vPw g49umCJ34cKoIZDyc/IE16H/m0CkifQME+s92Ll1xGWwgIKMXKRPZ+G2lJdJxTZL+ 6T6sqsMsIO47IopzS2Q/RVOirbUwUV7V4Gi2AADJ8HnSWOEOo/adA7Fvfe3hiqEzT 1eVrGnaZi9uOL4hNpA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from strobelfs2 ([94.134.196.128]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MAONd-1r6sFH2rIB-00BvQM for ; Wed, 08 Nov 2023 00:13:36 +0100 From: Stephen Berman To: bug-gnu-emacs@gnu.org Subject: 30.0.50; Emacs hangs in Todo mode when moving an item to another todo file Date: Wed, 08 Nov 2023 00:13:36 +0100 Message-ID: <877cmt17j3.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:izaGMARRGb0xE3RUhjw77IC9OTEVVRdnyEV95DV54An2hVtFWPy +SehDHc59yk2vbFA/OV6ClWDnf+O9P352GwWLq3zfZMSbhKuk3ZVCSipVlhc4EQLn5ODb7P H23elomyOHDfT5F+ttgKEl1i+a6kT6041xwbnOu/vY3Nlew0czI/ETgxxfGGbt0wW+Bflgg eTpwoDJHSMb06uf9XqeOA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:rIhjfrL2yH4=;7VsM1IM8D4VvnCtduqXxO7A0OT5 +pXi8UBP7UjKA/uKD6Ccv3LuoC2fWAUBSDnWXAEs774os9hX5ZDJWjBST4AyffiSRU/4G4jeq yHp5w9vBqq+zSSUuf10wmouBY6n0I38vugNiW7siHIfpo6qbTauBkKaTFmbXFGujzdSLt6K5B az5Eiobgwzjx/k21FOoivPLzbdoAPz4TdXEXJ6i2NSCijXWlUMuA9PcdLh/KtUeZvSfIrRg/R dWYMKhPOWpoVLGb4T62lzl43UjghSJU9R74631X9IhQMtfzylMTCf8rABLw0uVZIP4Og5kNZI E4ml0BIvtKV/I2D1iGRJ8l3KwmNoWJ993RomsXoOTZkLMLuwMmXvJedpmV4j5qke8YQXa4nkf jZTlMGSEEPA2TkjU/DzfnkxiMctQ0FJZA490irbkQxfxLzRlDmcY4qvIctCUsh9deYXY7X8Ep /gb2Fl41HOlNlecRUlCOFWrNeG0jZf/8jZq2Iinu6HqqCDxh5F2OrNN6cdxjLuvXTb4Ce8MGj mzk2V59ps6DKMA8dx2Ya+bjfzsS1xccatBdnggYSZY57RZXqCx7YcO+1klAWP3h330MRcmdiR 69aq1tbYkEXUmQ/CnYkI+Jjt+bzrCsKEf9KMVUrgC56lb+0EjbG2LWYhl+bg1iJV/+Jpzw1ir 0N+YCKjJCq8iM7x3PUlP24ohOHrHfgMW6ndlnd01W9IU23AUQoz1JKfW4Tj8iNzNB+xUciQ2f d/vsu8qk8RZkpwcLuEs2ec/yAYTF97lbH4psgGoCO8Q7GKzgdO2qgNngl3uZ7y4XRsb+gJP1V ZbJbgcvKTj3gAZR3F6Lv8FpxcTc97ns5lUPlcmRFsC/rRx+ye7G6d9LamrCNANqf7n2qsQETp SpApaFGIsvGjiZQ9eNSuUkKzU+5/fN7yjaktLXr4mUj5AgSmuAqMG1Rq3j5bFrziAqDPCC2wo tozYcZ4PQ+UKHaOnGzvXmzQebKk= Received-SPF: pass client-ip=212.227.15.18; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 4.5 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If you have at least two files created using todo-mode, you can move an item from a category in one todo file to a category in another todo file by typing `C-u m' with point on the item to be moved. B [...] Content analysis details: (4.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [94.134.196.128 listed in dnsbl.sorbs.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stephen.berman[at]gmx.net) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If you have at least two files created using todo-mode, you can move an item from a category in one todo file to a category in another todo file by typing `C-u m' with point on the item to be moved. B [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [94.134.196.128 listed in dnsbl.sorbs.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stephen.berman[at]gmx.net) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain If you have at least two files created using todo-mode, you can move an item from a category in one todo file to a category in another todo file by typing `C-u m' with point on the item to be moved. But if the file the item is to be moved to is not yet visiting a buffer in todo-mode when the command is invoked, this results in an infinite loop. The patch below prevents this and allows the move to succeed. For those interested, an analysis of the bug follows. The call chain leading to the hang is this: todo-move-item -> todo-set-item-priority -> todo-marked-item-p -> todo-get-overlay -> todo-item-start. The latter function tests conditions under which point is not on an item; if these tests fail, a loop does a search backwards in the file to find the item start. But the tests overlook the case at hand, where a todo file is loaded into a buffer but todo-mode is not yet set: then point is at the start of the file, whose first line contains metadata that is hidden in todo-mode. Since this case is not tested and the other tests fail, the backwards search begins, but since point is already at position 1, it is impossible to find an item start, so the loop is never exited. Looking through the commit history, it seems this bug has existed since I first added the code, which was before my rewrite of todo-mode.el was merged into Emacs. Evidently I had never tested precisely this use case. (One reason for that may be that it is also possible to move an item between files by typing just `m', when the goal file's name is in the list `todo-category-completions-files'; but in this case the file is set to todo-mode before the movement, so the condition triggering the hang is not met. I have often used this functionality, but evidently not the movement with `C-u m'.) But I now encountered this bug while testing changes in todo-mode.el to support changing the format of item date headers, as announced in bug#66395. 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. In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) of 2023-11-06 built on strobelfs2 Repository revision: bf81706988f6b1b9d6e8033c8227f0129e04ef03 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: Linux From Scratch r12.0-63 Configured using: 'configure -C --with-xwidgets 'CFLAGS=-Og -g3' PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: todo-item-start patch diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 093ea0e22b6..86bf3afbce7 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -5277,7 +5277,9 @@ todo-item-start ;; 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)) + ;; With `C-u m' to a file that is then loaded into a buffer. + (= (point) 1)) (goto-char (line-beginning-position)) (while (not (looking-at todo-item-start)) (forward-line -1)) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 08 07:28:30 2023 Received: (at 66994) by debbugs.gnu.org; 8 Nov 2023 12:28:30 +0000 Received: from localhost ([127.0.0.1]:44151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0hfa-0002G5-1o for submit@debbugs.gnu.org; Wed, 08 Nov 2023 07:28:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0hfX-0002Fn-L7 for 66994@debbugs.gnu.org; Wed, 08 Nov 2023 07:28:28 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0hep-0005lL-DC; Wed, 08 Nov 2023 07:27:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ICHhWKgN5A5rInx29JzmboLmxcbzuemGhJl2pKyHO6Y=; b=Wimb4DF5gNWn 5iFUi5MmURsGptLIAY6tkwTAkA0F1K3hszeBWPWAyLedlAHzmKD05mFJ6H4N6FR05P2zQiFONkZL1 UVtp8g8Tcc8Y+hqlOnJwAoIgJYVXvy2DalwnGhHvNaeiWxSbToZcAEQPAgyFEKmZjfJVHPNusRm6b gNQxk2Msh/YruqkJH4tJCo2sFulW65R+dmTrEVhHdUsf4LwFOKkqoWOMZtNScQasx58or9I1kgUBD bS/oh5Gd0T93BsveqPgqK9dY3+8IGNsJNn5mddPDBfmBsCzw8NvlFtOZccGCcSQiatIx03NpJ4mzL X8FXLsl6ULy63PoXy1JuOg==; Date: Wed, 08 Nov 2023 14:27:33 +0200 Message-Id: <83r0l01lca.fsf@gnu.org> From: Eli Zaretskii To: Stephen Berman In-Reply-To: <877cmt17j3.fsf@gmx.net> (message from Stephen Berman on Wed, 08 Nov 2023 00:13:36 +0100) Subject: Re: bug#66994: 30.0.50; Emacs hangs in Todo mode when moving an item to another todo file References: <877cmt17j3.fsf@gmx.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 66994 Cc: 66994@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stephen Berman > 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": > - (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? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 08 18:24:46 2023 Received: (at 66994) by debbugs.gnu.org; 8 Nov 2023 23:24:46 +0000 Received: from localhost ([127.0.0.1]:46442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0rug-0000IZ-16 for submit@debbugs.gnu.org; Wed, 08 Nov 2023 18:24:46 -0500 Received: from mout.gmx.net ([212.227.17.20]:41595) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0ruZ-0000IE-RV for 66994@debbugs.gnu.org; Wed, 08 Nov 2023 18:24:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1699485835; x=1700090635; i=stephen.berman@gmx.net; bh=Zn3Okh/+UGGdLimaGriJliiwIW08lheIsQdpwzrnDcc=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=WcMSWbmTudMQaGUBp5ldAQWwRrE+GQ0mOs0bSGhN/cgTt4Ao8oHKBb1VUozPU8cj Z125uRqKa6wL8Nq9yUps2bcKNvRtZUvmCwf2dPnEq8xGSDUAXAlEi4LAOYkHoW1xw c3JrqR0pNs0dYgMNcz/M9Njl43rVd4O+rTI+ujbyPMMgd3tqyPfRrFBaHzFleG3Fc v2RGylWl0DGO1C6sDags11bLefVFsTtobWsXJLMnLb4YVkYdut4eBSeCba1bG3bOB KH7ZOK7hwt+rzC1gWOjfvWlVfaCldPrGC9kPlvxUv7H8CAxa6HZ/syIUN/YthXL7O P/H2oMpW/bBiS+hLCw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from strobelfs2 ([89.246.36.229]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MiJVG-1re2fs3YD0-00fNwz; Thu, 09 Nov 2023 00:23:54 +0100 From: Stephen Berman To: Eli Zaretskii Subject: Re: bug#66994: 30.0.50; Emacs hangs in Todo mode when moving an item to another todo file In-Reply-To: <83r0l01lca.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 08 Nov 2023 14:27:33 +0200") References: <877cmt17j3.fsf@gmx.net> <83r0l01lca.fsf@gnu.org> Date: Thu, 09 Nov 2023 00:23:54 +0100 Message-ID: <87msvnq16d.fsf@rub.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:i4FfndDSxjDiWSbmwG+SnXR8xhNOOZKMvGn33xVP9Gi3mImtf58 3abYiW0oml8ZWWALHoZejlb5alziVds64tWtcxRkeUr36y/aBTZXlOcyNU8I2CS8S6nkMQ8 5tqQo+odkYLpjG7R/1UPsVTnafWYqKVCvzTHtl4IU7dzkaBuRL7ByyXOaLLQHPC78FFcCfx YDWW2xm+/OxR6KlO99Nbw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:LK61AFQ7ZCc=;AqQazwilGdAH4fSdxl6pDQiP2W2 hLK4Q7uey+xQnaOTqVeY8Z5y2oVw4avj8QDOk/FYZ8nZlaZGukQ1wrrqNKGzWoK7++xBaiwh/ q3DbAkb85PDvhAwk5k3K54pd7Bw7mP3QuS3skU5rWYNKrAF8aY/VvA4CjOaYtPwsBc0usNi90 we32/dNXPEqeCM3d21Vh1MB15vI0F/nassUiI7nca4QJqrmRG8ZiEXfC7YbZmHhTcZiMd0sEu RzeOs8h/zC4U6O2cQ3Rs7tRb+2vjqKNCSoIL+ddJKb2c7unOoJVsieu9qi2EBMYqbLQO0Ouzm FtU42/YMWirJD8Xw3NnPAO1Sm6b0NHekaGxtMOnYyujK2LROQuN1lOiDsGzyz6PSZCKPFacMl plSxDqdbjKZ3rb0CI4lSfgINkgG5L/K4pgNPuE8f2Cf3eCYmpP2ata6i1FKDsA3KLa3lm2U1j Al0QSsGCb6k4H026ZaZUogE9leXn7jQ2OmUPD3q8PcIXliXJMfkSsNr8wn9ANwkgInSV8NIKA SuovzcOu8xWk4xLd0d8gG3rnf6sWSeb3sgSpIhGCQ2VellOMlI1D0DcqbcK83LkQmKB2uhOf0 ydFg5v4Bh1xNG2I3az40mJHfE6SsNGzpjNpE3XVbupyZaFhhwwYgRmIyBi8Fqcvy7HrrFIReW /TcxaTiDQv+OD8E7Q0Ui8QCY7f/EFBtFXGGtJxJ7OOtGMdkyWHdUv5fOEoUqLxOeDOSr8xnGC UPirvO25kbsgcTegswhUbMEyHwDaB9YIbWKC+Tv/IdJ/usfFpV5re7jx1ZonRRZB94Psof1CK Lqik0nfwSE+QvKHqp6le6fhm/sjknyl8FLdP98Dk7Y/nOBY19LDTVKgCYyiBpwnCePJ4ZnO5h aK+JmRNXIGQbnzJnRi1KqlmVqHTJuXqXBlcfk/OW33wnM4FfLR9aSH9I6ifREpn4sA4AdOdAW NoRyU6uIVqqc1ZVY31PXg6fGbDw= Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 66994 Cc: 66994@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Wed, 08 Nov 2023 14:27:33 +0200 Eli Zaretskii wrote: >> From: Stephen Berman >> 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= . >> + (=3D (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