From 438e4804d107720f526d0c7c367cbd029f264676 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 26 May 2019 11:07:14 -0400 Subject: Fix some SGML syntax edge cases (Bug#33887) * lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-rules): Handle single and double quotes symmetrically. Don't skip quoted comment enders. * test/lisp/textmodes/sgml-mode-tests.el (sgml-tests--quotes-syntax): Add more test cases. (sgml-mode-quote-in-long-text): New test. --- lisp/textmodes/sgml-mode.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lisp/textmodes/sgml-mode.el') diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 75f20722b05..1df7e78afc5 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -363,9 +363,12 @@ Any terminating `>' or `/' is not matched.") ;; the resulting number of calls to syntax-ppss made it too slow ;; (bug#33887), so we're now careful to leave alone any pair ;; of quotes that doesn't hold a < or > char, which is the vast majority. - ("\\(?:\\(?1:\"\\)[^\"<>]*\\|\\(?1:'\\)[^'\"<>]*\\)" + ("\\([\"']\\)[^\"'<>]*" (1 (if (eq (char-after) (char-after (match-beginning 0))) (forward-char 1) + ;; Avoid skipping comment ender. + (when (eq (char-after) ?>) + (skip-chars-backward "-")) ;; Be careful to call `syntax-ppss' on a position before the one ;; we're going to change, so as not to need to flush the data we ;; just computed. -- cgit v1.2.3