From 2963861f3d4070420eeee0791008f3e1c02a0450 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 20 May 2017 22:01:15 -0600 Subject: [PATCH] Fix mhtml-mode fontification bug Bug#26922 * lisp/textmodes/mhtml-mode.el (mhtml-syntax-propertize): Call sgml-syntax-propertize-inside if not in a submode. * test/manual/indent/html-multi-4.html: New file. --- lisp/textmodes/mhtml-mode.el | 18 ++++++++++-------- test/manual/indent/html-multi-4.html | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 test/manual/indent/html-multi-4.html diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el index a0fa8492cf4..2f2257d96bd 100644 --- a/lisp/textmodes/mhtml-mode.el +++ b/lisp/textmodes/mhtml-mode.el @@ -283,14 +283,16 @@ can function properly.") (remove-list-of-text-properties start end '(syntax-table local-map mhtml-submode)) (goto-char start) - (when (and - ;; Don't search in a comment or string - (not (syntax-ppss-context (syntax-ppss))) - ;; Be sure to look back one character, because START won't - ;; yet have been propertized. - (not (bobp))) - (when-let ((submode (get-text-property (1- (point)) 'mhtml-submode))) - (mhtml--syntax-propertize-submode submode end))) + ;; Be sure to look back one character, because START won't yet have + ;; been propertized. + (unless (bobp) + (let ((submode (get-text-property (1- (point)) 'mhtml-submode))) + (if submode + ;; Don't search in a comment or string + (unless (syntax-ppss-context (syntax-ppss)) + (mhtml--syntax-propertize-submode submode end)) + ;; No submode, so do what sgml-mode does. + (sgml-syntax-propertize-inside end)))) (funcall (syntax-propertize-rules ("" diff --git a/test/manual/indent/html-multi-4.html b/test/manual/indent/html-multi-4.html new file mode 100644 index 00000000000..0eb89d17b0d --- /dev/null +++ b/test/manual/indent/html-multi-4.html @@ -0,0 +1,15 @@ + + + + + + +

This is a test.

+ + + -- 2.39.2