summaryrefslogtreecommitdiff
path: root/src/syntax.h
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-03-10 09:45:21 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2010-03-10 09:45:21 -0500
commitd48cd3f48fdd0d67f906311b632fb58ae4765b5e (patch)
tree01c407576bb4aa2e07765a0314a58d2344960fce /src/syntax.h
parent61c264722eabe920e3fadf892eb9d2e1c84d1ae3 (diff)
downloademacs-d48cd3f48fdd0d67f906311b632fb58ae4765b5e.tar.gz
Cleanup setup of gl_state in various parts of the code.
* syntax.h (SETUP_BUFFER_SYNTAX_TABLE): New macro. (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT): * syntax.c (find_defun_start, Fchar_syntax, Fmatching_paren, skip_chars): * regex.c (regex_compile): Use it. (re_compile_pattern): Don't set gl_state.current_syntax_table since it's now set in regex_compile when/if we need it.
Diffstat (limited to 'src/syntax.h')
-rw-r--r--src/syntax.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/syntax.h b/src/syntax.h
index c36b1eb28f6..ec8fab0166c 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -245,6 +245,14 @@ extern char syntax_code_spec[16];
1) \
: 0))
+/* This macro sets up the buffer-global syntax table. */
+#define SETUP_BUFFER_SYNTAX_TABLE() \
+do \
+ { \
+ gl_state.use_global = 0; \
+ gl_state.current_syntax_table = current_buffer->syntax_table; \
+ } while (0)
+
/* This macro should be called with FROM at the start of forward
search, or after the last position of the backward search. It
makes sure that the first char is picked up with correct table, so
@@ -256,12 +264,11 @@ extern char syntax_code_spec[16];
#define SETUP_SYNTAX_TABLE(FROM, COUNT) \
do \
{ \
+ SETUP_BUFFER_SYNTAX_TABLE (); \
gl_state.b_property = BEGV; \
gl_state.e_property = ZV + 1; \
gl_state.object = Qnil; \
- gl_state.use_global = 0; \
gl_state.offset = 0; \
- gl_state.current_syntax_table = current_buffer->syntax_table; \
if (parse_sexp_lookup_properties) \
if ((COUNT) > 0 || (FROM) > BEGV) \
update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\
@@ -279,6 +286,7 @@ while (0)
#define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT) \
do \
{ \
+ SETUP_BUFFER_SYNTAX_TABLE (); \
gl_state.object = (OBJECT); \
if (BUFFERP (gl_state.object)) \
{ \
@@ -305,8 +313,6 @@ do \
gl_state.e_property = 1 + SCHARS (gl_state.object); \
gl_state.offset = 0; \
} \
- gl_state.use_global = 0; \
- gl_state.current_syntax_table = current_buffer->syntax_table; \
if (parse_sexp_lookup_properties) \
update_syntax_table (((FROM) + gl_state.offset \
+ (COUNT > 0 ? 0 : -1)), \