(savep (save-excursion (indent-line-to indent)))
(t (indent-line-to indent)))))
+(defun until-closed (level)
+ (if
+ (re-search-backward "\\_<\\(with\\|where\\|begin\\|end\\)\\_>"
+ nil t)
+ (cond
+ ((string= (match-string 0) "end")
+ (until-closed (+ level 1)))
+ ((= level 0)
+ (current-indentation))
+ (t
+ (until-closed (- level 1))))
+
+ nil))
+
(defun domtool-calculate-indent ()
(save-excursion
(back-to-indentation)
(multiple-value-bind (previous-keyword base-indent)
(save-excursion
- (if (re-search-backward "\\_<\\(with\\|where\\|end\\)\\_>"
+ (if (re-search-backward "\\_<\\(with\\|where\\|begin\\|end\\)\\_>"
nil t)
(values (match-string 0) (current-indentation))
(values nil 0)))
'noindent)
((nth 4 state)
(domtool-calculate-comment-indent state))
- ((and (looking-at "\\_<end\\_>")
- (string= previous-keyword "end"))
- (- base-indent domtool-indent))
((looking-at "\\_<\\(with\\|end\\)\\_>")
- base-indent)
+ (until-closed 0))
((not previous-keyword)
base-indent)
((string= previous-keyword "end")