mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-07 20:30:32 -08:00
(Freplace_match): Do the right thing with backslash.
This commit is contained in:
parent
ad10348f71
commit
1e79ec2421
1 changed files with 15 additions and 2 deletions
17
src/search.c
17
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue