diff options
author | Gerd Moellmann <gerd@gnu.org> | 2000-03-24 20:49:56 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2000-03-24 20:49:56 +0000 |
commit | d91831abc8cb1d53a471c10e93acd5585ae3e187 (patch) | |
tree | 82fbf960fb570aff46ae49889ac67864aab8eff9 | |
parent | 9e94c47d1f5311e2c7b9283d76a72973c22774b1 (diff) | |
download | emacs-d91831abc8cb1d53a471c10e93acd5585ae3e187.tar.gz |
(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.
-rw-r--r-- | src/syntax.c | 17 |
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; only very temporarily. */ Lisp_Object syntax_temp; +/* Non-zero means an open parenthesis in column 0 is always considered + to be the start of a defun. Zero means an open parenthesis in + column 0 has no special meaning. */ + +int open_paren_in_column_0_is_defun_start; + /* This is the internal form of the parse state used in parse-partial-sexp. */ struct lisp_parse_state @@ -370,11 +376,13 @@ find_defun_start (pos, pos_byte) gl_state.use_global = 0; while (PT > BEGV) { - /* Open-paren at start of line means we found our defun-start. */ + /* Open-paren at start of line means we may have found our + defun-start. */ if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) { SETUP_SYNTAX_TABLE (PT + 1, -1); /* Try again... */ - if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) + if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen + && open_paren_in_column_0_is_defun_start) break; /* Now fallback to the default value. */ gl_state.current_syntax_table = current_buffer->syntax_table; @@ -2963,6 +2971,11 @@ relevant only for open/close type."); "Non-nil means `scan-sexps' treats all multibyte characters as symbol."); multibyte_syntax_as_symbol = 0; + DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start", + &open_paren_in_column_0_is_defun_start, + "Non-nil means an open paren in column 0 denotes the start of a defun."); + open_paren_in_column_0_is_defun_start = 1; + defsubr (&Ssyntax_table_p); defsubr (&Ssyntax_table); defsubr (&Sstandard_syntax_table); |