diff options
| author | Stefan Monnier | 2010-03-10 09:45:21 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-03-10 09:45:21 -0500 |
| commit | d48cd3f48fdd0d67f906311b632fb58ae4765b5e (patch) | |
| tree | 01c407576bb4aa2e07765a0314a58d2344960fce /src/syntax.c | |
| parent | 61c264722eabe920e3fadf892eb9d2e1c84d1ae3 (diff) | |
| download | emacs-d48cd3f48fdd0d67f906311b632fb58ae4765b5e.tar.gz emacs-d48cd3f48fdd0d67f906311b632fb58ae4765b5e.zip | |
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.c')
| -rw-r--r-- | src/syntax.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/syntax.c b/src/syntax.c index 47b4caf5ade..a80f047e43c 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -385,8 +385,7 @@ find_defun_start (pos, pos_byte) | |||
| 385 | /* We optimize syntax-table lookup for rare updates. Thus we accept | 385 | /* We optimize syntax-table lookup for rare updates. Thus we accept |
| 386 | only those `^\s(' which are good in global _and_ text-property | 386 | only those `^\s(' which are good in global _and_ text-property |
| 387 | syntax-tables. */ | 387 | syntax-tables. */ |
| 388 | gl_state.current_syntax_table = current_buffer->syntax_table; | 388 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 389 | gl_state.use_global = 0; | ||
| 390 | while (PT > BEGV) | 389 | while (PT > BEGV) |
| 391 | { | 390 | { |
| 392 | int c; | 391 | int c; |
| @@ -401,8 +400,7 @@ find_defun_start (pos, pos_byte) | |||
| 401 | if (SYNTAX (c) == Sopen) | 400 | if (SYNTAX (c) == Sopen) |
| 402 | break; | 401 | break; |
| 403 | /* Now fallback to the default value. */ | 402 | /* Now fallback to the default value. */ |
| 404 | gl_state.current_syntax_table = current_buffer->syntax_table; | 403 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 405 | gl_state.use_global = 0; | ||
| 406 | } | 404 | } |
| 407 | /* Move to beg of previous line. */ | 405 | /* Move to beg of previous line. */ |
| 408 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1); | 406 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1); |
| @@ -860,11 +858,9 @@ are listed in the documentation of `modify-syntax-entry'. */) | |||
| 860 | Lisp_Object character; | 858 | Lisp_Object character; |
| 861 | { | 859 | { |
| 862 | int char_int; | 860 | int char_int; |
| 863 | gl_state.current_syntax_table = current_buffer->syntax_table; | ||
| 864 | |||
| 865 | gl_state.use_global = 0; | ||
| 866 | CHECK_NUMBER (character); | 861 | CHECK_NUMBER (character); |
| 867 | char_int = XINT (character); | 862 | char_int = XINT (character); |
| 863 | SETUP_BUFFER_SYNTAX_TABLE (); | ||
| 868 | return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); | 864 | return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); |
| 869 | } | 865 | } |
| 870 | 866 | ||
| @@ -874,10 +870,9 @@ DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, | |||
| 874 | Lisp_Object character; | 870 | Lisp_Object character; |
| 875 | { | 871 | { |
| 876 | int char_int, code; | 872 | int char_int, code; |
| 877 | gl_state.current_syntax_table = current_buffer->syntax_table; | ||
| 878 | gl_state.use_global = 0; | ||
| 879 | CHECK_NUMBER (character); | 873 | CHECK_NUMBER (character); |
| 880 | char_int = XINT (character); | 874 | char_int = XINT (character); |
| 875 | SETUP_BUFFER_SYNTAX_TABLE (); | ||
| 881 | code = SYNTAX (char_int); | 876 | code = SYNTAX (char_int); |
| 882 | if (code == Sopen || code == Sclose) | 877 | if (code == Sopen || code == Sclose) |
| 883 | return SYNTAX_MATCH (char_int); | 878 | return SYNTAX_MATCH (char_int); |
| @@ -1752,7 +1747,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes) | |||
| 1752 | let's initialize it manually. | 1747 | let's initialize it manually. |
| 1753 | We ignore syntax-table text-properties for now, since that's | 1748 | We ignore syntax-table text-properties for now, since that's |
| 1754 | what we've done in the past. */ | 1749 | what we've done in the past. */ |
| 1755 | SETUP_SYNTAX_TABLE (BEGV, 0); | 1750 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 1756 | if (forwardp) | 1751 | if (forwardp) |
| 1757 | { | 1752 | { |
| 1758 | if (multibyte) | 1753 | if (multibyte) |