aboutsummaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/search.c b/src/search.c
index f0419522df2..c7556a90cb4 100644
--- a/src/search.c
+++ b/src/search.c
@@ -113,6 +113,7 @@ static void
113compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, 113compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
114 Lisp_Object translate, bool posix) 114 Lisp_Object translate, bool posix)
115{ 115{
116 const char *whitespace_regexp;
116 reg_syntax_t syntax; 117 reg_syntax_t syntax;
117 char *val; 118 char *val;
118 119
@@ -132,21 +133,17 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
132 So let's turn it off. */ 133 So let's turn it off. */
133 /* BLOCK_INPUT; */ 134 /* BLOCK_INPUT; */
134 135
135 if (STRINGP (Vsearch_spaces_regexp))
136 re_set_whitespace_regexp (SSDATA (Vsearch_spaces_regexp));
137 else
138 re_set_whitespace_regexp (NULL);
139
140 syntax = RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING); 136 syntax = RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING);
137 whitespace_regexp = STRINGP (Vsearch_spaces_regexp) ?
138 SSDATA (Vsearch_spaces_regexp) : NULL;
139
141 val = (char *) re_compile_pattern (SSDATA (pattern), SBYTES (pattern), 140 val = (char *) re_compile_pattern (SSDATA (pattern), SBYTES (pattern),
142 syntax, &cp->buf); 141 syntax, whitespace_regexp, &cp->buf);
143 142
144 /* If the compiled pattern hard codes some of the contents of the 143 /* If the compiled pattern hard codes some of the contents of the
145 syntax-table, it can only be reused with *this* syntax table. */ 144 syntax-table, it can only be reused with *this* syntax table. */
146 cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt; 145 cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt;
147 146
148 re_set_whitespace_regexp (NULL);
149
150 /* unblock_input (); */ 147 /* unblock_input (); */
151 if (val) 148 if (val)
152 xsignal1 (Qinvalid_regexp, build_string (val)); 149 xsignal1 (Qinvalid_regexp, build_string (val));