# HG changeset patch # User Richard M. Stallman # Date 859004226 0 # Node ID 739e41eed8b666aa5ff85e7259ebba1846515394 # Parent dd2545e79adda439c534c26103ee5331eb14e1b0 (Freplace_match): Give error if NEWTEXT uses backslash in an invalid way. diff -r dd2545e79add -r 739e41eed8b6 src/search.c --- a/src/search.c Sat Mar 22 04:13:50 1997 +0000 +++ b/src/search.c Sat Mar 22 04:17:06 1997 +0000 @@ -1821,7 +1821,8 @@ make_number (search_regs.start[sub])); after = Fsubstring (string, make_number (search_regs.end[sub]), Qnil); - /* Do case substitution into NEWTEXT if desired. */ + /* Substitute parts of the match into NEWTEXT + if desired. */ if (NILP (literal)) { int lastpos = -1; @@ -1856,6 +1857,8 @@ } else if (c == '\\') delbackslash = 1; + else + error ("Invalid use of `\\' in replacement text"); } if (substart >= 0) { @@ -1888,6 +1891,7 @@ newtext = concat2 (accum, middle); } + /* Do case substitution in NEWTEXT if desired. */ if (case_action == all_caps) newtext = Fupcase (newtext); else if (case_action == cap_initial) @@ -1929,8 +1933,10 @@ make_number (search_regs.start[c - '0'] + offset), make_number (search_regs.end[c - '0'] + offset)); } + else if (c == '\\') + insert_char (c); else - insert_char (c); + error ("Invalid use of `\\' in replacement text"); } else insert_char (c);