aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2006-09-19 21:44:52 +0000
committerChong Yidong2006-09-19 21:44:52 +0000
commitb69e3c18052eb5003b9a4579c809d1b66abdd26b (patch)
tree1e16c8a6240ca61fa4d0d1e820906164559d9cd9 /src
parentf3209e4331c6190efeb099c6e12beececf20a4c5 (diff)
downloademacs-b69e3c18052eb5003b9a4579c809d1b66abdd26b.tar.gz
emacs-b69e3c18052eb5003b9a4579c809d1b66abdd26b.zip
* search.c (struct regexp_cache): New entry syntax_table.
(compile_pattern_1): Set it. (syms_of_search): Initialize it. (compile_pattern): Require the syntax_table entry of the cache element to match the current syntax table entry.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/search.c10
2 files changed, 18 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6fec97d5a8b..cb2af5c8a3f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12006-09-19 Chong Yidong <cyd@stupidchicken.com>
2
3 * search.c (struct regexp_cache): New entry syntax_table.
4 (compile_pattern_1): Set it.
5 (syms_of_search): Initialize it.
6 (compile_pattern): Require the syntax_table entry of the cache
7 element to match the current syntax table entry.
8
12006-09-19 Stefan Monnier <monnier@iro.umontreal.ca> 92006-09-19 Stefan Monnier <monnier@iro.umontreal.ca>
2 10
3 * window.c (Fwindow_end): Fix recent change. 11 * window.c (Fwindow_end): Fix recent change.
diff --git a/src/search.c b/src/search.c
index 8b469a37b70..a74a320c356 100644
--- a/src/search.c
+++ b/src/search.c
@@ -42,6 +42,9 @@ struct regexp_cache
42{ 42{
43 struct regexp_cache *next; 43 struct regexp_cache *next;
44 Lisp_Object regexp, whitespace_regexp; 44 Lisp_Object regexp, whitespace_regexp;
45 /* Syntax table for which the regexp applies. We need this because
46 of character classes. */
47 Lisp_Object syntax_table;
45 struct re_pattern_buffer buf; 48 struct re_pattern_buffer buf;
46 char fastmap[0400]; 49 char fastmap[0400];
47 /* Nonzero means regexp was compiled to do full POSIX backtracking. */ 50 /* Nonzero means regexp was compiled to do full POSIX backtracking. */
@@ -167,6 +170,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
167 cp->posix = posix; 170 cp->posix = posix;
168 cp->buf.multibyte = multibyte; 171 cp->buf.multibyte = multibyte;
169 cp->whitespace_regexp = Vsearch_spaces_regexp; 172 cp->whitespace_regexp = Vsearch_spaces_regexp;
173 cp->syntax_table = current_buffer->syntax_table;
170 /* Doing BLOCK_INPUT here has the effect that 174 /* Doing BLOCK_INPUT here has the effect that
171 the debugger won't run if an error occurs. 175 the debugger won't run if an error occurs.
172 Why is BLOCK_INPUT needed here? */ 176 Why is BLOCK_INPUT needed here? */
@@ -256,6 +260,10 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
256 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) 260 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
257 && cp->posix == posix 261 && cp->posix == posix
258 && cp->buf.multibyte == multibyte 262 && cp->buf.multibyte == multibyte
263 /* TODO: Strictly speaking, we only need to match syntax
264 tables when a character class like [[:space:]] occurs in
265 the pattern. -- cyd*/
266 && EQ (cp->syntax_table, current_buffer->syntax_table)
259 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))) 267 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)))
260 break; 268 break;
261 269
@@ -3114,8 +3122,10 @@ syms_of_search ()
3114 searchbufs[i].buf.fastmap = searchbufs[i].fastmap; 3122 searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
3115 searchbufs[i].regexp = Qnil; 3123 searchbufs[i].regexp = Qnil;
3116 searchbufs[i].whitespace_regexp = Qnil; 3124 searchbufs[i].whitespace_regexp = Qnil;
3125 searchbufs[i].syntax_table = Qnil;
3117 staticpro (&searchbufs[i].regexp); 3126 staticpro (&searchbufs[i].regexp);
3118 staticpro (&searchbufs[i].whitespace_regexp); 3127 staticpro (&searchbufs[i].whitespace_regexp);
3128 staticpro (&searchbufs[i].syntax_table);
3119 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); 3129 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
3120 } 3130 }
3121 searchbuf_head = &searchbufs[0]; 3131 searchbuf_head = &searchbufs[0];