all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Subject: Re: [BUG] Regexp compiler, problem with character classes
Date: Mon, 18 Sep 2006 08:53:21 -0400	[thread overview]
Message-ID: <87eju9z67y.fsf@stupidchicken.com> (raw)
In-Reply-To: <yoijodtdzhsy.fsf@gamma02.me.chalmers.se> (Johan Bockgård's message of "Mon\, 18 Sep 2006 10\:43\:09 +0200")

bojohan+news@dd.chalmers.se (Johan Bockgård) writes:

>>> 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.
>> Does this patch look OK? [...]
>
> The "make each element of the compiled regexp cache specify the syntax
> table that it corresponds to" part is still needed.
>
> Here's an example:
>
>     $ emacs -Q
>
>     Evaluate in *scratch*:
>
>       (list
>        (string-match "x[[:space:]]" "x\n")
>        (with-temp-buffer
>          (string-match "x[[:space:]]" "x\n")))
>
>     => (nil nil)
>
> Expected: (nil 0)

You're right; the following additional patch should fix that.

*** emacs/src/search.c.~1.213.~	2006-09-18 08:39:59.000000000 -0400
--- emacs/src/search.c	2006-09-18 08:51:50.000000000 -0400
***************
*** 41,47 ****
  struct regexp_cache
  {
    struct regexp_cache *next;
!   Lisp_Object regexp, whitespace_regexp;
    struct re_pattern_buffer buf;
    char fastmap[0400];
    /* Nonzero means regexp was compiled to do full POSIX backtracking.  */
--- 41,47 ----
  struct regexp_cache
  {
    struct regexp_cache *next;
!   Lisp_Object regexp, whitespace_regexp, syntax_table;
    struct re_pattern_buffer buf;
    char fastmap[0400];
    /* Nonzero means regexp was compiled to do full POSIX backtracking.  */
***************
*** 167,172 ****
--- 167,173 ----
    cp->posix = posix;
    cp->buf.multibyte = multibyte;
    cp->whitespace_regexp = Vsearch_spaces_regexp;
+   cp->syntax_table = current_buffer->syntax_table;
    /* Doing BLOCK_INPUT here has the effect that
       the debugger won't run if an error occurs.
       Why is BLOCK_INPUT needed here?  */
***************
*** 256,261 ****
--- 257,263 ----
  	  && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
  	  && cp->posix == posix
  	  && cp->buf.multibyte == multibyte
+ 	  && EQ (cp->syntax_table, current_buffer->syntax_table)
  	  && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)))
  	break;
  
***************
*** 3114,3121 ****
--- 3116,3125 ----
        searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
        searchbufs[i].regexp = Qnil;
        searchbufs[i].whitespace_regexp = Qnil;
+       searchbufs[i].syntax_table = Qnil;
        staticpro (&searchbufs[i].regexp);
        staticpro (&searchbufs[i].whitespace_regexp);
+       staticpro (&searchbufs[i].syntax_table);
        searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
      }
    searchbuf_head = &searchbufs[0];

  reply	other threads:[~2006-09-18 12:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-03  1:14 [BUG] Regexp compiler, problem with character classes Johan Bockgård
2006-09-07 21:15 ` Richard Stallman
2006-09-13  9:50   ` Johan Bockgård
2006-09-13 19:25     ` Richard Stallman
2006-09-07 21:15 ` Richard Stallman
2006-09-14 23:20   ` Chong Yidong
2006-09-15 14:29     ` Richard Stallman
2006-09-15 15:13       ` Chong Yidong
2006-09-18  8:43     ` Johan Bockgård
2006-09-18 12:53       ` Chong Yidong [this message]
2006-09-18 13:03         ` Stefan Monnier
2006-09-18 13:12         ` Johan Bockgård
2006-09-15  3:14 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eju9z67y.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.