From d414c93b062cc3e245a6db0cb764d354d037bd42 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 18 May 2019 14:37:51 -0400 Subject: Don't sgml-syntax-propertize-inside XML prolog (Bug#32823) * lisp/nxml/nxml-mode.el (nxml-syntax-propertize): New function. (nxml-mode): Use it as the syntax-propertize-function. * test/lisp/nxml/nxml-mode-tests.el (nxml-mode-doctype-and-quote-syntax) (nxml-mode-prolog-comment): New tests. --- test/lisp/nxml/nxml-mode-tests.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/lisp') diff --git a/test/lisp/nxml/nxml-mode-tests.el b/test/lisp/nxml/nxml-mode-tests.el index 92744be619d..70816bb9de0 100644 --- a/test/lisp/nxml/nxml-mode-tests.el +++ b/test/lisp/nxml/nxml-mode-tests.el @@ -78,5 +78,26 @@ (should-not (equal (get-text-property squote-txt-pos 'face) (get-text-property dquote-att-pos 'face)))))) +(ert-deftest nxml-mode-doctype-and-quote-syntax () + (with-temp-buffer + (insert "\n]>\n'") + (nxml-mode) + ;; Check that last tag is parsed as a tag. + (should (= 1 (car (syntax-ppss (1- (point-max)))))) + (should (= 0 (car (syntax-ppss (point-max))))))) + +(ert-deftest nxml-mode-prolog-comment () + (with-temp-buffer + (insert " +") + (nxml-mode) + ;; Check that all comments are parsed as comments + (goto-char (point-min)) + (search-forward "comment1") + (should (nth 4 (syntax-ppss))) + (search-forward "comment2") + (should (nth 4 (syntax-ppss))) + (search-forward "comment3"))) + (provide 'nxml-mode-tests) ;;; nxml-mode-tests.el ends here -- cgit v1.2.3