diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2008-04-05 21:40:16 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2008-04-05 21:40:16 +0000 |
commit | 23c27bf38456cf188d0f82a14b511c95dd9eb554 (patch) | |
tree | 3a9446ceab5e70643f9dc4d4fd18dad2f40805e3 | |
parent | eb3209f9436ce0c4e74dde7ab30b87fa0bd32168 (diff) | |
download | emacs-23c27bf38456cf188d0f82a14b511c95dd9eb554.tar.gz |
(compile_pattern_1): Treat non-nil and non-string of
search-spaces-regexp as nil.
-rw-r--r-- | src/search.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/search.c b/src/search.c index 56bf47571e1..96daecb728e 100644 --- a/src/search.c +++ b/src/search.c @@ -141,7 +141,11 @@ compile_pattern_1 (cp, pattern, translate, regp, posix) cp->posix = posix; cp->buf.multibyte = STRING_MULTIBYTE (pattern); cp->buf.charset_unibyte = charset_unibyte; - cp->whitespace_regexp = Vsearch_spaces_regexp; + if (STRINGP (Vsearch_spaces_regexp)) + cp->whitespace_regexp = Vsearch_spaces_regexp; + else + cp->whitespace_regexp = Qnil; + /* rms: I think BLOCK_INPUT is not needed here any more, because regex.c defines malloc to call xmalloc. Using BLOCK_INPUT here means the debugger won't run if an error occurs. @@ -149,8 +153,11 @@ compile_pattern_1 (cp, pattern, translate, regp, posix) /* BLOCK_INPUT; */ old = re_set_syntax (RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING)); - re_set_whitespace_regexp (NILP (Vsearch_spaces_regexp) ? NULL - : SDATA (Vsearch_spaces_regexp)); + + if (STRINGP (Vsearch_spaces_regexp)) + re_set_whitespace_regexp (SDATA (Vsearch_spaces_regexp)); + else + re_set_whitespace_regexp (NULL); val = (char *) re_compile_pattern ((char *) SDATA (pattern), SBYTES (pattern), &cp->buf); |