GNU bug report logs - #71819
Incorrect substitution when undo replacing regexps

Previous Next

Package: emacs;

Reported by: Sab Pyrope <sab.pyrope <at> gmail.com>

Date: Fri, 28 Jun 2024 10:46:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sab Pyrope <sab.pyrope <at> gmail.com>, Juri Linkov <juri <at> linkov.net>
Cc: 71819 <at> debbugs.gnu.org
Subject: bug#71819: Incorrect substitution when undo replacing regexps
Date: Sat, 29 Jun 2024 14:52:34 +0300
> From: Sab Pyrope <sab.pyrope <at> gmail.com>
> Date: Fri, 28 Jun 2024 08:57:03 +0800
> 
> 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.
> ---

Thanks.

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 bug report was last modified 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.