Subject: bug#73018: 31.0.50; wdired + replace-regexp only modifies the visible portion of the buffer

From: Madhu <[email-masked]>
Date: Wed, 04 Sep 2024 14:28:31 +0530 (IST)

No problem,
*  Michael Heerdegen <[email-masked]> <[email-masked]>
Wrote on Wed, 04 Sep 2024 05:25:46 +0200
> Could you please post a recipe and a backtrace for this second problem?

```
emacs -Q -l f.el
```

produces the backtrace in the file backtrace.txt with the match-data
clobbered error. At this point (i.e. after the error occurs) if I do
"M-x load-library wdired", then a subsequent replace-regexp operation
succeeds.  However in a long running emacs I believe I still see the
match-data clobbered error crops up again, I'm keeping a lookout on
what might be triggering that.

Debugger entered--Lisp error: (error "Match data clobbered by buffer modification hooks")
  replace-match("bar" nil nil)
  replace-match-maybe-edit("bar" nil nil nil (170 173 #<buffer test-foo>) nil)
  perform-replace("foo" "bar" nil t nil nil nil nil nil nil nil)
  replace-regexp("foo" "bar")
  eval-buffer(#<buffer  *load*> nil "/dev/shm/f.el" nil t)  ; Reading at buffer position 359
  load-with-code-conversion("/dev/shm/f.el" "/dev/shm/f.el" nil t)
  load("/dev/shm/f.el" nil t)
  command-line-1(("-l" "/dev/shm/f.el"))
  command-line()
  normal-top-level()
(setq $test-foo-dir "/tmp/test-foo/")
(ignore-errors (make-directory $test-foo-dir))
(ignore-errors
  (loop for i below 40
	for target = (format "/foo/%d" i)
	for link-name = (format "%s%d" $test-foo-dir i)
	do (make-symbolic-link target link-name)))
(dired $test-foo-dir)
(wdired-change-to-wdired-mode)
(load-library "wdired")
(toggle-debug-on-error t)
(replace-regexp "foo" "bar")