From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60467: 30.0.50; primitive-undo: Changes to be undone by function different from announced Date: Tue, 03 Jan 2023 14:46:25 +0200 Message-ID: <838rij23by.fsf@gnu.org> References: <87o7ri74qv.fsf@localhost> <9bc9c69ac20a37ded741@heytings.org> <9bc9c69ac282c0148962@heytings.org> <87h6x9mgdv.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18471"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60467@debbugs.gnu.org, yantar92@posteo.net To: Gregory Heytings , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 03 13:47:38 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pCghd-0004WA-6F for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 Jan 2023 13:47:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCghD-0004R5-LH; Tue, 03 Jan 2023 07:47:11 -0500 Original-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 1pCgh4-0004Px-Ur for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2023 07:47:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pCgh4-0005S3-IM for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2023 07:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pCgh4-0004HD-1e for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2023 07:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Jan 2023 12:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60467 X-GNU-PR-Package: emacs Original-Received: via spool by 60467-submit@debbugs.gnu.org id=B60467.167274999016387 (code B ref 60467); Tue, 03 Jan 2023 12:47:01 +0000 Original-Received: (at 60467) by debbugs.gnu.org; 3 Jan 2023 12:46:30 +0000 Original-Received: from localhost ([127.0.0.1]:44889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCggX-0004GE-Q9 for submit@debbugs.gnu.org; Tue, 03 Jan 2023 07:46:30 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCggS-0004Fq-Co for 60467@debbugs.gnu.org; Tue, 03 Jan 2023 07:46:28 -0500 Original-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 1pCggK-0005Mf-HJ; Tue, 03 Jan 2023 07:46:17 -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=kD/S3cAs7YPanvM6jNfjYIIXg1RZvkbaV4KX78eHJ/U=; b=cPv7TkIfms0b H7qFJu4acf41cIfyzRpDGO7DsW/BIAYH7KWllfxE0/+Jr5OnDLFblWqlaC0i/VEd9qArfEk/WAQwl gcu+TCSGr0qMFZDxqmyAqYS8nfjajzfSkfxwMgOiqbYM5xvuK04ErC/OJ3MwMGPHZSApSLRwT2Kqh VJquk+V+3ZEFOdPDXN25m6n0hDJyKfFlnAROIOri0+1Tt1uNWIQ+MTTiIPdV3uKOg4WODqlXVrh1a SDOsx7AVTcJt8ffKuDJHwTD8N0yV5zCPx0JMAUagyxf5j69R7/jAJSyxd1qr7INSRNnYZ35kkNsyZ PLen7xDRsWAVZ4lVeYS/JA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCggJ-0005s3-TO; Tue, 03 Jan 2023 07:46:16 -0500 In-Reply-To: (message from Gregory Heytings on Tue, 03 Jan 2023 09:41:52 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:252390 Archived-At: > Cc: 60467@debbugs.gnu.org > Date: Tue, 03 Jan 2023 09:41:52 +0000 > From: Gregory Heytings > > It turns out that the bug is indeed not in Org, but in Emacs. The part of > combine-change-call which creates the undo-list element was totally > broken. For example, with a buffer-undo-list like > > nil > > ofter body has been evaluated, the buffer-undo-list after > combine-change-call is > > (apply ... #'undo--wrap-and-run-primitive-undo ... ()) nil > > which is clearly wrong, because and > should be considered as a single undo step. IOW, after > combine-change-call buffer-undo-list should be: > > (apply ... #'undo--wrap-and-run-primitive-undo ... ( )) nil > > Patch attached. Hmm... scary, even if this is intended for the master branch. Could you at least keep the few comments which were in the original code, and perhaps also add comments explaining all those tricky tests with consp, equality to t and to old-bul, the significance of (car ptr) and (caar ptr), etc.? This would make the code more maintainer-friendly, as the need to constantly consult the spec of the various undo-list elements (and hope the spec is complete and accurate ;-) would be avoided. I'd prefer to fix this in Emacs 29 if feasible, but unless the changes are much simpler and/or more clearly documented, so that it becomes possible to assess their risks, I don't see how that could happen. I presume that all the undo tests we have still pass? If so, how about adding a test for this bug? Thanks.