summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-03-22 04:17:06 +0000
committerRichard M. Stallman <rms@gnu.org>1997-03-22 04:17:06 +0000
commit636a5e284add5d85e9cd97b44acb27262f2efb38 (patch)
treebf284541727c00d873043aafd5dc0a03cce16785 /src/search.c
parentb5dc1c835ae86217462e0fc479ed79994bd91670 (diff)
downloademacs-636a5e284add5d85e9cd97b44acb27262f2efb38.tar.gz
(Freplace_match): Give error if
NEWTEXT uses backslash in an invalid way.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c
index abdd2460bd8..9978f9b7e3b 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1821,7 +1821,8 @@ since only regular expressions have distinguished subexpressions.")
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 @@ since only regular expressions have distinguished subexpressions.")
}
else if (c == '\\')
delbackslash = 1;
+ else
+ error ("Invalid use of `\\' in replacement text");
}
if (substart >= 0)
{
@@ -1888,6 +1891,7 @@ since only regular expressions have distinguished subexpressions.")
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 @@ since only regular expressions have distinguished subexpressions.")
make_number (search_regs.start[c - '0'] + offset),
make_number (search_regs.end[c - '0'] + offset));
}
- else
+ else if (c == '\\')
insert_char (c);
+ else
+ error ("Invalid use of `\\' in replacement text");
}
else
insert_char (c);