diff src/elisp/urweb-mode.el @ 1525:a479947efbcd

Improve detection of XML in urweb-mode; small tutorial improvement
author Adam Chlipala <adam@chlipala.net>
date Tue, 02 Aug 2011 17:28:37 -0400
parents 3c0803c1acd7
children 9c7b79214cae
line wrap: on
line diff
--- a/src/elisp/urweb-mode.el	Tue Aug 02 17:04:14 2011 -0400
+++ b/src/elisp/urweb-mode.el	Tue Aug 02 17:28:37 2011 -0400
@@ -170,7 +170,7 @@
           (finished nil)
           (answer nil)
           )
-      (while (and (not finished) (re-search-backward "[<>{}]" nil t))
+      (while (and (not finished) (re-search-backward "[<{}]" nil t))
         (cond
          ((looking-at "{")
           (if (> depth 0)
@@ -178,29 +178,14 @@
             (setq finished t)))
          ((looking-at "}")
           (incf depth))
-         ((save-excursion (backward-char 1) (or (looking-at "=>")
-                                                (looking-at "->")
-                                                (looking-at "<>")))
-          nil)
-         ((or (looking-at "< ") (looking-at "<="))
-          nil)
-         ((looking-at "<")
-          (setq finished t))
-         ((save-excursion (backward-char 1) (looking-at " >"))
-          nil)
-         ((looking-at ">")
-          (cond
-           ((> depth 0)
-            (if (not (re-search-backward "<" nil t))
-                (setq finished t)))
-           ((save-excursion (backward-char 1) (looking-at " "))
-            (setq finished t))
-           (t
-            (progn (backward-char 4)
-                   (setq answer (not (or
-                                      (looking-at "/xml")
-                                      (looking-at "xml/"))))
-                   (setq finished t)))))))
+         ((looking-at "<xml>")
+          (if (> depth 0)
+              (decf depth)
+            (progn
+              (setq answer t)
+              (setq finished t))))
+         ((looking-at "</xml>")
+          (incf depth))))
       answer)))
 
 (defun amAttribute (face)