changeset 105755:cc6727b235b0

* nxml/nxml-mode.el (nxml-balanced-close-start-tag): Use the value of xmltok-start before the end tag was inserted (Bug#2840).
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 24 Oct 2009 21:32:19 +0000
parents 2313ef258869
children aea3ed6946e4
files lisp/ChangeLog lisp/nxml/nxml-mode.el
diffstat 2 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Oct 24 21:31:16 2009 +0000
+++ b/lisp/ChangeLog	Sat Oct 24 21:32:19 2009 +0000
@@ -1,5 +1,8 @@
 2009-10-24  Chong Yidong  <cyd@stupidchicken.com>
 
+	* nxml/nxml-mode.el (nxml-balanced-close-start-tag): Use the value
+	of xmltok-start before the end tag was inserted (Bug#2840).
+
 	* progmodes/sh-script.el (sh-font-lock-paren): Handle case
 	patterns that are preceded by an open-paren (Bug#1320).
 
--- a/lisp/nxml/nxml-mode.el	Sat Oct 24 21:31:16 2009 +0000
+++ b/lisp/nxml/nxml-mode.el	Sat Oct 24 21:32:19 2009 +0000
@@ -1254,29 +1254,31 @@
 
 (defun nxml-balanced-close-start-tag (block-or-inline)
   (let ((token-end (nxml-token-before))
-	(pos (1+ (point))))
+	(pos (1+ (point)))
+	(token-start xmltok-start))
     (unless (or (eq xmltok-type 'partial-start-tag)
 		(and (memq xmltok-type '(start-tag
 					 empty-element
 					 partial-empty-element))
 		     (>= token-end pos)))
       (error "Not in a start-tag"))
+    ;; Note that this insertion changes xmltok-start.
     (insert "></"
 	    (buffer-substring-no-properties (+ xmltok-start 1)
 					    (min xmltok-name-end (point)))
 	    ">")
     (if (eq block-or-inline 'inline)
 	(goto-char pos)
-      (goto-char xmltok-start)
+      (goto-char token-start)
       (back-to-indentation)
-      (if (= (point) xmltok-start)
+      (if (= (point) token-start)
 	  (let ((indent (current-column)))
-	  (goto-char pos)
-	  (insert "\n")
-	  (indent-line-to indent)
-	  (goto-char pos)
-	  (insert "\n")
-	  (indent-line-to (+ nxml-child-indent indent)))
+	    (goto-char pos)
+	    (insert "\n")
+	    (indent-line-to indent)
+	    (goto-char pos)
+	    (insert "\n")
+	    (indent-line-to (+ nxml-child-indent indent)))
 	(goto-char pos)))))
 
 (defun nxml-finish-element ()