From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Discrepancy in definition/use of match-data? Date: 09 Jun 2004 17:37:54 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1086795544 23863 80.91.224.253 (9 Jun 2004 15:39:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 9 Jun 2004 15:39:04 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Jun 09 17:38:53 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BY5AD-00053R-00 for ; Wed, 09 Jun 2004 17:38:53 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BY5AC-0003PB-00 for ; Wed, 09 Jun 2004 17:38:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BY5Aq-00051y-Lt for emacs-devel@quimby.gnus.org; Wed, 09 Jun 2004 11:39:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BY5AL-0004e7-AQ for emacs-devel@gnu.org; Wed, 09 Jun 2004 11:39:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BY5AI-0004c1-Vf for emacs-devel@gnu.org; Wed, 09 Jun 2004 11:38:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BY5AH-0004bS-W9 for emacs-devel@gnu.org; Wed, 09 Jun 2004 11:38:58 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BY59I-0005J6-7d for emacs-devel@gnu.org; Wed, 09 Jun 2004 11:37:56 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1BY59H-0000dz-KU for emacs-devel@gnu.org; Wed, 09 Jun 2004 11:37:56 -0400 Original-To: emacs-devel@gnu.org Original-Lines: 45 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24776 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24776 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