• Mattias Engdegård's avatar
    Fix replace-regexp-in-string substring match data translation · 558b6dbc
    Mattias Engdegård authored
    For certain patterns, re-matching the same regexp on the matched
    substring does not produce correctly translated match data
    (bug#15107 and bug#44861).
    
    Using a new builtin function also improves performance since the
    number of calls to string-match is halved.
    
    Reported by Kevin Ryde and Shigeru Fukaya.
    
    * lisp/subr.el (replace-regexp-in-string): Translate the match data
    using match-data--translate instead of trusting a call to string-match
    on the matched string to do the job.
    * test/lisp/subr-tests.el (subr-replace-regexp-in-string):
    Add test cases.
    * src/search.c (Fmatch_data__translate): New internal function.
    (syms_of_search): Register it as a subroutine.
    558b6dbc
search.c 102 KB