]> git.eshelyaron.com Git - emacs.git/commitdiff
(Freplace_match): Do the right thing with backslash.
authorKarl Heuer <kwzh@gnu.org>
Fri, 9 Jun 1995 01:10:11 +0000 (01:10 +0000)
committerKarl Heuer <kwzh@gnu.org>
Fri, 9 Jun 1995 01:10:11 +0000 (01:10 +0000)
src/search.c

index 4fdbf8c7f0defca60563530947c18b74ef572e1d..5b3192cebe197b2d057f31170c4c78be2d375d1c 100644 (file)
@@ -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;