X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/6f0cf3a6bbfdb359f6c8b1e1c218a626eba7bb5f..621629dc64ea614907eb1f9b77e3288d8dbd299f:/elisp/domtool-mode.el diff --git a/elisp/domtool-mode.el b/elisp/domtool-mode.el index db93b74..17c90c5 100644 --- a/elisp/domtool-mode.el +++ b/elisp/domtool-mode.el @@ -83,8 +83,8 @@ . domtool-font-lock-syntactic-keywords) (font-lock-syntactic-face-function . domtool-font-lock-syntactic-face-function))) - (set (make-local-variable 'comment-start) "(* ") - (set (make-local-variable 'comment-end) " *)") + (set (make-local-variable 'comment-start-regexp) "(\\*\\|{{") + (set (make-local-variable 'comment-end-regexp) "\\*)\\|}}") (set (make-local-variable 'comment-nested) t) (set (make-local-variable 'compile-command) @@ -107,6 +107,12 @@ (until-closed-helper (+ level 1))) ((= level 0) (current-indentation)) + ((and + (string= (match-string 0) "with") + (save-excursion + (backward-char) + (looking-at "\\s-"))) + (until-closed-helper level)) (t (until-closed-helper (- level 1)))) @@ -121,7 +127,7 @@ (back-to-indentation) (multiple-value-bind (previous-keyword base-indent) (save-excursion - (if (re-search-backward "\\_<\\(with\\|where\\|begin\\|end\\|let\\|in\\|val\\|type\\|if\\)\\_>" + (if (re-search-backward "\\_<\\(with\\|where\\|begin\\|end\\|let\\|in\\|val\\|type\\|if\\)\\_>\\|}}\\|{{" nil t) (values (match-string 0) (current-indentation)) (values nil 0))) @@ -131,12 +137,16 @@ 'noindent) ((nth 4 state) (domtool-calculate-comment-indent state)) + ((looking-at "{{\\|\\_<\\(extern\\|val\\|type\\|context\\)\\_>") + 0) ((looking-at "\\_<\\(with\\|end\\|in\\|else\\)\\_>") (until-closed)) ((not previous-keyword) base-indent) ((string= previous-keyword "end") base-indent) + ((looking-at "\\_<\\(val\\|extern\\|context\\)\\_>") + base-indent) (t (+ base-indent domtool-indent)))))))