Subject: bug#6622: [PATCH] 23.2; nxml-mode Indentation Behavior

From: Geoff Gole <[email-masked]>
Date: Wed, 14 Jul 2010 11:51:56 +0800

We discussed a workaround on #emacs already. But in case somebody else
has this bug, this might help:

(defadvice nxml-electric-slash (after indentation-bug-workaround activate)
  ;; fixme - workaround for indentation bug, remove once fixed
  (funcall indent-line-function))

And here's a patch:

*** /usr/local/share/emacs/23.2/lisp/nxml/nxml-mode.el.gz
--- /tmp/buffer-content-33187GX
*************** on the line, reindent the line."
*** 1212,1218 ****
                          (eq (point) (1- slash-pos)))))
     (self-insert-command (prefix-numeric-value arg))
     (unless arg
!       (if nxml-slash-auto-complete-flag
         (if end-tag-p
             (condition-case err
                 (let ((start-tag-end
--- 1212,1218 ----
                          (eq (point) (1- slash-pos)))))
     (self-insert-command (prefix-numeric-value arg))
     (unless arg
!       (when nxml-slash-auto-complete-flag
         (if end-tag-p
             (condition-case err
                 (let ((start-tag-end
*************** on the line, reindent the line."
*** 1232,1240 ****
               (nxml-scan-error nil))
           (when (and (eq (nxml-token-before) (point))
                      (eq xmltok-type 'partial-empty-element))
!             (insert ">")))
       (when (and end-tag-p at-indentation)
!         (nxml-indent-line))))))

 (defun nxml-balanced-close-start-tag-block ()
   "Close the start-tag before point with `>' and insert a balancing end-tag.
--- 1232,1240 ----
               (nxml-scan-error nil))
           (when (and (eq (nxml-token-before) (point))
                      (eq xmltok-type 'partial-empty-element))
!             (insert ">"))))
       (when (and end-tag-p at-indentation)
!         (nxml-indent-line)))))

 (defun nxml-balanced-close-start-tag-block ()
   "Close the start-tag before point with `>' and insert a balancing end-tag.