From unknown Sat Jun 21 10:43:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25355: 26.0.50; Provide function to non-destructively replace buffer contents Resent-From: Philipp
There are many tools (e.g. auto-formatters) that take buffer contents,
reformat them, and write the reformatted output somewhere.=C2=A0 However, there is no good way how to apply the modified output to the source
buffer.=C2=A0 The naive way (erasing and re-inserting the buffer contents)<= br> loses point and markers.=C2=A0 Therefore there should be a function
(e.g. `replace-buffer-contents') that calculates a minimal diff between=
the old and the new contents and uses editing operations (insert,
delete, etc.) to apply the diff.=C2=A0 Ideally this would be done without a= ny
external tools (e.g. 'diff').
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sun, 07 May 2017 17:44:27 +0000
>
> FYI, I've now implemented this based on libmba (http:= //www.ioplex.com/~miallen/libmba/). Unless there are
> concerns importing part of that library into the Emacs source tree, I&= #39;ll send a patch.
I'm not sure I understand what you mean by "importing part of that=
library".=C2=A0 Are you going to ask the author to sign legal papers assigning copyright to the FSF?
P.S. Doesn't GNU Diff have code to do this?=C2=A0
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sun, 07 May 2017 18:21:35 +0000
> Cc: 25355@d= ebbugs.gnu.org
>
> I guess we can just use the library as-is? It's MIT-licensed.
What do you mean by "use"?=C2=A0 Treat it as an optional library,= like we
do with image support and GnuTLS?=C2=A0 I thought you wanted this feature to be present in every Emacs, not only Emacs linked against that
library.
>=C2=A0 P.S. Doesn't GNU Diff have code to do this?
>
> Sure, but it's not a library.
Why do you need a library, if you want the code to become part of
Emacs?
The advantage of Diff is that I think the situation with copyright
assignment will be much easier there ;-)
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sun, 07 May 2017 18:45:07 +0000
> Cc: 25355@d= ebbugs.gnu.org
>
>=C2=A0 What do you mean by "use"? Treat it as an optional lib= rary, like we
>=C2=A0 do with image support and GnuTLS? I thought you wanted this feat= ure
>=C2=A0 to be present in every Emacs, not only Emacs linked against that=
>=C2=A0 library.
>
> I just want to link it statically by adding the required source files = to the source tree, like we do for e.g.
> oldXmenu.
That means we need legal papers, AFAIU.