From: Stefan Monnier Date: Thu, 16 May 2019 02:21:36 +0000 (-0400) Subject: * lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-rules): Fix typo X-Git-Tag: emacs-27.0.90~2877 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9a74e5666b022098c63d0047c0df90c66e1aa64a;p=emacs.git * lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-rules): Fix typo * test/lisp/textmodes/sgml-mode-tests.el (sgml-tests--quotes-syntax): New corresponding test. --- diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 11b30537e67..1b064fb825f 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -345,7 +345,7 @@ 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:\"\\)[^\"<>]*[<>\"]\\|\\(?1:'\\)[^'<>]*[<>']\\)" (1 (unless (memq (char-before) '(?\' ?\")) ;; 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 diff --git a/test/lisp/textmodes/sgml-mode-tests.el b/test/lisp/textmodes/sgml-mode-tests.el index 4355e1c8658..a900e8dcf22 100644 --- a/test/lisp/textmodes/sgml-mode-tests.el +++ b/test/lisp/textmodes/sgml-mode-tests.el @@ -160,5 +160,12 @@ The point is set to the beginning of the buffer." (sgml-quote (point-min) (point-max) t) (should (string= "&&" (buffer-string)))))) +(ert-deftest sgml-tests--quotes-syntax () + (with-temp-buffer + (sgml-mode) + (insert "a\"b c'd") + (should (= 1 (car (syntax-ppss (1- (point-max)))))) + (should (= 0 (car (syntax-ppss (point-max))))))) + (provide 'sgml-mode-tests) ;;; sgml-mode-tests.el ends here