GNU bug report logs -
#19208
replace-match unhelpful error message
Previous Next
Reported by: phillip.lord <at> newcastle.ac.uk (Phillip Lord)
Date: Fri, 28 Nov 2014 17:01:02 UTC
Severity: minor
Tags: fixed
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Occurs in Emacs 24.3 and trunk
Running this code in *scratch* buffer
(progn
(goto-char (point-min))
(re-search-forward "This")
(replace-match "That" nil nil nil))
Now undo and run this code
(progn
(goto-char (point-min))
(re-search-forward "This")
(replace-match "That" nil nil nil 1))
This causes the following error.
progn: Args out of range: -1, -1
The error is caused because I have asked for a subexp that doesn't exist in
the regexp. A programmer error for sure, but the Args out of range error seems
rather unfriendly to me, especially as I have no idea where the -1, or
-1 has come from.
"Attempt to replace regexp subexpression that doesn't exist", for
example, would be nicer.
This bug report was last modified 5 years and 296 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.