emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2963861: Fix mhtml-mode fontification bug


From: Tom Tromey
Subject: [Emacs-diffs] master 2963861: Fix mhtml-mode fontification bug
Date: Sun, 21 May 2017 00:02:40 -0400 (EDT)

branch: master
commit 2963861f3d4070420eeee0791008f3e1c02a0450
Author: Tom Tromey <address@hidden>
Commit: Tom Tromey <address@hidden>

    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(-)

diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index a0fa849..2f2257d 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 0000000..0eb89d1
--- /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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]