>> > Maybe this is reproducible only on very long Dired buffers?
>
> After following the recipe literally, I could reproduce that thing, too.
>
> Maybe this issue occurring depends on what exactly is replaced - symlink
> targets. In this case, (font-lock-ensure) does make a
> difference.
>
> Yesterday I had experimented with replacing in symlink names - in that
> case, the whole buffer had been considered.
I tried this:
(dired "/dev/char")
M-: (buffer-substring (- (point-max) 2) (- (point-max) 1))
=> #("7" 0 1 (fontified nil invisible dired-hide-details-link))
M-> ;; (end-of-buffer)
M-: (buffer-substring (- (point-max) 2) (- (point-max) 1))
=> #("7" 0 1 (face default dired-symlink-filename t fontified t invisible
dired-hide-details-link))
And indeed, after going to the end of the Dired buffer
the last file gets an additional property `dired-symlink-filename'
used by Isearch/Replace.
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)