From: Karl Heuer Date: Fri, 9 Jun 1995 01:10:11 +0000 (+0000) Subject: (Freplace_match): Do the right thing with backslash. X-Git-Tag: emacs-19.34~3711 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1e79ec2421054e89ec4451e82377f532f8a5be82;p=emacs.git (Freplace_match): Do the right thing with backslash. --- 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;