         (cond
          ((looking-at "{")
           (if (> depth 0)
-              (setq depth (- depth 1))
+              (decf depth)
             (setq finished t)))
          ((looking-at "}")
-          (setq depth (+ depth 1)))
+          (incf depth))
          ((save-excursion (backward-char 1) (or (looking-at "=>") (looking-at "->")))
           nil)
          ((looking-at "<")

    ("\\(</\\sw+>\\)"
     (1 font-lock-tag-face))
    ("\\([^<>{}]+\\)"
     (1 (if (inXml)
            font-lock-string-face
          nil)))


	  (1+ (current-column))
	nil))))

(defun urweb-new-tags ()
  "Decide if the previous line of XML introduced unclosed tags"
  (save-excursion
    (let ((start-pos (point))
          (depth 0)
          (done nil))
      (previous-line 1)
      (beginning-of-line)
      (while (and (not done) (search-forward "<" start-pos t))
        (if (looking-at "/")
          (if (search-forward ">" start-pos t)
              (when (> depth 0) (decf depth))
            (setq done t))
          (if (search-forward ">" start-pos t)
              (if (not (save-excursion (backward-char 2) (looking-at "/")))
                  (incf depth))
            (setq done t))))
      (and (not done) (> depth 0)))))

(defun urweb-tag-matching-indent ()
  "Seek back to a matching opener tag and get its line's indent"
  (save-excursion
    (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)
              (if (looking-at "</")
                  (incf depth)
                (if (= depth 0)
                    (setq done t)
                  (decf depth)))
            (setq done t))))
      (current-indentation))))

(defun urweb-calculate-indentation ()
  (save-excursion
    (beginning-of-line) (skip-chars-forward "\t ")
