aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/syntax.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 5b0ec6d071b..2acbd413858 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -790,8 +790,10 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
790 || SYNTAX_FLAGS_COMMENT_NESTED (syntax) != comnested)) 790 || SYNTAX_FLAGS_COMMENT_NESTED (syntax) != comnested))
791 continue; 791 continue;
792 792
793 /* Ignore escaped characters, except comment-enders. */ 793 /* Ignore escaped characters, except comment-enders which cannot
794 if (code != Sendcomment && char_quoted (from, from_byte)) 794 be escaped. */
795 if ((Vcomment_end_can_be_escaped || code != Sendcomment)
796 && char_quoted (from, from_byte))
795 continue; 797 continue;
796 798
797 switch (code) 799 switch (code)
@@ -2346,7 +2348,8 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
2346 if (code == Sendcomment 2348 if (code == Sendcomment
2347 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style 2349 && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style
2348 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? 2350 && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ?
2349 (nesting > 0 && --nesting == 0) : nesting < 0)) 2351 (nesting > 0 && --nesting == 0) : nesting < 0)
2352 && !(Vcomment_end_can_be_escaped && char_quoted (from, from_byte)))
2350 /* We have encountered a comment end of the same style 2353 /* We have encountered a comment end of the same style
2351 as the comment sequence which began this comment 2354 as the comment sequence which began this comment
2352 section. */ 2355 section. */
@@ -3702,6 +3705,12 @@ character of that word.
3702In both cases, LIMIT bounds the search. */); 3705In both cases, LIMIT bounds the search. */);
3703 Vfind_word_boundary_function_table = Fmake_char_table (Qnil, Qnil); 3706 Vfind_word_boundary_function_table = Fmake_char_table (Qnil, Qnil);
3704 3707
3708 DEFVAR_BOOL ("comment-end-can-be-escaped", Vcomment_end_can_be_escaped,
3709 doc: /* Non-nil means an escaped ender inside a comment doesn'tend the comment. */);
3710 Vcomment_end_can_be_escaped = 0;
3711 DEFSYM (Qcomment_end_can_be_escaped, "comment-end-can-be-escaped");
3712 Fmake_variable_buffer_local (Qcomment_end_can_be_escaped);
3713
3705 defsubr (&Ssyntax_table_p); 3714 defsubr (&Ssyntax_table_p);
3706 defsubr (&Ssyntax_table); 3715 defsubr (&Ssyntax_table);
3707 defsubr (&Sstandard_syntax_table); 3716 defsubr (&Sstandard_syntax_table);