X-Loop: help-debbugs@HIDDEN Subject: bug#66994: 30.0.50; Emacs hangs in Todo mode when moving an item to another todo file Resent-From: Stephen Berman <stephen.berman@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 07 Nov 2023 23:15:01 +0000 Resent-Message-ID: <handler.66994.B.169939886912411 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 66994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 66994 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.169939886912411 (code B ref -1); Tue, 07 Nov 2023 23:15:01 +0000 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 <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r0VHA-0003E6-Mp for submit <at> 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 <stephen.berman@HIDDEN>) id 1r0VH8-0003Ds-2k for submit <at> 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 <stephen.berman@HIDDEN>) id 1r0VGQ-0008Tr-8h for bug-gnu-emacs@HIDDEN; 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 <stephen.berman@HIDDEN>) id 1r0VGO-0006gv-6p for bug-gnu-emacs@HIDDEN; 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@HIDDEN; 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 <bug-gnu-emacs@HIDDEN>; Wed, 08 Nov 2023 00:13:36 +0100 From: Stephen Berman <stephen.berman@HIDDEN> Date: Wed, 08 Nov 2023 00:13:36 +0100 Message-ID: <877cmt17j3.fsf@HIDDEN> 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 e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zvXmzQebKk= Received-SPF: pass client-ip=212.227.15.18; envelope-from=stephen.berman@HIDDEN; 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-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> 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)) --=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Stephen Berman <stephen.berman@HIDDEN> Subject: bug#66994: Acknowledgement (30.0.50; Emacs hangs in Todo mode when moving an item to another todo file) Message-ID: <handler.66994.B.169939886912411.ack <at> debbugs.gnu.org> References: <877cmt17j3.fsf@HIDDEN> X-Gnu-PR-Message: ack 66994 X-Gnu-PR-Package: emacs Reply-To: 66994 <at> debbugs.gnu.org Date: Tue, 07 Nov 2023 23:15:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 66994 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 66994: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D66994 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#66994: 30.0.50; Emacs hangs in Todo mode when moving an item to another todo file Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 08 Nov 2023 12:29:02 +0000 Resent-Message-ID: <handler.66994.B66994.16994465108689 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 66994 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stephen Berman <stephen.berman@HIDDEN> Cc: 66994 <at> debbugs.gnu.org Received: via spool by 66994-submit <at> debbugs.gnu.org id=B66994.16994465108689 (code B ref 66994); Wed, 08 Nov 2023 12:29:02 +0000 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 <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1r0hfa-0002G5-1o for submit <at> 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 <eliz@HIDDEN>) id 1r0hfX-0002Fn-L7 for 66994 <at> 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 <eliz@HIDDEN>) 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@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <877cmt17j3.fsf@HIDDEN> (message from Stephen Berman on Wed, 08 Nov 2023 00:13:36 +0100) References: <877cmt17j3.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Stephen Berman <stephen.berman@HIDDEN> > 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.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.