From 1e79ec2421054e89ec4451e82377f532f8a5be82 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Fri, 9 Jun 1995 01:10:11 +0000 Subject: [PATCH] (Freplace_match): Do the right thing with backslash. --- src/search.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/search.c b/src/search.c index 4fdbf8c7f0d..5b3192cebe1 100644 --- a/src/search.c +++ b/src/search.c @@ -1651,6 +1651,7 @@ which is made by replacing the part of STRING that was matched.") { int substart = -1; int subend; + int delbackslash = 0; c = XSTRING (newtext)->data[pos]; if (c == '\\') @@ -1669,11 +1670,15 @@ which is made by replacing the part of STRING that was matched.") subend = search_regs.end[c - '0']; } } + else if (c == '\\') + delbackslash = 1; } if (substart >= 0) { if (pos - 1 != lastpos + 1) - middle = Fsubstring (newtext, lastpos + 1, pos - 1); + middle = Fsubstring (newtext, + make_number (lastpos + 1), + make_number (pos - 1)); else middle = Qnil; accum = concat3 (accum, middle, @@ -1681,10 +1686,18 @@ which is made by replacing the part of STRING that was matched.") make_number (subend))); lastpos = pos; } + else if (delbackslash) + { + middle = Fsubstring (newtext, make_number (lastpos + 1), + make_number (pos)); + accum = concat2 (accum, middle); + lastpos = pos; + } } if (pos != lastpos + 1) - middle = Fsubstring (newtext, lastpos + 1, pos); + middle = Fsubstring (newtext, make_number (lastpos + 1), + make_number (pos)); else middle = Qnil; -- 2.39.2