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#71819: Incorrect substitution when undo replacing regexps Date: Sat, 13 Jul 2024 12:59:46 +0300 Message-ID: <86y165k3xp.fsf@gnu.org> References: <867ce8j799.fsf@gnu.org> <86o77ipwyw.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35043"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71819@debbugs.gnu.org, sab.pyrope@gmail.com To: tino.calancha@gmail.com, Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 13 12:00:19 2024 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 1sSZYB-0008uY-9h for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Jul 2024 12:00:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSZXw-000059-PW; Sat, 13 Jul 2024 06:00:04 -0400 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 1sSZXu-0008WB-Qv for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2024 06:00:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSZXu-0006gA-Gn for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2024 06:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sSZXu-000140-5S for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2024 06:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jul 2024 10:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71819 X-GNU-PR-Package: emacs Original-Received: via spool by 71819-submit@debbugs.gnu.org id=B71819.17208647974051 (code B ref 71819); Sat, 13 Jul 2024 10:00:02 +0000 Original-Received: (at 71819) by debbugs.gnu.org; 13 Jul 2024 09:59:57 +0000 Original-Received: from localhost ([127.0.0.1]:55130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSZXp-00013G-Eh for submit@debbugs.gnu.org; Sat, 13 Jul 2024 05:59:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSZXo-000130-6w for 71819@debbugs.gnu.org; Sat, 13 Jul 2024 05:59:56 -0400 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 1sSZXi-00062K-2j; Sat, 13 Jul 2024 05:59:50 -0400 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=j89I1DUWGGcCGHS8gnqWf0xKHNyPwVceAy5LCq1kB/0=; b=qYkpx8a4XSgb Ql5oPftvt8TBABr99BUkcyAskWmnrZuJ9NjaMP4BqXVQ5kA++0yiIgEjyP/Tgj+VGopZR5358koTY bPkHkUr8CNNVHJqwC/vKT2ZMJss7BS3zXsFdcqRgEpd98qB6+HC5u6YTQlg2Fn/JlYFCi7Zmzx0Jl JGGAwK1lQkfPI5zF8C6+k5lgAgt1KhNTCg3HvpPZro+xPAa4o4sgE3vAjO9rKnJ3EEKmFetJ9ltC8 ROszp6zP+DrAq9UI7xTaetXQu9YxKZQrUpvENXcwMfNiiFs3Vk11d4PBaxJ2i5oFdvqg5F6xTTYe2 sP5c7lzb/006QTDxLU+2FA==; In-Reply-To: <86o77ipwyw.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 30 Jun 2024 19:25:11 +0300) 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:288797 Archived-At: Ping! Tino, can you please look into this issue? > From: Juri Linkov > Cc: Tino Calancha , Sab Pyrope > , 71819@debbugs.gnu.org > Date: Sun, 30 Jun 2024 19:25:11 +0300 > > >> I encountered a bug when replacing regular expressions. > >> If you [u]ndo a previous change during the replacement process, subsequent changes to the \2 substitution > >> will use the old undone result. > >> > >> Text: > >> --- > >> Aaaaa. Bbbb. > >> Ccccc. Dddd. > >> Eeeee. Ffff. > >> Ggggg. Hhhh. > >> --- > >> Input regexp: \([.]\) \([A-Z]\) > >> Output regexp: \1 \2 > >> Bug: > >> 1. Copy the text above to the buffer. > >> 2. Enter the regular expressions to the interactive regexp replacement [C-M-%]. > >> 3. Click [y] twice until the Ffff is highlighted. > >> 4. Cancel the previous replacement via [u]. > >> 5. Continue replacing [y] until the end. > >> 6. Notice that all sentences except the first and second now begin with an incorrect letter D, which is not > >> implied by the entered regexp, it should be F and H, as if it had been replaced, but without being undoed in > >> the middle of the process. > >> Output: > >> --- > >> Aaaaa. Bbbb. > >> Ccccc. Dddd. > >> Eeeee. Dfff. > >> Ggggg. Dhhh. > >> --- > > > > This is a regression between Emacs 26 and Emacs 27, perhaps as a side > > effect of fixing bug#36328. Juri, could you please take a look? > > This is caused by the commit 30c4f35a6fc8 that introduced these lines: > > (when regexp-flag > (setq next-replacement (nth 4 elt))) > > Maybe Tino knows how to fix this (Cc'ed). >