diff options
author | Tom Tromey <tom@tromey.com> | 2017-05-20 22:01:15 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-05-20 22:01:56 -0600 |
commit | 2963861f3d4070420eeee0791008f3e1c02a0450 (patch) | |
tree | cc6f9cbafbaf376fd75efe771eed29039268ba1a | |
parent | f422b46eb1d3c62c912ee0806486d017f5153e54 (diff) | |
download | emacs-2963861f3d4070420eeee0791008f3e1c02a0450.tar.gz emacs-2963861f3d4070420eeee0791008f3e1c02a0450.tar.bz2 emacs-2963861f3d4070420eeee0791008f3e1c02a0450.zip |
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.
-rw-r--r-- | lisp/textmodes/mhtml-mode.el | 18 | ||||
-rw-r--r-- | test/manual/indent/html-multi-4.html | 15 |
2 files changed, 25 insertions, 8 deletions
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 ("<style.*?>" 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 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + </head> + <body> + <p>This is a test.</p> + </body> + <script> + if (x) { + y; + } + </script> +</html> |