summaryrefslogtreecommitdiff
path: root/src/elisp
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-16 13:01:24 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-16 13:01:24 -0400
commit9606800a1155d95849a2bdaa18aff4daddcdf797 (patch)
tree5eedea9b7ef8ca186b6c4eb72c233d0ea2bba793 /src/elisp
parent6b2f6872140b7ba1c5d153eba2ede2b91f8850d6 (diff)
Special case indenting for <xml>...</xml>
Diffstat (limited to 'src/elisp')
-rw-r--r--src/elisp/urweb-mode.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el
index 5a673d23..86c39d96 100644
--- a/src/elisp/urweb-mode.el
+++ b/src/elisp/urweb-mode.el
@@ -452,6 +452,13 @@ If anyone has a good algorithm for this..."
(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 @@ If anyone has a good algorithm for this..."
(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 @@ If anyone has a good algorithm for this..."
(cond
((looking-at "</")
(urweb-tag-matching-indent))
+ ((urweb-begun-xml)
+ (+ prev-indent 4))
((urweb-new-tags)
(+ prev-indent 2))
(t