diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2010-09-23 15:00:31 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2010-09-23 15:00:31 -0400 |
commit | 266a86bd7fedf743225c2497956b73ecb2245196 (patch) | |
tree | 7d0c8b128070eac293ce2606acb4e55de5843ba8 /src/syntax.c | |
parent | 29cdc13ed61e5a64ba30df1030029898a26b7947 (diff) | |
parent | af3ccb5cc061bccab1c9b024ea444d01c0767767 (diff) | |
download | emacs-266a86bd7fedf743225c2497956b73ecb2245196.tar.gz |
Merge changes from emacs-23 branch
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c index f0a7dca42dc..5f836b0e8cf 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -559,6 +559,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested { int temp_byte, prev_syntax; int com2start, com2end; + int comstart; /* Move back and examine a character. */ DEC_BOTH (from, from_byte); @@ -578,7 +579,8 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested || SYNTAX_FLAGS_COMMENT_NESTED (syntax)) == comnested); com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); - + comstart = (com2start || code == Scomment); + /* Nasty cases with overlapping 2-char comment markers: - snmp-mode: -- c -- foo -- c -- --- c -- @@ -589,15 +591,16 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested /// */ /* If a 2-char comment sequence partly overlaps with another, - we don't try to be clever. */ - if (from > stop && (com2end || com2start)) + we don't try to be clever. E.g. |*| in C, or }% in modes that + have %..\n and %{..}%. */ + if (from > stop && (com2end || comstart)) { int next = from, next_byte = from_byte, next_c, next_syntax; DEC_BOTH (next, next_byte); UPDATE_SYNTAX_TABLE_BACKWARD (next); next_c = FETCH_CHAR_AS_MULTIBYTE (next_byte); next_syntax = SYNTAX_WITH_FLAGS (next_c); - if (((com2start || comnested) + if (((comstart || comnested) && SYNTAX_FLAGS_COMEND_SECOND (syntax) && SYNTAX_FLAGS_COMEND_FIRST (next_syntax)) || ((com2end || comnested) |