Closed aaronjensen closed 6 years ago
Please don't merge this yet, there may be unfavorable behavior differences (the point is not maintained perfectly) between insert-file-contents
and the rcs patch technique.
I'm going to close this out, insert-file-contents
does not maintain the point's location as well as the previous method, so it's not worth it.
insert-file-contents
is a built-in function that is used byrevert-buffer
to replace the current buffer's contents with that of a file while maintaining point position and minimizing changes in the undo stack. In other words, it does more or less whatdiff
+prettier-js--apply-rcs-patch
do with less code.This also eliminates one of the temp files by using
call-process-region
.Benchmarks between the old and the new are practically identical on my machine, so the gain is pretty much only in code reduction. It could possibly be very slightly faster on machines with slower IO.