aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-03-22 04:17:06 +0000
committerRichard M. Stallman1997-03-22 04:17:06 +0000
commit636a5e284add5d85e9cd97b44acb27262f2efb38 (patch)
treebf284541727c00d873043aafd5dc0a03cce16785 /src
parentb5dc1c835ae86217462e0fc479ed79994bd91670 (diff)
downloademacs-636a5e284add5d85e9cd97b44acb27262f2efb38.tar.gz
emacs-636a5e284add5d85e9cd97b44acb27262f2efb38.zip
(Freplace_match): Give error if
NEWTEXT uses backslash in an invalid way.
Diffstat (limited to 'src')
-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.")
1821 make_number (search_regs.start[sub])); 1821 make_number (search_regs.start[sub]));
1822 after = Fsubstring (string, make_number (search_regs.end[sub]), Qnil); 1822 after = Fsubstring (string, make_number (search_regs.end[sub]), Qnil);
1823 1823
1824 /* Do case substitution into NEWTEXT if desired. */ 1824 /* Substitute parts of the match into NEWTEXT
1825 if desired. */
1825 if (NILP (literal)) 1826 if (NILP (literal))
1826 { 1827 {
1827 int lastpos = -1; 1828 int lastpos = -1;
@@ -1856,6 +1857,8 @@ since only regular expressions have distinguished subexpressions.")
1856 } 1857 }
1857 else if (c == '\\') 1858 else if (c == '\\')
1858 delbackslash = 1; 1859 delbackslash = 1;
1860 else
1861 error ("Invalid use of `\\' in replacement text");
1859 } 1862 }
1860 if (substart >= 0) 1863 if (substart >= 0)
1861 { 1864 {
@@ -1888,6 +1891,7 @@ since only regular expressions have distinguished subexpressions.")
1888 newtext = concat2 (accum, middle); 1891 newtext = concat2 (accum, middle);
1889 } 1892 }
1890 1893
1894 /* Do case substitution in NEWTEXT if desired. */
1891 if (case_action == all_caps) 1895 if (case_action == all_caps)
1892 newtext = Fupcase (newtext); 1896 newtext = Fupcase (newtext);
1893 else if (case_action == cap_initial) 1897 else if (case_action == cap_initial)
@@ -1929,8 +1933,10 @@ since only regular expressions have distinguished subexpressions.")
1929 make_number (search_regs.start[c - '0'] + offset), 1933 make_number (search_regs.start[c - '0'] + offset),
1930 make_number (search_regs.end[c - '0'] + offset)); 1934 make_number (search_regs.end[c - '0'] + offset));
1931 } 1935 }
1932 else 1936 else if (c == '\\')
1933 insert_char (c); 1937 insert_char (c);
1938 else
1939 error ("Invalid use of `\\' in replacement text");
1934 } 1940 }
1935 else 1941 else
1936 insert_char (c); 1942 insert_char (c);