aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-05-13 12:20:05 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-05-13 12:20:05 -0700
commitedb71c7545a716d90a5662f0bfbc16b2bbac1ee0 (patch)
tree32d45711e8ef526b45c8cec95368e543e5498abd
parent492c1dd2e83a65911e07a1f759d798521b0f227d (diff)
downloadhaskell-tab-indent-edb71c7545a716d90a5662f0bfbc16b2bbac1ee0.tar.gz
also permit cycling indent of 'where' line
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-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