Commit 18e163fd authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen
Browse files

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).
parent f77a3951
Pipeline #2729 failed with stage
in 56 minutes and 17 seconds
......@@ -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"),
/* Sanity check to see whether the text to replace is present in the
buffer/string. */
if (NILP (string))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment