> Is it OK to adjust the match data before actually making the > replacement? If so, I think it's a simpler solution. >> PS: I can think of one (theoretical) other/better way to fix this >> problem: move the match-data adjustment so it's done within >> replace_range before running the after-change-functions. > Isn't that almost the same as what Noam suggested?
Yes, it's the same. And yes, I like the idea, but I just don't know what it would look like as a patch. I have the impression that it could prove either expensive in CPU time and backward incompatible (e.g. adjust markers for every buffer modification), or require extensive code surgery and/or breaking some abstractions. This is just an impression, tho. I think it'd definitely be the better solution, so it's worth investigating anyway, if only for "master" rather than for "emacs-25". Stefan