]> git.eshelyaron.com Git - emacs.git/commit
(Freplace_buffer_contents): Preserve markers more carefully
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 11 Mar 2025 21:10:30 +0000 (17:10 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 12 Mar 2025 19:01:40 +0000 (20:01 +0100)
commit1c8b864aea762fa333eabdc315ceb12ba5647d76
tree6af3e1911e603c66ab70edf54069ab49adedc3bd
parentc80f83d41e3d7d8738d779885dfd9bdd26a68176
(Freplace_buffer_contents): Preserve markers more carefully

Use `replace_range` rather than `delete+insert`.

* src/insdel.c (replace_range): Allow NEW to specify a chunk
of buffer text.
* src/editfns.c (Freplace_buffer_contents): Use it.
* test/src/editfns-tests.el (replace-buffer-contents-1): Remove
incorrect check which happened to succeed because point was not
preserved carefully enough.  Make the replacement text share a bit
more content to make the test a bit more strict.
(editfns-tests--replace-region): Doesn't fail any more.

(cherry picked from commit 40d8650d5177bd291747d225c7d2cf2b4ba55856)
src/editfns.c
src/insdel.c
test/src/editfns-tests.el