>>> Also noticed that doing the first replacement always raises an error:
>>>
>>> Debugger entered--Lisp error: (error "Match data clobbered by buffer
>>> modification hooks")
>>> replace-match("!" nil nil)
>>> replace-match-maybe-edit("!" nil nil nil (672 673 #<buffer char>) nil)
>>> perform-replace("7" "!" t t nil nil nil nil nil nil nil)
>>> query-replace-regexp("7" "!" nil nil nil nil nil)
>>> funcall-interactively(query-replace-regexp "7" "!" nil nil nil nil nil)
>>> command-execute(query-replace-regexp)
>>
>> Do I interpret the code in replace_match correctly: this error doesn't
>> even mean the match data has been clobbered - only that modification
>> hooks called searching functions? I don't know what the referenced
>> search_regs.num_regs exactly contains. But we already seem to ensure
>> not to clobber match data.
>
> It fails in emacs-30, but not in emacs-29.
> So this is a regression.
This is caused by commit 63588775fcb, so Cc-ing Stefan.
But probably this commit just exposed the problem
that existed before?
Anyway here is 100% reproducible recipe:
0. emacs -Q
1. 'C-x C-q' in a Dired with symlinks
2. 'C-M-% some_part_of_symlink RET anything RET'
3. 'y'
=> (error "Match data clobbered by buffer modification hooks")
This happens only for the first replacement after `emacs -Q`.