I looking into extending
atomic-chrome to work with text areas that can be modified from the server side, such as site providing collaborative LaTeX editing. The plugin provides updates containing the full text of the modified buffer as a string whenever it changes in the browser window, but it currently performs the update by erasing the buffer and reinserting the full text. As a consequence, the position of point is lost each time changes are made on the browser side.
I believe it might be possible to work around this using a similar mechanism to that which
revert-buffer uses behind the scenes to update the buffer contents, which is to call
insert-file-contents with the
REPLACE argument. Unfortunately, using this function directly would require writing the updated state to a file first, which seems hacky to me.
Is there a way to replicate the behavior of
insert-file-contents with a string instead of file contents, or some other way of achieving the same goal?