emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Regexp compiler, problem with character classes


From: Chong Yidong
Subject: Re: [BUG] Regexp compiler, problem with character classes
Date: Thu, 14 Sep 2006 19:20:28 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Richard Stallman <address@hidden> 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;
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]