]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix mhtml-mode fontification bug
authorTom Tromey <tom@tromey.com>
Sun, 21 May 2017 04:01:15 +0000 (22:01 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 21 May 2017 04:01:56 +0000 (22:01 -0600)
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
test/manual/indent/html-multi-4.html [new file with mode: 0644]

index a0fa8492cf4b6611014de98ecb843d1c177f78cb..2f2257d96bdb818a4121818b0bddebc487e87c7f 100644 (file)
@@ -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 (file)
index 0000000..0eb89d1
--- /dev/null
@@ -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>