changeset 396:040edfade639

Fix XML indenting to ignore comparison operators
author Adam Chlipala <adamc@hcoop.net>
date Tue, 21 Oct 2008 11:39:13 -0400
parents 9f67aac13cf7
children 4d519baf357c
files src/elisp/urweb-mode.el src/elisp/urweb-move.el
diffstat 2 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/elisp/urweb-mode.el	Tue Oct 21 11:22:10 2008 -0400
+++ b/src/elisp/urweb-mode.el	Tue Oct 21 11:39:13 2008 -0400
@@ -503,14 +503,18 @@
       (urweb-seek-back)
       (beginning-of-line)
       (while (and (not done) (search-forward "<" start-pos t))
-        (if (looking-at "/")
-          (if (search-forward ">" start-pos t)
+        (cond
+         ((or (looking-at " ") (looking-at "="))
+          nil)
+         ((looking-at "/")
+          (if (re-search-forward "[^\\sw]>" start-pos t)
               (when (> depth 0) (decf depth))
-            (setq done t))
-          (if (search-forward ">" start-pos t)
+            (setq done t)))
+         (t
+          (if (re-search-forward "[^\\sw]>" start-pos t)
               (if (not (save-excursion (backward-char 2) (looking-at "/")))
                   (incf depth))
-            (setq done t))))
+            (setq done t)))))
       (and (not done) (> depth 0)))))
 
 (defun urweb-tag-matching-indent ()
--- a/src/elisp/urweb-move.el	Tue Oct 21 11:22:10 2008 -0400
+++ b/src/elisp/urweb-move.el	Tue Oct 21 11:39:13 2008 -0400
@@ -240,16 +240,20 @@
   (let ((depth 0)
         (done nil))
     (while (and (not done) (search-backward ">" nil t))
-      (if (save-excursion (backward-char 1) (looking-at "/"))
-          (when (not (search-backward "<" nil t))
-            (setq done t))
-        (if (search-backward "<" nil t)
+      (cond
+       ((save-excursion (backward-char 1) (looking-at " "))
+        nil)
+       ((save-excursion (backward-char 1) (looking-at "/"))
+        (when (not (re-search-backward "<[^ =]" nil t))
+          (setq done t)))
+       (t
+        (if (re-search-backward "<[^ =]" nil t)
             (if (looking-at "</")
                 (incf depth)
               (if (= depth 0)
                   (setq done t)
                 (decf depth)))
-          (setq done t))))))
+          (setq done t)))))))
 
 (defun urweb-backward-sexp (prec)
   "Move one sexp backward if possible, or one char else.