Lisp_Object Qtty_color_mode;
Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
+#ifdef USE_FONT_BACKEND
+Lisp_Object Qfont_backend;
+#endif /* USE_FONT_BACKEND */
+ Lisp_Object Qinhibit_face_set_after_frame_default;
Lisp_Object Qface_set_after_frame_default;
don't need to handle them for multibyte.
They are distinguished by a negative wctype. */
- if (multibyte)
- SET_RANGE_TABLE_WORK_AREA_BIT (range_table_work,
- re_wctype_to_bit (cc));
+ for (ch = 0; ch < 128; ++ch)
+ if (re_iswctype (btowc (ch), cc))
+ {
+ c = TRANSLATE (ch);
+ SET_LIST_BIT (c);
+ }
- for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
+ if (target_multibyte)
+ {
+ SET_RANGE_TABLE_WORK_AREA_BIT
+ (range_table_work, re_wctype_to_bit (cc));
+ }
+ else
{
- int translated = TRANSLATE (ch);
- if (re_iswctype (btowc (ch), cc))
- SET_LIST_BIT (translated);
+ for (ch = 0; ch < (1 << BYTEWIDTH); ++ch)
+ {
+ c = ch;
+ MAKE_CHAR_MULTIBYTE (c);
+ if (re_iswctype (btowc (c), cc))
+ {
+ c = TRANSLATE (c);
+ MAKE_CHAR_UNIBYTE (c);
+ SET_LIST_BIT (c);
+ }
+ }
}
+ /* In most cases the matching rule for char classes
+ only uses the syntax table for multibyte chars,
+ so that the content of the syntax-table it is not
+ hardcoded in the range_table. SPACE and WORD are
+ the two exceptions. */
+ if ((1 << cc) & ((1 << RECC_SPACE) | (1 << RECC_WORD)))
+ bufp->used_syntax = 1;
+
/* Repeat the loop. */
continue;
}
/* Similarly for an end-of-line anchor. */
unsigned not_eol : 1;
+ /* If true, the compilation of the pattern had to look up the syntax table,
+ so the compiled pattern is only valid for the current syntax table. */
+ unsigned used_syntax : 1;
+
#ifdef emacs
- /* If true, multi-byte form in the `buffer' should be recognized as a
- multibyte character. */
+ /* If true, multi-byte form in the regexp pattern should be
+ recognized as a multibyte character. When the pattern is
+ compiled, this is set to the same value as target_multibyte
+ below. */
unsigned multibyte : 1;
+
+ /* If true, multi-byte form in the target of match should be
+ recognized as a multibyte character. */
+ unsigned target_multibyte : 1;
#endif
/* [[[end pattern_buffer]]] */
cp->regexp = Qnil;
cp->buf.translate = (! NILP (translate) ? translate : make_number (0));
cp->posix = posix;
- cp->buf.multibyte = multibyte;
+ cp->buf.multibyte = STRING_MULTIBYTE (pattern);
+ cp->buf.target_multibyte = multibyte;
cp->whitespace_regexp = Vsearch_spaces_regexp;
- cp->syntax_table = current_buffer->syntax_table;
/* 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.
re_set_whitespace_regexp (NILP (Vsearch_spaces_regexp) ? NULL
: SDATA (Vsearch_spaces_regexp));
- val = (char *) re_compile_pattern ((char *)raw_pattern,
- raw_pattern_size, &cp->buf);
+ val = (char *) re_compile_pattern ((char *) SDATA (pattern),
+ SBYTES (pattern), &cp->buf);
+ /* If the compiled pattern hard codes some of the contents of the
+ syntax-table, it can only be reused with *this* syntax table. */
+ cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt;
+
re_set_whitespace_regexp (NULL);
re_set_syntax (old);
&& !NILP (Fstring_equal (cp->regexp, pattern))
&& EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
&& cp->posix == posix
- && cp->buf.multibyte == multibyte
+ && cp->buf.target_multibyte == multibyte
- /* TODO: Strictly speaking, we only need to match syntax
- tables when a character class like [[:space:]] occurs in
- the pattern. -- cyd*/
- && EQ (cp->syntax_table, current_buffer->syntax_table)
+ && (EQ (cp->syntax_table, Qt)
+ || EQ (cp->syntax_table, current_buffer->syntax_table))
&& !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)))
break;