changeset 365:dda8f3c6ae7c

Special case indenting for <xml>...</xml>
author Adam Chlipala <adamc@hcoop.net>
date Thu, 16 Oct 2008 13:01:24 -0400
parents 7c58dc323683
children 3004f8843e36
files src/elisp/urweb-mode.el
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/elisp/urweb-mode.el	Thu Oct 16 12:55:16 2008 -0400
+++ b/src/elisp/urweb-mode.el	Thu Oct 16 13:01:24 2008 -0400
@@ -452,6 +452,13 @@
 	  (1+ (current-column))
 	nil))))
 
+(defun urweb-begun-xml ()
+  "Check if this is the first new line in a new <xml>...</xml> section"
+  (save-excursion
+    (let ((start-pos (point)))
+      (previous-line 1)
+      (search-forward "<xml>" start-pos t))))
+
 (defun urweb-new-tags ()
   "Decide if the previous line of XML introduced unclosed tags"
   (save-excursion
@@ -487,7 +494,9 @@
                     (setq done t)
                   (decf depth)))
             (setq done t))))
-      (current-indentation))))
+      (if (looking-at "<xml")
+          (+ (current-indentation) 2)
+        (current-indentation)))))
 
 (defun urweb-calculate-indentation ()
   (save-excursion
@@ -517,6 +526,8 @@
                (cond
                 ((looking-at "</")
                  (urweb-tag-matching-indent))
+                ((urweb-begun-xml)
+                 (+ prev-indent 4))
                 ((urweb-new-tags)
                  (+ prev-indent 2))
                 (t