Mercurial > emacs
comparison src/syntax.c @ 28302:27ffe1e3b06d
(open_paren_in_column_0_is_defun_start): New variable.
(find_defun_start): Consider an open parenthesis in column 0
a defun start only if open_paren_in_column_0_is_defun_start is set.
(syms_of_syntax): New variable open-paren-in-column-0-is-defun-start.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 24 Mar 2000 20:49:56 +0000 |
parents | fd13be8ae190 |
children | cdb964ab44c3 |
comparison
equal
deleted
inserted
replaced
28301:88b4e08f3ac1 | 28302:27ffe1e3b06d |
---|---|
50 | 50 |
51 /* Used as a temporary in SYNTAX_ENTRY and other macros in syntax.h, | 51 /* Used as a temporary in SYNTAX_ENTRY and other macros in syntax.h, |
52 if not compiled with GCC. No need to mark it, since it is used | 52 if not compiled with GCC. No need to mark it, since it is used |
53 only very temporarily. */ | 53 only very temporarily. */ |
54 Lisp_Object syntax_temp; | 54 Lisp_Object syntax_temp; |
55 | |
56 /* Non-zero means an open parenthesis in column 0 is always considered | |
57 to be the start of a defun. Zero means an open parenthesis in | |
58 column 0 has no special meaning. */ | |
59 | |
60 int open_paren_in_column_0_is_defun_start; | |
55 | 61 |
56 /* This is the internal form of the parse state used in parse-partial-sexp. */ | 62 /* This is the internal form of the parse state used in parse-partial-sexp. */ |
57 | 63 |
58 struct lisp_parse_state | 64 struct lisp_parse_state |
59 { | 65 { |
368 syntax-tables. */ | 374 syntax-tables. */ |
369 gl_state.current_syntax_table = current_buffer->syntax_table; | 375 gl_state.current_syntax_table = current_buffer->syntax_table; |
370 gl_state.use_global = 0; | 376 gl_state.use_global = 0; |
371 while (PT > BEGV) | 377 while (PT > BEGV) |
372 { | 378 { |
373 /* Open-paren at start of line means we found our defun-start. */ | 379 /* Open-paren at start of line means we may have found our |
380 defun-start. */ | |
374 if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) | 381 if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) |
375 { | 382 { |
376 SETUP_SYNTAX_TABLE (PT + 1, -1); /* Try again... */ | 383 SETUP_SYNTAX_TABLE (PT + 1, -1); /* Try again... */ |
377 if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) | 384 if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen |
385 && open_paren_in_column_0_is_defun_start) | |
378 break; | 386 break; |
379 /* Now fallback to the default value. */ | 387 /* Now fallback to the default value. */ |
380 gl_state.current_syntax_table = current_buffer->syntax_table; | 388 gl_state.current_syntax_table = current_buffer->syntax_table; |
381 gl_state.use_global = 0; | 389 gl_state.use_global = 0; |
382 } | 390 } |
2961 | 2969 |
2962 DEFVAR_BOOL ("multibyte-syntax-as-symbol", &multibyte_syntax_as_symbol, | 2970 DEFVAR_BOOL ("multibyte-syntax-as-symbol", &multibyte_syntax_as_symbol, |
2963 "Non-nil means `scan-sexps' treats all multibyte characters as symbol."); | 2971 "Non-nil means `scan-sexps' treats all multibyte characters as symbol."); |
2964 multibyte_syntax_as_symbol = 0; | 2972 multibyte_syntax_as_symbol = 0; |
2965 | 2973 |
2974 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start", | |
2975 &open_paren_in_column_0_is_defun_start, | |
2976 "Non-nil means an open paren in column 0 denotes the start of a defun."); | |
2977 open_paren_in_column_0_is_defun_start = 1; | |
2978 | |
2966 defsubr (&Ssyntax_table_p); | 2979 defsubr (&Ssyntax_table_p); |
2967 defsubr (&Ssyntax_table); | 2980 defsubr (&Ssyntax_table); |
2968 defsubr (&Sstandard_syntax_table); | 2981 defsubr (&Sstandard_syntax_table); |
2969 defsubr (&Scopy_syntax_table); | 2982 defsubr (&Scopy_syntax_table); |
2970 defsubr (&Sset_syntax_table); | 2983 defsubr (&Sset_syntax_table); |