From 06b35b2f922150a11d6b4b5c68a40e9957a69e52 Mon Sep 17 00:00:00 2001 From: Noam Postavsky <npostavs@gmail.com> Date: Tue, 25 Jun 2019 18:57:30 -0400 Subject: ; * lisp/frame.el: Enhance add-variable-watcher commentary. --- lisp/frame.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/frame.el b/lisp/frame.el index 30f6ca91ba6..6dc72669685 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2489,7 +2489,9 @@ See also `toggle-frame-maximized'." (mapc (lambda (var) ;; Using symbol-function here tells the watcher machinery to ;; call the C function set-buffer-redisplay directly, thus - ;; avoiding a potential GC. + ;; avoiding a potential GC. This isn't strictly necessary, + ;; but it's a nice way to exercise the direct subr-calling + ;; machinery. (add-variable-watcher var (symbol-function 'set-buffer-redisplay))) '(line-spacing overline-margin -- cgit v1.2.3 From e62ad04963982ea9cc7622b32484778845bc2ec1 Mon Sep 17 00:00:00 2001 From: Noam Postavsky <npostavs@gmail.com> Date: Sun, 23 Jun 2019 21:27:43 -0400 Subject: Fix sgml-mode handling of quotes within parens (Bug#36347) * lisp/textmodes/sgml-mode.el (sgml-syntax-propertize): Use syntax-ppss-table if set. This is only needed on the release branch, on master the caller (syntax-propertize) already does this. (sgml-mode): Set syntax-ppss-table to sgml-tag-syntax-table. This correctly classifies parens as punctuation, so they won't confuse the parser. * test/lisp/textmodes/sgml-mode-tests.el (sgml-tests--quotes-syntax): New test copied from master, with two cases added for this bug. --- lisp/textmodes/sgml-mode.el | 10 ++++++---- test/lisp/textmodes/sgml-mode-tests.el | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'lisp') diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 128e58810e5..c9724e0e3f7 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -357,10 +357,11 @@ Any terminating `>' or `/' is not matched.") (defun sgml-syntax-propertize (start end) "Syntactic keywords for `sgml-mode'." (goto-char start) - (sgml-syntax-propertize-inside end) - (funcall - (syntax-propertize-rules sgml-syntax-propertize-rules) - start end)) + (with-syntax-table (or syntax-ppss-table (syntax-table)) + (sgml-syntax-propertize-inside end) + (funcall + (syntax-propertize-rules sgml-syntax-propertize-rules) + start end))) (defun sgml-syntax-propertize-inside (end) (let ((ppss (syntax-ppss))) @@ -568,6 +569,7 @@ Do \\[describe-key] on the following bindings to discover what they do. sgml-font-lock-keywords-2) nil t)) (setq-local syntax-propertize-function #'sgml-syntax-propertize) + (setq-local syntax-ppss-table sgml-tag-syntax-table) (setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function) (setq-local sgml-xml-mode (sgml-xml-guess)) (unless sgml-xml-mode diff --git a/test/lisp/textmodes/sgml-mode-tests.el b/test/lisp/textmodes/sgml-mode-tests.el index 7318a667b36..0000b352ff0 100644 --- a/test/lisp/textmodes/sgml-mode-tests.el +++ b/test/lisp/textmodes/sgml-mode-tests.el @@ -130,5 +130,27 @@ The point is set to the beginning of the buffer." (sgml-delete-tag 1) (should (string= "Winter is comin'" (buffer-string))))) +(ert-deftest sgml-tests--quotes-syntax () + (dolist (str '("a\"b <t>c'd</t>" + "a'b <t>c\"d</t>" + "<t>\"a'</t>" + "<t>'a\"</t>" + "<t>\"a'\"</t>" + "<t>'a\"'</t>" + "a\"b <tag>c'd</tag>" + ;;"<tag>c>'d</tag>" Fixed in master. + "<t><!-- \" --></t>" + "<t><!-- ' --></t>" + "<t>(')</t>" + "<t>(\")</t>" + )) + (with-temp-buffer + (sgml-mode) + (insert str) + (ert-info ((format "%S" str) :prefix "Test case: ") + ;; Check that last tag is parsed as a tag. + (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 -- cgit v1.2.3