summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-21 11:39:13 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-21 11:39:13 -0400
commitcd8ba90217f6ed7efbf4882b4dcd8e199e510fbb (patch)
tree0c6bdc68f56009acf6cc857ffdcfe705d65760d3 /src
parentc4631a8e9c0b2eb95e99f89357858f771578178a (diff)
Fix XML indenting to ignore comparison operators
Diffstat (limited to 'src')
-rw-r--r--src/elisp/urweb-mode.el14
-rw-r--r--src/elisp/urweb-move.el14
2 files changed, 18 insertions, 10 deletions
diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el
index f8dbc0e3..8c016e3d 100644
--- a/src/elisp/urweb-mode.el
+++ b/src/elisp/urweb-mode.el
@@ -503,14 +503,18 @@ If anyone has a good algorithm for this..."
(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 ()
diff --git a/src/elisp/urweb-move.el b/src/elisp/urweb-move.el
index 5e4e6824..55c6bce6 100644
--- a/src/elisp/urweb-move.el
+++ b/src/elisp/urweb-move.el
@@ -240,16 +240,20 @@ This assumes that we are `looking-at' the OP."
(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.