aboutsummaryrefslogtreecommitdiffhomepage
path: root/haskell-tab-indent.el
diff options
context:
space:
mode:
Diffstat (limited to 'haskell-tab-indent.el')
-rw-r--r--haskell-tab-indent.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/haskell-tab-indent.el b/haskell-tab-indent.el
index ee07510..fe0badc 100644
--- a/haskell-tab-indent.el
+++ b/haskell-tab-indent.el
@@ -83,7 +83,16 @@
(back-to-indentation)
(let ((indent (cond
((looking-at "where$")
- (concat (tabs prev-line-tabs) " "))
+ ;; if user explicitly requested an indent
+ ;; change, cycle indentation of the where
+ ;; clause, but no deeper than the level of the
+ ;; previous line. Otherwise, just ensure it's
+ ;; preceded by two spaces
+ (if (eq this-command 'indent-for-tab-command)
+ (if (>= this-line-tabs prev-line-tabs)
+ " "
+ (concat (tabs (1+ this-line-tabs)) " "))
+ (concat (tabs this-line-tabs) " ")))
;; if the previous line is a declaration, then
;; this line should be either empty, or at the
;; same indent level as that declaration