all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Kenichi Handa <handa@m17n.org>
Cc: 2435@emacsbugs.donarmstrong.com
Subject: bug#2435: Bug 2435
Date: Wed, 04 Mar 2009 23:42:45 -0500	[thread overview]
Message-ID: <877i34shq2.fsf@cyd.mit.edu> (raw)
In-Reply-To: <E1LelpB-0007tx-PR@etlken> (Kenichi Handa's message of "Wed, 04 Mar 2009 16:47:29 +0900")

The following patch tries to avoid the problem by updating the regexp
list before using the regexp cell.  It seems to fix the problem; or do
have a different suggestion?

*** trunk/src/search.c.~1.237.~	2009-02-12 16:45:29.000000000 -0500
--- trunk/src/search.c	2009-03-04 23:38:35.000000000 -0500
***************
*** 134,140 ****
    char *val;
    reg_syntax_t old;
  
!   cp->regexp = Qnil;
    cp->buf.translate = (! NILP (translate) ? translate : make_number (0));
    cp->posix = posix;
    cp->buf.multibyte = STRING_MULTIBYTE (pattern);
--- 134,140 ----
    char *val;
    reg_syntax_t old;
  
!   cp->regexp = Qt;
    cp->buf.translate = (! NILP (translate) ? translate : make_number (0));
    cp->posix = posix;
    cp->buf.multibyte = STRING_MULTIBYTE (pattern);
***************
*** 239,245 ****
  	 nil should never appear before a non-nil entry.  */
        if (NILP (cp->regexp))
  	goto compile_it;
!       if (SCHARS (cp->regexp) == SCHARS (pattern)
  	  && STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern)
  	  && !NILP (Fstring_equal (cp->regexp, pattern))
  	  && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
--- 239,246 ----
  	 nil should never appear before a non-nil entry.  */
        if (NILP (cp->regexp))
  	goto compile_it;
!       if (STRINGP (cp->regexp)
! 	  && SCHARS (cp->regexp) == SCHARS (pattern)
  	  && STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern)
  	  && !NILP (Fstring_equal (cp->regexp, pattern))
  	  && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
***************
*** 248,273 ****
  	      || EQ (cp->syntax_table, current_buffer->syntax_table))
  	  && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))
  	  && cp->buf.charset_unibyte == charset_unibyte)
! 	break;
  
        /* If we're at the end of the cache, compile into the nil cell
  	 we found, or the last (least recently used) cell with a
! 	 string value.  */
        if (cp->next == 0)
  	{
  	compile_it:
  	  compile_pattern_1 (cp, pattern, translate, regp, posix);
  	  break;
  	}
      }
  
-   /* When we get here, cp (aka *cpp) contains the compiled pattern,
-      either because we found it in the cache or because we just compiled it.
-      Move it to the front of the queue to mark it as most recently used.  */
-   *cpp = cp->next;
-   cp->next = searchbuf_head;
-   searchbuf_head = cp;
- 
    /* Advise the searching functions about the space we have allocated
       for register data.  */
    if (regp)
--- 249,279 ----
  	      || EQ (cp->syntax_table, current_buffer->syntax_table))
  	  && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))
  	  && cp->buf.charset_unibyte == charset_unibyte)
! 	{
! 	  /* We found a compiled pattern.  Move it to the front of the
! 	     queue to mark it as most recently used.  */
! 	  *cpp = cp->next;
! 	  cp->next = searchbuf_head;
! 	  searchbuf_head = cp;
! 	  break;
! 	}
  
        /* If we're at the end of the cache, compile into the nil cell
  	 we found, or the last (least recently used) cell with a
! 	 string value.  We must update the queue before calling
! 	 compile_pattern_1, because compile_pattern_1 can end up
! 	 calling compile_pattern recursively (via load_charset).  */
        if (cp->next == 0)
  	{
  	compile_it:
+ 	  *cpp = cp->next;
+ 	  cp->next = searchbuf_head;
+ 	  searchbuf_head = cp;
  	  compile_pattern_1 (cp, pattern, translate, regp, posix);
  	  break;
  	}
      }
  
    /* Advise the searching functions about the space we have allocated
       for register data.  */
    if (regp)







  parent reply	other threads:[~2009-03-05  4:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87fxhvcmvf.fsf@cyd.mit.edu>
     [not found] ` <E1LePPk-0002zE-RW@etlken>
2009-03-03 16:40   ` bug#2435: Bug 2435 Chong Yidong
2009-03-04  2:16     ` Kenichi Handa
2009-03-04  4:41       ` Chong Yidong
2009-03-04  7:47         ` Kenichi Handa
2009-03-05  4:09           ` Chong Yidong
2009-03-05  6:39             ` Kenichi Handa
2009-03-05  4:42           ` Chong Yidong [this message]
2009-03-05 11:23             ` Kenichi Handa
2009-03-05 16:46               ` Stefan Monnier
2009-03-06  3:38                 ` Kenichi Handa
2009-03-06  4:11                   ` Chong Yidong
2009-03-06  4:48                     ` Kenichi Handa
2009-03-06  5:07                       ` Stefan Monnier
2009-03-06  5:21                         ` Kenichi Handa
2009-03-07  4:00                           ` Chong Yidong
2009-03-07 23:07                           ` Stefan Monnier
2009-03-09  1:12                             ` Kenichi Handa

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=877i34shq2.fsf@cyd.mit.edu \
    --to=cyd@stupidchicken.com \
    --cc=2435@emacsbugs.donarmstrong.com \
    --cc=handa@m17n.org \
    /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.