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: Sun, 01 Jan 2023 16:38:52 +0200 Message-ID: <83sfgu2ubn.fsf@gnu.org> References: <87o7ri74qv.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8418"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60467@debbugs.gnu.org To: Ihor Radchenko , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 01 15:39:36 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 1pBzUt-0001vT-3t for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Jan 2023 15:39:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBzUc-0004bR-EO; Sun, 01 Jan 2023 09:39:18 -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 1pBzUM-0004Zh-NF for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 09:39:07 -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 1pBzUM-00019r-Ew for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 09:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pBzUL-00070u-UW for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2023 09:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jan 2023 14:39: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.167258393826950 (code B ref 60467); Sun, 01 Jan 2023 14:39:01 +0000 Original-Received: (at 60467) by debbugs.gnu.org; 1 Jan 2023 14:38:58 +0000 Original-Received: from localhost ([127.0.0.1]:40511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBzUI-00070c-IG for submit@debbugs.gnu.org; Sun, 01 Jan 2023 09:38:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBzUF-00070N-Pz for 60467@debbugs.gnu.org; Sun, 01 Jan 2023 09:38:56 -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 1pBzU9-00017F-Qy; Sun, 01 Jan 2023 09:38:49 -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=o5EniY6SpquX+G9q5392o366XkpX3S4YvCu09nO1RBg=; b=WBP8uUN7pj60 Dhqv8ew2SD9eoFpWqNYDjHI1ZrmtXUX+5gbr1itgkYQIhQ+IziubP7yTtGCvD7E6HybimxPjr+Fmh fpwQImwZk5IPk5oNi9vltlDViZQQAhcrhmsWCsAW/7LQxFTRbiakvWkVhlIP+BENcSRMFLdkVgIgQ HFzdPe7gWw4Pxrb5pYU7yUtBgqu7XNoTkyXmuhH4t5skIyDWbyhgf8GgItWZo1myI1BvQ0BQtVtxT V6FNCaEwpYoFltkcZBoORacUUYtiPIjkL88ERQRRPIARMJhQArIbWcnheifw3ssCLE88xhvkZe7sj YKWLnnL37TZ7jl/NvCduPg==; 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 1pBzU9-00004s-8A; Sun, 01 Jan 2023 09:38:49 -0500 In-Reply-To: <87o7ri74qv.fsf@localhost> (message from Ihor Radchenko on Sun, 01 Jan 2023 13:40:08 +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:252247 Archived-At: > From: Ihor Radchenko > Date: Sun, 01 Jan 2023 13:40:08 +0000 > > 1. Create /tmp/bug.org with the following contents > > * h1 > ** h2 > > 2. emacs -Q /tmp/bug.org > 3. Move point to h2 > 4. M-x org-promote-subtree > 5. M-x undo > 6. Observe "Changes to be undone by function different from announced" error The error message text is confusing, what it wants to say is this: Changes undone by a function are different from the announced ones The problem is here: (apply fun args) ;; Use `save-current-buffer'? ;; Check that the function did what the entry ;; said it would do. (unless (and (= start start-mark) (= (+ delta end) end-mark)) <<<<<<<<<<<<<<< (error "Changes to be undone by function different from announced")) After re-inserting the deleted string "** " with its face information, 'end-marker' is shifted by 3 position, and is now at buffer position 13, whereas 'end' is still 10 and 'delta' is 1, so their sum is 11. Also note that if you begin from an empty Org buffer and insert the initial text "* h1\n** h2\n", and then run the recipe, the problem doesn't happen, because the "* " part is deleted before "apply fun" returns, and then 'end-mark' is in its expected position 11. Adding Stefan, in case how might have ideas for what is wrong here. This problem exists also in Emacs 29.