From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 28 06:45:30 2024 Received: (at submit) by debbugs.gnu.org; 28 Jun 2024 10:45:30 +0000 Received: from localhost ([127.0.0.1]:44777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sN96f-0004hT-9v for submit@debbugs.gnu.org; Fri, 28 Jun 2024 06:45:30 -0400 Received: from lists.gnu.org ([209.51.188.17]:57570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sN4jY-0000q1-RT for submit@debbugs.gnu.org; Fri, 28 Jun 2024 02:05:21 -0400 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 1sMzwZ-0004b9-I8 for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 20:58:30 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMzwW-000648-Id for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 20:58:27 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-52caebc6137so59803e87.0 for ; Thu, 27 Jun 2024 17:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719536301; x=1720141101; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=uO4WbUTlLOOH9PQ6n9EvfQ9gMquePdlY/J3VRAvdvk4=; b=GbSS18+1W9p3KY0qzT3OlEL6rMe615ws8v+cBNU4CokEcNpgWjihTwWct0BJqOfHJR gZ1YZLeTgbSu4UH1w1hudmcAThH3QrdqymYW2DuU8Mx10Al2+9jp5tTwA3rVkHhhA7La YE7bwKS9Am19r3BnJHHVZQaaNIfQZtR9+yVRC0C1LnwCeUkRja9q3qT0mcIi+Kz/hZCI ezmd6PVVGQJJL8TxLgPHqcmfLOAZQS9pK4IMtvjV8q1JdNDC3ISGewUnVBOtJ14LdMZz 13BTZ2n/LIcipiaUadwBBsdF4Wa1HlwVs/sno8/BTYJdF/O6cw4u0MIe54RMlVI9bYSn hgBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719536301; x=1720141101; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uO4WbUTlLOOH9PQ6n9EvfQ9gMquePdlY/J3VRAvdvk4=; b=NNChdrQSQMkJi3vDV+TY3o3N+6yiUGJ444AIXviGut6I3sLo1E+LFEdc06+qeGfAWF 210/3t2SwV5D2Z8RNo2FqoFeNtzwTpvleW8T20r61BD19/pNZqDaGAo5M4bIIXfR1auo xKlfT2L4oPGyu+XqVlbv65ZO3eLIwDPtfTylMpYKDTPOkU3JOIWxVpG0gaf1BAShmUVj timtKkGa5Olz8TAePzbn5zYHDeZsr/n/L/O2iobWkB6+Z/zbiAYqdYOBoKYQnpEY70+l w3PGFtqeT0wMEXWAxbIeR40+qFe5e/Xj9ArhYanI04YB6rXQjUdpAl5LmygvPlyy70vq P2aA== X-Gm-Message-State: AOJu0YwVxztcoU847droBehNIAL5C6sHomq/IumD3cOKpD7a0rXgMW2w QtXxNDZGq/GxPjxOsZLSkk9vxGcRyug7qavpptaEe3Rzrtp/lZ47roR9j2NlMg+grX6K/uOmdjV f+llKClWtESPUEpjEnEnbxSuYpUsSGPu6Yww= X-Google-Smtp-Source: AGHT+IGmQv5rnhpPNsuqGHncbsxd9Og3J4ZQTMYm1BmCVEz6hjyUEmBksr3wzpNpH1eQ6axnd7wjnp+GvaIzaZ+wPwg= X-Received: by 2002:a05:6512:b1e:b0:52d:582e:4117 with SMTP id 2adb3069b0e04-52d582e41e7mr6045253e87.54.1719536300185; Thu, 27 Jun 2024 17:58:20 -0700 (PDT) MIME-Version: 1.0 From: Sab Pyrope Date: Fri, 28 Jun 2024 08:57:03 +0800 Message-ID: Subject: Incorrect substitution when undo replacing regexps To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="00000000000059e28e061be8be71" Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=sab.pyrope@gmail.com; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 28 Jun 2024 06:45:28 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --00000000000059e28e061be8be71 Content-Type: text/plain; charset="UTF-8" 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. --- In GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0) of 2024-05-20, modified by Debian built on sbuild Windowing system distributor 'The X.Org Foundation', version 11.0.12101007 System Description: Debian GNU/Linux 12 (bookworm) Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/libexec --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.3/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-native-compilation --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/libexec --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.3/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-native-compilation --with-cairo --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -ffile-prefix-map=/build/reproducible-path/emacs-29.3+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LC_MONETARY: ru_RU.UTF-8 value of $LC_NUMERIC: ru_RU.UTF-8 value of $LC_TIME: ru_RU.UTF-8 value of $LANG: ru_RU.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: save-place-mode: t global-tab-line-mode: t tab-line-mode: t global-display-line-numbers-mode: t display-line-numbers-mode: t electric-pair-mode: t desktop-save-mode: t delete-selection-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t column-number-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug misearch multi-isearch mm-archive message sendmail dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util text-property-search mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils mule-util gnutls network-stream url-cache url-http url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny epg rfc6068 epg-config comp comp-cstr warnings cus-edit pp cus-start wid-edit cl-extra help-mode yank-media markdown-mode thingatpt noutline outline icons time-date vc-git diff-mode easy-mmode vc-dispatcher python rx project pcase treesit comint ansi-osc ring ansi-color gruvbox-dark-hard-theme gruvbox autothemer color lisp-mnt dash saveplace whitespace tab-line display-line-numbers elec-pair desktop frameset delsel cus-load finder-inf csv-mode-autoloads info markdown-mode-autoloads po-mode-autoloads tree-sitter-autoloads tsc-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib cyril-util rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 422703 549886) (symbols 48 21740 133) (strings 32 123122 109316) (string-bytes 1 5309779) (vectors 16 36085) (vector-slots 8 683635 189466) (floats 8 249 448) (intervals 56 999 1339) (buffers 984 19)) --00000000000059e28e061be8be71 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I encountered a bug when replacing regular expression= s.
If you [u]ndo a p= revious 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.
---
I= nput regexp: \([.]\) \([A-Z]\)=
Output regex= p: \1=C2=A0 \2
Bug:
1. Cop= y the text above to the buffer.
2. Enter the regular expressions to the = interactive regexp replacement [C-M-%= ].
3. Click [y] twic= e until the Ffff is highlighte= d.
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<= /span>, which is not implied by the entered regexp, it should be F and H, as if it had be= en replaced, but without being undoed in the middle of the process.<= /span>
Output:
---
Aaaaa.=C2=A0 Bbbb.
Ccccc.=C2=A0 Dddd.
Eeeee.= =C2=A0 Dfff.
Ggggg.=C2=A0 Dhhh.
---

In GNU Emacs = 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
=C2=A0cairo = version 1.16.0) of 2024-05-20, modified by Debian built on sbuild
Window= ing system distributor 'The X.Org Foundation', version 11.0.1210100= 7
System Description: Debian GNU/Linux 12 (bookworm)

Configured u= sing:
=C2=A0'configure --build x86_64-linux-gnu --prefix=3D/usr
= =C2=A0--sharedstatedir=3D/var/lib --libexecdir=3D/usr/libexec
=C2=A0--lo= calstatedir=3D/var/lib --infodir=3D/usr/share/info
=C2=A0--mandir=3D/usr= /share/man --with-libsystemd --with-pop=3Dyes
=C2=A0--enable-locallisppa= th=3D/etc/emacs:/usr/local/share/emacs/29.3/site-lisp:/usr/local/share/emac= s/site-lisp:/usr/share/emacs/29.3/site-lisp:/usr/share/emacs/site-lisp
= =C2=A0--with-sound=3Dalsa --without-gconf --with-mailutils
=C2=A0--with-= native-compilation --build x86_64-linux-gnu --prefix=3D/usr
=C2=A0--shar= edstatedir=3D/var/lib --libexecdir=3D/usr/libexec
=C2=A0--localstatedir= =3D/var/lib --infodir=3D/usr/share/info
=C2=A0--mandir=3D/usr/share/man = --with-libsystemd --with-pop=3Dyes
=C2=A0--enable-locallisppath=3D/etc/e= macs:/usr/local/share/emacs/29.3/site-lisp:/usr/local/share/emacs/site-lisp= :/usr/share/emacs/29.3/site-lisp:/usr/share/emacs/site-lisp
=C2=A0--with= -sound=3Dalsa --without-gconf --with-mailutils
=C2=A0--with-native-compi= lation --with-cairo --with-x=3Dyes
=C2=A0--with-x-toolkit=3Dgtk3 --with-= toolkit-scroll-bars 'CFLAGS=3D-g -O2
=C2=A0-ffile-prefix-map=3D/buil= d/reproducible-path/emacs-29.3+1=3D. -fstack-protector-strong
=C2=A0-Wfo= rmat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time
= =C2=A0-D_FORTIFY_SOURCE=3D2' LDFLAGS=3D-Wl,-z,relro'

Configu= red features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS = HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT M= ODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3=
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2<= br>XPM GTK3 ZLIB

Important settings:
=C2=A0 value of $LC_MONETARY= : ru_RU.UTF-8
=C2=A0 value of $LC_NUMERIC: ru_RU.UTF-8
=C2=A0 value o= f $LC_TIME: ru_RU.UTF-8
=C2=A0 value of $LANG: ru_RU.UTF-8
=C2=A0 val= ue of $XMODIFIERS: @im=3Dibus
=C2=A0 locale-coding-system: utf-8-unix
Major mode: Fundamental

Minor modes in effect:
=C2=A0 save-p= lace-mode: t
=C2=A0 global-tab-line-mode: t
=C2=A0 tab-line-mode: t=C2=A0 global-display-line-numbers-mode: t
=C2=A0 display-line-numbers= -mode: t
=C2=A0 electric-pair-mode: t
=C2=A0 desktop-save-mode: t
= =C2=A0 delete-selection-mode: t
=C2=A0 tooltip-mode: t
=C2=A0 global-= eldoc-mode: t
=C2=A0 show-paren-mode: t
=C2=A0 electric-indent-mode: = t
=C2=A0 mouse-wheel-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-n= ame-shadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-m= ode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 column-number-mode: t
= =C2=A0 line-number-mode: t
=C2=A0 indent-tabs-mode: t
=C2=A0 transien= t-mark-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption= -mode: t
=C2=A0 auto-compression-mode: t

Load-path shadows:
No= ne found.

Features:
(shadow sort mail-extr emacsbug misearch mult= i-isearch mm-archive
message sendmail dired dired-loaddefs rfc822 mml mm= l-sec epa derived
gnus-util text-property-search mailabbrev gmm-utils ma= ilheader mm-decode
mm-bodies mm-encode mail-utils mule-util gnutls netwo= rk-stream url-cache
url-http url-auth mail-parse rfc2231 rfc2047 rfc2045= mm-util ietf-drums
mail-prsvr url-gw nsm puny epg rfc6068 epg-config co= mp comp-cstr
warnings cus-edit pp cus-start wid-edit cl-extra help-mode = yank-media
markdown-mode thingatpt noutline outline icons time-date vc-g= it
diff-mode easy-mmode vc-dispatcher python rx project pcase treesitcomint ansi-osc ring ansi-color gruvbox-dark-hard-theme gruvbox
autothe= mer color lisp-mnt dash saveplace whitespace tab-line
display-line-numbe= rs elec-pair desktop frameset delsel cus-load
finder-inf csv-mode-autolo= ads info markdown-mode-autoloads
po-mode-autoloads tree-sitter-autoloads= tsc-autoloads package browse-url
url url-proxy url-privacy url-expand u= rl-methods url-history url-cookie
generate-lisp-file url-domsuf url-util= mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-m= acs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url= -vars cl-loaddefs cl-lib
cyril-util rmc iso-transl tooltip cconv eldoc p= aren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mw= heel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image r= egexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode p= rog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu tim= er select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-= colors
frame minibuffer nadvice seq simple cl-generic indonesian philipp= ine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet = lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech<= br>european ethiopic indian cyrillic chinese composite emoji-zwj charscript=
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure=
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
= files window text-properties overlay sha1 md5 base64 format env
code-pag= es mule custom widget keymap hashtable-print-readable backquote
threads = dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-s= etting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network= -process native-compile emacs)

Memory information:
((conses 16 42= 2703 549886)
=C2=A0(symbols 48 21740 133)
=C2=A0(strings 32 123122 10= 9316)
=C2=A0(string-bytes 1 5309779)
=C2=A0(vectors 16 36085)
=C2= =A0(vector-slots 8 683635 189466)
=C2=A0(floats 8 249 448)
=C2=A0(int= ervals 56 999 1339)
=C2=A0(buffers 984 19))
--00000000000059e28e061be8be71-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 29 07:52:45 2024 Received: (at 71819) by debbugs.gnu.org; 29 Jun 2024 11:52:45 +0000 Received: from localhost ([127.0.0.1]:37248 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNWdJ-0005XR-1T for submit@debbugs.gnu.org; Sat, 29 Jun 2024 07:52:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNWdH-0005XE-3V for 71819@debbugs.gnu.org; Sat, 29 Jun 2024 07:52:43 -0400 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 1sNWdB-0003H0-Kk; Sat, 29 Jun 2024 07:52:37 -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=ZDE68/ODKL5/Kc6+Kzdb0xH8th5W2Xine7AUx7gm0tM=; b=FcSbzuFTIbAB ZHPI9UPgGVs+ySXHZu38/9+2cST8CYoQBkDGR2Pp2L39xRIrhhIzSquJn7OElY1zMkjkO7VSh/IMZ 6OnBlakhmdZeK0OK4akmUqcfuryPIhdfQOovjslVgsXSmVMKBxlygytRqFZcj3CkKLbKd9ofVe3dl /Lpq7bJbnVsntoeMnCcecNAtnWHBQ8Gi380wcxH3+sYs0TqEahP/wdi9VJG0K2Nrlvv9217DB51tP EyDG4JATflMXbrO8ZNKY0Zy8d/h1eR1RNjg1GpgD+CbiYNbg6+DG1PVg4luzU2FsrTShIvG0UUQZT H5rGswU+lUVXvDRlRZ9SoA==; Date: Sat, 29 Jun 2024 14:52:34 +0300 Message-Id: <867ce8j799.fsf@gnu.org> From: Eli Zaretskii To: Sab Pyrope , Juri Linkov In-Reply-To: (message from Sab Pyrope on Fri, 28 Jun 2024 08:57:03 +0800) Subject: Re: bug#71819: Incorrect substitution when undo replacing regexps References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 71819 Cc: 71819@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Sab Pyrope > 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? From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 30 12:38:06 2024 Received: (at 71819) by debbugs.gnu.org; 30 Jun 2024 16:38:06 +0000 Received: from localhost ([127.0.0.1]:58835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNxZ0-0003p8-Bl for submit@debbugs.gnu.org; Sun, 30 Jun 2024 12:38:06 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:42551) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNxYy-0003oW-Fr for 71819@debbugs.gnu.org; Sun, 30 Jun 2024 12:38:04 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 57BEB1BF204; Sun, 30 Jun 2024 16:37:57 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#71819: Incorrect substitution when undo replacing regexps In-Reply-To: <867ce8j799.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 29 Jun 2024 14:52:34 +0300") Organization: LINKOV.NET References: <867ce8j799.fsf@gnu.org> Date: Sun, 30 Jun 2024 19:25:11 +0300 Message-ID: <86o77ipwyw.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 71819 Cc: 71819@debbugs.gnu.org, Sab Pyrope , Tino Calancha X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> 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). From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 13 05:59:57 2024 Received: (at 71819) by debbugs.gnu.org; 13 Jul 2024 09:59:57 +0000 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 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 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==; Date: Sat, 13 Jul 2024 12:59:46 +0300 Message-Id: <86y165k3xp.fsf@gnu.org> From: Eli Zaretskii To: tino.calancha@gmail.com, Juri Linkov In-Reply-To: <86o77ipwyw.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 30 Jun 2024 19:25:11 +0300) Subject: Re: bug#71819: Incorrect substitution when undo replacing regexps References: <867ce8j799.fsf@gnu.org> <86o77ipwyw.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 71819 Cc: 71819@debbugs.gnu.org, sab.pyrope@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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). > From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 28 20:53:12 2025 Received: (at 71819) by debbugs.gnu.org; 1 Mar 2025 01:53:13 +0000 Received: from localhost ([127.0.0.1]:55724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1toC2S-000692-0v for submit@debbugs.gnu.org; Fri, 28 Feb 2025 20:53:12 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:52616) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1toC2Q-00068P-Df for 71819@debbugs.gnu.org; Fri, 28 Feb 2025 20:53:11 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5ded6c31344so3405581a12.1 for <71819@debbugs.gnu.org>; Fri, 28 Feb 2025 17:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740793984; x=1741398784; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=MR+Iw1BAM0EWE+Gc31aMDZkGOJOmB1yIfsLeJhR8kRw=; b=ZW0eX5t66xXOXy2wly7POH0I1aZGP930Wf4H1+SvvuBh13sisGBZ7Uy0px8ngByP// JD5z1IMYoIMqVAIYSOgR6EQcTiwiykMtT9JWq6y6UMnFTCKpFWpRDz+ETa+Cd6mxFINi 8KkDl68tBG21wb4ZeXEqver86NFHyE3098jmtJ1pDwtV43ih9KIG0yd0ycrFFuDje3iT B+rbps1Ehe5kx2j1Wvgfp7x+IMpxC+Zc23O3YJ3Ky0IislKwv7UEZ5q+FEwk5hOnECXp kRCpY5phHxiZyAI708hxuDcs1V3bOE7Al1SlqAt9UR+5D2NF23u7JBdddizcMQfRk9ga OnxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740793984; x=1741398784; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MR+Iw1BAM0EWE+Gc31aMDZkGOJOmB1yIfsLeJhR8kRw=; b=O3vnGW26gh+yecWLxwR+7lGFOEo4lzUZiPbE9S5M0cKLPqwOnUx4jtwRTH6OP3Mfu1 0KSsIfbN5OI9LSAjG4t4IWLv/Vu+1QmMKF6+OVUo3huOU5VDuhdq5cyUQRJc/R3/Kw8J +YFeDDlfaEagM1x+0BM88mVrNUlOxpKZQ7wib+FZbdlCyTdaFGQLS4k3IxiQKDDP/ir8 J7iljfXqd9kzNQOVA3zosxkMNNZEgsp52Y2waq+Lpxmx/jntQc4TczRBtAxpEKaN+vQ+ wyVjaw5ow1a1DqqHABGsFw/1Altu1usES9fjipWB8WaUFQ6mGiJhf8DQuItp+rdlwehM 0ZJg== X-Forwarded-Encrypted: i=1; AJvYcCXZ997fOpn457nZYpXNi3GzHf9ENJ2Vxt/nKjCqyoavpWBsI0B57Z00KpUeWCrbnVCLo73Q7w==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw+iTAxlA6H2RCBaQ0pcS+N4e8IW3TLMX+qrN+eZ56KgxPQ8eMW 5lzHBTWO44YYjajUkV+rKrBqOdVCamWg9KY+ataqYqse7IcIlMAi3cD3MjQqf7wX9E7hKg+cPsJ Yv9Kt161qKAg8TRkTxvxYvl9/vF4= X-Gm-Gg: ASbGncts0g1BfzHEfwlq+BtxxT16jzhvucup5KLpqvy2uZuezCUI9JwJmqQE0/Isswq RWtGX3k+jbnNZttZ6NQuGmzuksjqkSYXdzeot5n1fIST5ixNb/t3Yl60wsAugBHyZBMGxqdQ4WU eGRq9DqR4n+mj4hP0bHmOA70wdMxY= X-Google-Smtp-Source: AGHT+IFK7QLObYyTZN0kQRFRwvHfykPsji7yZQnqWOY6tOtSuJQoSV2Q7KnXJ67PhkLvYz88Agap5uE1SG08ft35dBc= X-Received: by 2002:a05:6402:4316:b0:5dc:9589:9f64 with SMTP id 4fb4d7f45d1cf-5e4d6ad8c0dmr12152751a12.13.1740793984249; Fri, 28 Feb 2025 17:53:04 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 28 Feb 2025 17:53:03 -0800 From: Stefan Kangas In-Reply-To: <86y165k3xp.fsf@gnu.org> References: <867ce8j799.fsf@gnu.org> <86o77ipwyw.fsf@mail.linkov.net> <86y165k3xp.fsf@gnu.org> MIME-Version: 1.0 Date: Fri, 28 Feb 2025 17:53:03 -0800 X-Gm-Features: AQ5f1JqXEMCgmozrkw4lJfRfmDikPYkoMz8HL8zLtvyIkrMfhuWjpMqGMO66pbU Message-ID: Subject: Re: bug#71819: Incorrect substitution when undo replacing regexps To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 71819 Cc: 71819@debbugs.gnu.org, Juri Linkov , sab.pyrope@gmail.com, tino.calancha@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Eli Zaretskii writes: > Ping! Tino, can you please look into this issue? Friendly ping. Tino, could you please look into this issue that seems to have been introduced by your commit 30c4f35a6fc8? > >> 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). >>