[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Discrepancy in definition/use of match-data?
From: |
David Kastrup |
Subject: |
Discrepancy in definition/use of match-data? |
Date: |
09 Jun 2004 17:37:54 +0200 |
We have the following excerpt here:
static Lisp_Object
match_limit (num, beginningp)
Lisp_Object num;
int beginningp;
{
register int n;
CHECK_NUMBER (num);
n = XINT (num);
if (n < 0 || n >= search_regs.num_regs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
args_out_of_range (num, make_number (search_regs.num_regs));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if (search_regs.num_regs <= 0
|| search_regs.start[n] < 0)
return Qnil;
return (make_number ((beginningp) ? search_regs.start[n]
: search_regs.end[n]));
}
DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0,
doc: /* Return position of start of text matched by last search.
SUBEXP, a number, specifies which parenthesized expression in the last
regexp.
Value is nil if SUBEXPth pair didn't match, or there were less than
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SUBEXP pairs.
^^^^^^^^^^^^^
Same for match-end and probably match-string. But if there was no
previous match with at least the same number of SUBEXPs in the
history of the Emacs session, we will get an args_out_of_range error.
I think the fix would be to have match-limit return Qnil instead of
flagging an error for the condition
n >= search_regs.num_regs
Correct?
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- Discrepancy in definition/use of match-data?,
David Kastrup <=
- Re: Discrepancy in definition/use of match-data?, Richard Stallman, 2004/06/10
- Re: Discrepancy in definition/use of match-data?, David Kastrup, 2004/06/10
- Re: Discrepancy in definition/use of match-data?, Stephen J. Turnbull, 2004/06/11
- Re: Discrepancy in definition/use of match-data?, David Kastrup, 2004/06/11
- Re: Discrepancy in definition/use of match-data?, Stephen J. Turnbull, 2004/06/12
- Re: Discrepancy in definition/use of match-data?, David Kastrup, 2004/06/12
- Re: Discrepancy in definition/use of match-data?, Richard Stallman, 2004/06/12
- Re: Discrepancy in definition/use of match-data?, Stephen J. Turnbull, 2004/06/14
- Re: Discrepancy in definition/use of match-data?, David Kastrup, 2004/06/14
- Re: Discrepancy in definition/use of match-data?, Stephen J. Turnbull, 2004/06/14