emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode a227f7e 200/385: blank lines end a run of


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode a227f7e 200/385: blank lines end a run of type definitions
Date: Tue, 5 Oct 2021 23:59:31 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit a227f7eb401ed3dc1f1deae5d70357afccae9ed9
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    blank lines end a run of type definitions
---
 haskell-tng-smie.el                            | 9 ++++++++-
 test/src/indentation-options1.hs.append.indent | 2 +-
 test/src/indentation-options2.hs.append.indent | 4 ++--
 test/src/indentation.hs.append.indent          | 6 +++---
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 081b7f4..b0c6937 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -260,7 +260,8 @@ information, to aid in the creation of new rules."
             "|")
 
            ((and (member parent '("::" "=>"))
-                 (< (--count (equal it "=>") prevline) 2))
+                 (< (--count (equal it "=>") prevline) 2)
+                 (not (haskell-tng--smie-prev-line-blank-p)))
             "=>")
 
            ((haskell-tng--smie-search-prev-line
@@ -509,6 +510,12 @@ Inspired by `smie-indent--parent', which can only be used 
in
     (beginning-of-line)
     (re-search-forward regexp (line-end-position) t)))
 
+(defun haskell-tng--smie-prev-line-blank-p ()
+  "t if the previous line is blank, not even comments or whitespace."
+  (save-excursion
+    (forward-line -1)
+    (= (line-beginning-position) (line-end-position))))
+
 ;; TODO smie-powered non-indentation features, e.g. sort-list
 
 ;; SMIE wishlist, in order of desirability:
diff --git a/test/src/indentation-options1.hs.append.indent 
b/test/src/indentation-options1.hs.append.indent
index 841deb0..a00ae6e 100644
--- a/test/src/indentation-options1.hs.append.indent
+++ b/test/src/indentation-options1.hs.append.indent
@@ -15,4 +15,4 @@ types4 ::
   -> c
 1 v2
 
-1 v2
\ No newline at end of file
+v 12
\ No newline at end of file
diff --git a/test/src/indentation-options2.hs.append.indent 
b/test/src/indentation-options2.hs.append.indent
index 8b50cd8..4b0dc8b 100644
--- a/test/src/indentation-options2.hs.append.indent
+++ b/test/src/indentation-options2.hs.append.indent
@@ -15,7 +15,7 @@ types5 :: Monad m
        -> c
 1      v
 
-1      v
+v      1
 types6 ::
 1       v
         ( Monad m )
@@ -27,4 +27,4 @@ types6 ::
        -> c
 1      v2
 
-1      v2
\ No newline at end of file
+v      12
\ No newline at end of file
diff --git a/test/src/indentation.hs.append.indent 
b/test/src/indentation.hs.append.indent
index 14ee722..b039658 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -261,7 +261,7 @@ types1 ::
   -> c
 1 v  2
 
-1 v  2
+v 1  2
 types2 :: (Monad m, MemberLogger m)
 1 v
   => a
@@ -271,7 +271,7 @@ types2 :: (Monad m, MemberLogger m)
   -> c
 1 v
 
-1 v
+v 1
 types2b
 1 v
   :: (Monad m, MemberLogger m)
@@ -283,7 +283,7 @@ types2b
   -> c
 1 v
 
-1 v
+v 1
 types3 :: (Monad m, MonadReader Foo m) =>
 1         v
           (?log :: HasLogger m) =>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]