Subject: bug#6412: 23.2; [patch] nXML indentation bug

From: Leo <[email-masked]>
Date: Sun, 13 Jun 2010 15:27:27 +0100

Please ignore the patch in previous email (sorry for this). Here is the
correct patch:

>From 3d8a976a0edad1b8e099a108320f60622d168ffb Mon Sep 17 00:00:00 2001
From: Leo <[email-masked]>
Date: Sun, 13 Jun 2010 14:58:47 +0100
Subject: [PATCH] Fix nxml-indent-line to be consistent with other modes (#6412)

Patch sent to http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6412.
---
 lisp/nxml/nxml-mode.el |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 8919d92..5e9fd8c 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -1371,16 +1371,14 @@ of the inserted start-tag or nil if none was inserted."
 (defun nxml-indent-line ()
   "Indent current line as XML."
   (let ((indent (nxml-compute-indent))
-	(from-end (- (point-max) (point))))
-    (when (and indent
-	       (/= indent (current-indentation)))
-      (beginning-of-line)
-      (let ((bol (point)))
-	(skip-chars-forward " \t")
-	(delete-region bol (point)))
-      (indent-to indent)
-      (when (> (- (point-max) from-end) (point))
-	(goto-char (- (point-max) from-end))))))
+	(from-end (- (point-max) (point)))
+	(beg (progn (forward-line 0) (point))))
+    (skip-chars-forward " \t")
+    (when (and indent (/= indent (current-indentation)))
+      (delete-region beg (point))
+      (indent-to indent))
+    (when (> (- (point-max) from-end) (point))
+      (goto-char (- (point-max) from-end)))))
 
 (defun nxml-compute-indent ()
   "Return the indent for the line containing point."
-- 
1.7.0.4

Leo