diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/search.c b/src/search.c index b73ed338791..d3287ee4c02 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -41,7 +41,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 41 | struct regexp_cache | 41 | struct regexp_cache |
| 42 | { | 42 | { |
| 43 | struct regexp_cache *next; | 43 | struct regexp_cache *next; |
| 44 | Lisp_Object regexp; | 44 | Lisp_Object regexp, whitespace_regexp; |
| 45 | struct re_pattern_buffer buf; | 45 | struct re_pattern_buffer buf; |
| 46 | char fastmap[0400]; | 46 | char fastmap[0400]; |
| 47 | /* Nonzero means regexp was compiled to do full POSIX backtracking. */ | 47 | /* Nonzero means regexp was compiled to do full POSIX backtracking. */ |
| @@ -109,7 +109,9 @@ matcher_overflow () | |||
| 109 | for this pattern. 0 means backtrack only enough to get a valid match. | 109 | for this pattern. 0 means backtrack only enough to get a valid match. |
| 110 | MULTIBYTE is nonzero if we want to handle multibyte characters in | 110 | MULTIBYTE is nonzero if we want to handle multibyte characters in |
| 111 | PATTERN. 0 means all multibyte characters are recognized just as | 111 | PATTERN. 0 means all multibyte characters are recognized just as |
| 112 | sequences of binary data. */ | 112 | sequences of binary data. |
| 113 | |||
| 114 | The behavior also depends on Vsearch_whitespace_regexp. */ | ||
| 113 | 115 | ||
| 114 | static void | 116 | static void |
| 115 | compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) | 117 | compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) |
| @@ -160,6 +162,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) | |||
| 160 | cp->buf.translate = (! NILP (translate) ? translate : make_number (0)); | 162 | cp->buf.translate = (! NILP (translate) ? translate : make_number (0)); |
| 161 | cp->posix = posix; | 163 | cp->posix = posix; |
| 162 | cp->buf.multibyte = multibyte; | 164 | cp->buf.multibyte = multibyte; |
| 165 | cp->whitespace_regexp = Vsearch_whitespace_regexp; | ||
| 163 | BLOCK_INPUT; | 166 | BLOCK_INPUT; |
| 164 | old = re_set_syntax (RE_SYNTAX_EMACS | 167 | old = re_set_syntax (RE_SYNTAX_EMACS |
| 165 | | (posix ? 0 : RE_NO_POSIX_BACKTRACKING)); | 168 | | (posix ? 0 : RE_NO_POSIX_BACKTRACKING)); |
| @@ -232,7 +235,8 @@ compile_pattern (pattern, regp, translate, posix, multibyte) | |||
| 232 | && !NILP (Fstring_equal (cp->regexp, pattern)) | 235 | && !NILP (Fstring_equal (cp->regexp, pattern)) |
| 233 | && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) | 236 | && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) |
| 234 | && cp->posix == posix | 237 | && cp->posix == posix |
| 235 | && cp->buf.multibyte == multibyte) | 238 | && cp->buf.multibyte == multibyte |
| 239 | && !NILP (Fequal (cp->whitespace_regexp, Vsearch_whitespace_regexp))) | ||
| 236 | break; | 240 | break; |
| 237 | 241 | ||
| 238 | /* If we're at the end of the cache, compile into the nil cell | 242 | /* If we're at the end of the cache, compile into the nil cell |
| @@ -2981,6 +2985,7 @@ syms_of_search () | |||
| 2981 | searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100); | 2985 | searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100); |
| 2982 | searchbufs[i].buf.fastmap = searchbufs[i].fastmap; | 2986 | searchbufs[i].buf.fastmap = searchbufs[i].fastmap; |
| 2983 | searchbufs[i].regexp = Qnil; | 2987 | searchbufs[i].regexp = Qnil; |
| 2988 | searchbufs[i].whitespace_regexp = Qnil; | ||
| 2984 | staticpro (&searchbufs[i].regexp); | 2989 | staticpro (&searchbufs[i].regexp); |
| 2985 | searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); | 2990 | searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); |
| 2986 | } | 2991 | } |