aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorTassilo Horn2019-02-08 20:36:00 +0100
committerTassilo Horn2019-02-08 20:36:00 +0100
commit61748cd78fa3e93a54b60b7568b7e319d9ea09e0 (patch)
tree55461b979a5be7c1e61ad0c8996cd8d20f7f8ec7 /src/editfns.c
parentac1e5a5e2ed7c6cf5bec50e5ebf7fab6792230bd (diff)
downloademacs-61748cd78fa3e93a54b60b7568b7e319d9ea09e0.tar.gz
emacs-61748cd78fa3e93a54b60b7568b7e319d9ea09e0.zip
Add new function replace-buffer-contents
* src/editfns.c (Freplace_buffer_contents): Use lower value of too_expensive and enable heuristic. * lisp/subr.el (replace-region-contents): New convenient wrapper function around replace-buffer-contents.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c
index a9ac263dafa..7a600bacf18 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1910,6 +1910,11 @@ determines whether case is significant or ignored. */)
1910 1910
1911#undef ELEMENT 1911#undef ELEMENT
1912#undef EQUAL 1912#undef EQUAL
1913#define USE_HEURISTIC
1914
1915#ifdef USE_HEURISTIC
1916#define DIFFSEQ_HEURISTIC
1917#endif
1913 1918
1914/* Counter used to rarely_quit in replace-buffer-contents. */ 1919/* Counter used to rarely_quit in replace-buffer-contents. */
1915static unsigned short rbc_quitcounter; 1920static unsigned short rbc_quitcounter;
@@ -2017,8 +2022,11 @@ differences between the two buffers. */)
2017 .insertions = SAFE_ALLOCA (ins_bytes), 2022 .insertions = SAFE_ALLOCA (ins_bytes),
2018 .fdiag = buffer + size_b + 1, 2023 .fdiag = buffer + size_b + 1,
2019 .bdiag = buffer + diags + size_b + 1, 2024 .bdiag = buffer + diags + size_b + 1,
2025#ifdef DIFFSEQ_HEURISTIC
2026 .heuristic = true,
2027#endif
2020 /* FIXME: Find a good number for .too_expensive. */ 2028 /* FIXME: Find a good number for .too_expensive. */
2021 .too_expensive = 1000000, 2029 .too_expensive = 64,
2022 }; 2030 };
2023 memclear (ctx.deletions, del_bytes); 2031 memclear (ctx.deletions, del_bytes);
2024 memclear (ctx.insertions, ins_bytes); 2032 memclear (ctx.insertions, ins_bytes);