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: Sat, 14 Dec 2024 11:43:17 +0200 Message-ID: <86ttb6vbuy.fsf@gnu.org> References: <5aad7547-5fd7-4eba-a6eb-38b1b4753dd8@gmail.com> <86y10w2763.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14947"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74666@debbugs.gnu.org, ideasman42@gmail.com To: monnier@iro.umontreal.ca Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 14 10:44:20 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 1tMOh9-0003ie-N4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Dec 2024 10:44:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMOgu-0002Fw-1M; Sat, 14 Dec 2024 04:44:04 -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 1tMOgs-0002Fh-Qs for bug-gnu-emacs@gnu.org; Sat, 14 Dec 2024 04:44: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 1tMOgs-0002m9-Iz for bug-gnu-emacs@gnu.org; Sat, 14 Dec 2024 04:44: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=EkVab09aO/6wjjQTK6H6rDrIwP48XbCsVaKtib1LFM8=; b=hCWYjCDf8aC8NpR+Q20l9SBwFNI633n92iAJHEOYS3NnTYf7nrJ/36Qr/LsNsQtkB2adxSw9KM4vAxEafdqPPCWFBHKlPYSN0lSlJd3WiwUkol4Wy/PeibmZWLz2Z8Vzn2VW7BoUoesvKOdpsA2Va0I7I/gGYYNL9+L/mNWNY1x85U9Fb6szRlkU+4RVXfSLiCxbxYMux72EJPOF089+1IapIWMz9JMi7h+WNQIjAq9z8z/m2fv0kPzJsHVTI6/b6CHndh+bRYyf8iGYrzB7SJTVD6X1UXBStXyve+u0EFs0jpyGmWLM5iqkD0avJWOvIVw/Ui+UIJofFHtkYeQYnQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tMOgs-00072y-CX for bug-gnu-emacs@gnu.org; Sat, 14 Dec 2024 04:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Dec 2024 09:44:02 +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.173416940927027 (code B ref 74666); Sat, 14 Dec 2024 09:44:02 +0000 Original-Received: (at 74666) by debbugs.gnu.org; 14 Dec 2024 09:43:29 +0000 Original-Received: from localhost ([127.0.0.1]:45492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMOgL-00071r-2W for submit@debbugs.gnu.org; Sat, 14 Dec 2024 04:43:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMOgJ-00071b-4y for 74666@debbugs.gnu.org; Sat, 14 Dec 2024 04:43:27 -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 1tMOgD-0002jj-Ts; Sat, 14 Dec 2024 04:43:21 -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=EkVab09aO/6wjjQTK6H6rDrIwP48XbCsVaKtib1LFM8=; b=imVVRxxE4kId ElQPZ+BEdHngMgYB3e2VbdooUA3iAtUNCil6k+x84s+cCOBrqQPMCe/8uFymMhksOQC2NnOanB8uP R2iEetuBbxLEYc2UxtPYCapMAgmuBxhs1vWUq/zKygCzObHK0FQ9c+yJt3aZ0NLZVlWK5Tm2CdX0l QuMSbVIdOwprHfBTw3PmxQ8ITHspsHf22+1AI20ObwbKKNa/3cqUoapFWIuLsEGN3pXaKScS5gp0W Rld9o7PXKiGrttjPjwzqYhGQEiUHFCSe4Bbq0WixLRrMNHSdKv8pExV9R9iNtnYjUQVU/rHBTSVZe PNJr90e9GzYkIZyjsixjfA==; In-Reply-To: <86y10w2763.fsf@gnu.org> (message from Eli Zaretskii on Tue, 03 Dec 2024 16:05:40 +0200) 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:297026 Archived-At: Ping! > Cc: 74666@debbugs.gnu.org > Date: Tue, 03 Dec 2024 16:05:40 +0200 > From: Eli Zaretskii > > > 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? > > > >