Subject: Re: bug#78777: 30.1; insert-file-contents should not set buffer-file-name to nil

From: Jimmy Yuen Ho Wong <[email-masked]>
Date: Sat, 21 Jun 2025 14:16:48 +0100

> An alternative is to go back to using replace-buffer-content.  If its
> default operation is (or could be) too slow, you should be able to
> avoid that by passing zero for the MAX-SECS argument.
>

This is not a great solution. The point and mark will often move far away
from where it was after replacing content, even inside a
save-mark-and-incursion. There is a [RCS patch algorithm](
https://github.com/radian-software/apheleia/blob/main/apheleia-rcs.el)
available in a third party package, but there's no built-in Emacs function
that can do better than insert-file-contents in terms of speed and behavior.