aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorGerd Moellmann2000-03-24 20:49:56 +0000
committerGerd Moellmann2000-03-24 20:49:56 +0000
commitf4ed767fb5079c07360ec124ba1ee99d16914781 (patch)
treeb64a81ceed1c109e8cdb22d6c0802a2a05565618 /src/syntax.c
parent79c70818bc8bdc1e715516c1f373143c3986de4b (diff)
downloademacs-f4ed767fb5079c07360ec124ba1ee99d16914781.tar.gz
emacs-f4ed767fb5079c07360ec124ba1ee99d16914781.zip
(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.
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 496693f7b23..f52812e096e 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -53,6 +53,12 @@ int multibyte_syntax_as_symbol;
53 only very temporarily. */ 53 only very temporarily. */
54Lisp_Object syntax_temp; 54Lisp_Object syntax_temp;
55 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
60int open_paren_in_column_0_is_defun_start;
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
58struct lisp_parse_state 64struct lisp_parse_state
@@ -370,11 +376,13 @@ find_defun_start (pos, pos_byte)
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;
@@ -2963,6 +2971,11 @@ relevant only for open/close type.");
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);