From edb71c7545a716d90a5662f0bfbc16b2bbac1ee0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 13 May 2020 12:20:05 -0700 Subject: also permit cycling indent of 'where' line Signed-off-by: Sean Whitton --- haskell-tab-indent.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3