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#74666: 31.0.50; Regression in replace-match with empty-adjacent groups Date: Tue, 03 Dec 2024 16:05:40 +0200 Message-ID: <86y10w2763.fsf@gnu.org> References: <5aad7547-5fd7-4eba-a6eb-38b1b4753dd8@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39176"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74666@debbugs.gnu.org To: Campbell Barton , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 03 15:07:03 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 1tITYM-000A4e-CV for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 Dec 2024 15:07:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tITXR-0007cR-26; Tue, 03 Dec 2024 09:06:05 -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 1tITXO-0007cD-Ba for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2024 09:06:02 -0500 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 1tITXO-0004ka-2y for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2024 09:06:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=vcWNyl9nGvYdzzsAdgu1Hj7d/JIMdTNulX7ifS0lkzE=; b=WKmnqeKyYbQ/IiZ+dPCZB3R94lKVM3BXghf9QM1ufDFzQHeHK6ZITohrvr1XmKPPgaKMxIcP3i9R0KesXVj6/RF8z9KhdY1jYBhV2Ndg16bNZW5FOYHrh1Lfqia3WMqYXMrxkCo8+4NBNho+jFqQyMSDiG0lkn1XDlBjwhluO6+jtCw2FrBGFFru4bRY+zzx+WD8Rlb2bi1huzHprRQlv/joetI3CfEx9RpDQo+c1eyX/07pa54jED4x/kitZdaI4du8oyJdLdt1jbpTv1jETBFxQnMh/LtF05zAVri6ieCNy8L/ajj+pMNusvX8WxDRyRvqHPN7hl84AFWU+bKdcA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tITXN-0008Ij-SV for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2024 09:06: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: Tue, 03 Dec 2024 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74666 X-GNU-PR-Package: emacs Original-Received: via spool by 74666-submit@debbugs.gnu.org id=B74666.173323475531893 (code B ref 74666); Tue, 03 Dec 2024 14:06:01 +0000 Original-Received: (at 74666) by debbugs.gnu.org; 3 Dec 2024 14:05:55 +0000 Original-Received: from localhost ([127.0.0.1]:58773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tITXG-0008IL-OA for submit@debbugs.gnu.org; Tue, 03 Dec 2024 09:05:55 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46006) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tITXF-0008I4-EA for 74666@debbugs.gnu.org; Tue, 03 Dec 2024 09:05:54 -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 1tITX8-0004i4-Ns; Tue, 03 Dec 2024 09:05:47 -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=vcWNyl9nGvYdzzsAdgu1Hj7d/JIMdTNulX7ifS0lkzE=; b=LcT0SYgukWVf NFOH14XGSrevq+RC+hdVUInso6rKYVGoYha7UP1XyOAGjmXR7Zv/nV/OEKbrEs/sILCQ0m0sUPT+F FvHJ1495TwrF1+pKR4w84dT9S4haHJoEvFXOn6RAUARvidA+J+CfRFd7xz9v59RtdyjatjaeiMoPx 0qqdluCXDdiOalIlklmS6EAZjFBFPhZNGWSvQFsxcBGdHokvJ6/aYRs/SeDDnnfolRlxtnGK+hDBx Z24eOTUdPmI2yqb7JfCs0L8Bgxgo8SPYovcpcusTbDfAgkjjnPIMxmMyEH+xI4u2zZg4JLxLCmq5f SqCnIYB3VQXa2xzBTu2e6Q==; In-Reply-To: <5aad7547-5fd7-4eba-a6eb-38b1b4753dd8@gmail.com> (message from Campbell Barton on Tue, 3 Dec 2024 21:56:02 +1100) 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:296368 Archived-At: > Date: Tue, 3 Dec 2024 21:56:02 +1100 > From: Campbell Barton > > > Run the following file as an executable script: > > emacs -Q --batch -l ./emacs-test.el > > ;; BEGIN SCRIPT: > #!/usr/bin/env -S emacs --batch -l > ;;; emacs-git-log --- Batch check emacs-lisp. -*- lexical-binding: t -*- > > (defun printf (&rest args) > (princ (apply #'format args) #'external-debugging-output)) > > (defun test-me (is-forward) > (let ((result "")) > (with-temp-buffer > (insert "__B_\n") > (save-match-data > (set-match-data (list 2 4 2 2 2 4)) > (cond > (is-forward > (replace-match "HELLO" t t nil 1) > (replace-match "WORLD" t t nil 2)) > (t > (replace-match "WORLD" t t nil 2) > (replace-match "HELLO" t t nil 1)))) > (setq result (buffer-substring-no-properties (point-min) > (point-max)))) > result)) > > (printf "A: %s" (test-me t)) > (printf "B: %s" (test-me nil)) > ;; END SCRIPT: > > In emacs 29.4 this prints: > > A: _HELLOWORLD_ > B: _HELLOWORLD_ > > In emacs 31.0.50 this prints: > > A: _WORLD_ > B: _HELLOWORLD_ > > This is a regression in 47b497b4dac91e5ea56102018223bdeb5e21a93b. Stefan, could you please take a look?