Adjust match data before calling after-change-funs
commit66f95e0dabf750e9d2eff59b2bb6e593618cd48a
authorNoam Postavsky <npostavs@gmail.com>
Thu, 21 Jul 2016 00:15:14 +0000 (20 20:15 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Sat, 23 Jul 2016 03:55:23 +0000 (22 23:55 -0400)
treea8cd27828bfef2459b70e446cdf1de346327fc3e
parent52cf0d5d98c51c3591ca5d376fd4e85cd9b72d7f
Adjust match data before calling after-change-funs

It's important to adjust the match data in between calling
before-change-functions and after-change-functions, so that buffer
change hooks will always see match-data consistent with buffer content.
(Bug #23917)

* src/insdel.c (replace_range): Add new parameter ADJUST_MATCH_DATA, if
true call update_search_regs.  Update all callers (except
Freplace_match) to pass 0 for the new parameter.
* src/search.c (update_search_regs): New function, extracted from
Freplace_match.
(Freplace_match): Remove match data adjustment code, pass 1 for
ADJUST_MATCH_DATA to replace_range instead.
src/cmds.c
src/editfns.c
src/insdel.c
src/lisp.h
src/search.c