From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: [BUG] Regexp compiler, problem with character classes Date: Thu, 14 Sep 2006 19:20:28 -0400 Message-ID: <87fyeu5937.fsf@stupidchicken.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1158275936 27031 80.91.229.2 (14 Sep 2006 23:18:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Sep 2006 23:18:56 +0000 (UTC) Cc: emacs-devel@gnu.org, Johan =?utf-8?Q?Bockg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 15 01:18:55 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GO0Tq-0006Hh-NU for ged-emacs-devel@m.gmane.org; Fri, 15 Sep 2006 01:18:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GO0Tq-0008Ki-3k for ged-emacs-devel@m.gmane.org; Thu, 14 Sep 2006 19:18:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GO0Tc-0008KF-TP for emacs-devel@gnu.org; Thu, 14 Sep 2006 19:18:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GO0Tc-0008Je-5k for emacs-devel@gnu.org; Thu, 14 Sep 2006 19:18:36 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GO0Tb-0008Ja-Vd for emacs-devel@gnu.org; Thu, 14 Sep 2006 19:18:36 -0400 Original-Received: from [18.19.1.138] (helo=cyd) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GO0Vd-00078c-5c; Thu, 14 Sep 2006 19:20:41 -0400 Original-Received: by cyd (Postfix, from userid 1000) id 699A24E314; Thu, 14 Sep 2006 19:20:28 -0400 (EDT) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Thu\, 07 Sep 2006 17\:15\:08 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:59849 Archived-At: Richard Stallman writes: > (with-temp-buffer > (list > (progn (modify-syntax-entry ?a " ") > (string-match "x[[:space:]]" "xa")) > (progn (modify-syntax-entry ?a "w") > (string-match "x[[:space:]]" "xa")))) > => (0 0) > > The easiest way to fix that bug > is to make each element of the compiled regexp cache > specify the syntax table that it corresponds to, > and make modify-syntax-entry clear the cache. > That way, no change in regex.c is needed. > > Could someone please do this and then ack? Does this patch look OK? *** emacs/src/search.c.~1.212.~ 2006-09-08 16:32:57.000000000 -0400 --- emacs/src/search.c 2006-09-14 19:16:24.000000000 -0400 *************** *** 207,212 **** --- 207,223 ---- } } + void + clear_regexp_cache () + { + int i; + + BLOCK_INPUT; + for (i = 0; i < REGEXP_CACHE_SIZE; ++i) + searchbufs[i].regexp = Qnil; + UNBLOCK_INPUT; + } + /* Compile a regexp if necessary, but first check to see if there's one in the cache. PATTERN is the pattern to compile. *** /home/cyd/emacs/src/syntax.c.~1.199.~ 2006-07-21 14:57:09.000000000 -0400 --- /home/cyd/emacs/src/syntax.c 2006-09-14 19:18:10.000000000 -0400 *************** *** 1039,1044 **** --- 1039,1046 ---- check_syntax_table (syntax_table); SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), Fstring_to_syntax (newentry)); + clear_regexp_cache (); + return Qnil; }