Fix error message in replace-match for subexpressions
* src/search.c (Freplace_match): Output a more understandable error message when replacing a subexpression (bug#19208).
This commit is contained in:
parent
f77a395146
commit
18e163fd34
1 changed files with 6 additions and 0 deletions
|
@ -2404,6 +2404,12 @@ since only regular expressions have distinguished subexpressions. */)
|
|||
args_out_of_range (subexp, make_fixnum (search_regs.num_regs));
|
||||
}
|
||||
|
||||
/* Check whether the subexpression to replace is greater than the
|
||||
number of subexpressions in the regexp. */
|
||||
if (sub > 0 && search_regs.start[sub] == -1)
|
||||
args_out_of_range (build_string ("Attempt to replace regexp subexpression that doesn't exist"),
|
||||
subexp);
|
||||
|
||||
/* Sanity check to see whether the text to replace is present in the
|
||||
buffer/string. */
|
||||
if (NILP (string))
|
||||
|
|
Loading…
Add table
Reference in a new issue