Michael Gauland writes:
I didn't instrument the functions, but found that there are two places that test '(if (version< emacs-version "26.1"...'. If I change that to use "version<=", the problem goes away (I'm still running 26.1). I don't know whether this is the right fix (the underlying problem may be a quirk in my system, and this is just masking it). I'm hesitant to submit a patch unless someone else can replicate the problem.
The commit `d02ad1f207e1579aff8f36f740a065d71472c182` introduced the use of `replace-buffer-contents` when available. This function was introduced in emacs 26.1, hence the version tests.
There must be an issue with the `replace-buffer-contents` calls. Can you call `trace-function` on `replace-buffer-contents` and trigger the behaviour again to see what it returns ? You said it also happens with `emacs -q`, right ? I'll try to see if I can reproduce with emacs 26.1 tomorrow. -- Sébastien Miquel