GNU bug report logs -
#74666
31.0.50; Regression in replace-match with empty-adjacent groups
Previous Next
Full log
Message #8 received at 74666 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 3 Dec 2024 21:56:02 +1100
> From: Campbell Barton <ideasman42 <at> gmail.com>
>
>
> 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?
This bug report was last modified 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.