[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/kotlin-mode 9e2e4c11fe 090/162: Merge pull request #13 fro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/kotlin-mode 9e2e4c11fe 090/162: Merge pull request #13 from gregghz/whitespace-indent |
Date: |
Sat, 29 Jan 2022 08:25:25 -0500 (EST) |
branch: elpa/kotlin-mode
commit 9e2e4c11fe3a9e8f63ce351762a2b1ac5dbe8a75
Merge: f54da34b3f f42a0745dd
Author: Gregg Hernandez <greggory.hz@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #13 from gregghz/whitespace-indent
Ignores blank lines when finding indent level
---
kotlin-mode.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/kotlin-mode.el b/kotlin-mode.el
index 4f67c027b3..006379cc31 100644
--- a/kotlin-mode.el
+++ b/kotlin-mode.el
@@ -225,6 +225,14 @@
t)
(kotlin-mode--match-interpolation limit))))))
+(defun kotlin-mode--prev-line ()
+ "Moves up to the nearest non-empty line"
+ (if (not (bobp))
+ (progn
+ (forward-line -1)
+ (while (and (looking-at "^[ \t]*$") (not (bobp)))
+ (forward-line -1)))))
+
(defun kotlin-mode--indent-line ()
"Indent current line as kotlin code"
(interactive)
@@ -235,7 +243,7 @@
(let ((not-indented t) cur-indent)
(cond ((looking-at "^[ \t]*\\.")
(save-excursion
- (forward-line -1)
+ (kotlin-mode--prev-line)
(cond ((looking-at "^[ \t]*\\.")
(setq cur-indent (current-indentation)))
@@ -246,16 +254,16 @@
((looking-at "^[ \t]*}")
(save-excursion
- (forward-line -1)
+ (kotlin-mode--prev-line)
(while (and (looking-at "^[ \t]*\\.") (not (bobp)))
- (forward-line -1))
+ (kotlin-mode--prev-line))
(setq cur-indent (- (current-indentation) kotlin-tab-width)))
(if (< cur-indent 0)
(setq cur-indent 0)))
((looking-at "^[ \t]*)")
(save-excursion
- (forward-line -1)
+ (kotlin-mode--prev-line)
(setq cur-indent (- (current-indentation) (* 2
kotlin-tab-width))))
(if (< cur-indent 0)
(setq cur-indent 0)))
@@ -263,7 +271,7 @@
(t
(save-excursion
(while not-indented
- (forward-line -1)
+ (kotlin-mode--prev-line)
(cond ((looking-at ".*{[ \t]*$") ; 4.)
(setq cur-indent (+ (current-indentation)
kotlin-tab-width))
(setq not-indented nil))
- [nongnu] elpa/kotlin-mode 0c7ca08d99 018/162: kotlin-mode: Define statement keywords, (continued)
- [nongnu] elpa/kotlin-mode 0c7ca08d99 018/162: kotlin-mode: Define statement keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode d801f5c5cf 020/162: kotlin-mode: Define keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode d2436b8763 013/162: Cask: Use rx, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 56cfb15910 029/162: kotlin-mode: Highlight function names, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 6cfa5b71cf 032/162: kotlin-mode: Define property keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 70d36a45c9 051/162: Add comment syntax, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ffd69308ab 056/162: Handle all typedecl keywords the same way, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 04aa6eab91 068/162: handles parens while indenting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 81b869a98c 075/162: consistent naming, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 34d89566b4 084/162: First stab at a README., ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 9e2e4c11fe 090/162: Merge pull request #13 from gregghz/whitespace-indent,
ELPA Syncer <=
- [nongnu] elpa/kotlin-mode a2c2628d55 104/162: Merge pull request #27 from trevorsummerssmith/more-focus, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 5d83221994 109/162: 1x indent inside parenthesis, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 41eaed3e38 116/162: Remove overwritten <tab> key mapping so that region indentation works, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 5e9aff2ae9 122/162: Fix tests to run in the expected test environment., ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 7de9cc101a 133/162: Add *.elc to .gitignore, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 42fa1402a1 150/162: Merge pull request #49 from taku0/fix-warnings, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 0e4bafb31d 156/162: Merge pull request #57 from taku0/fix-backquote, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 3b10a6a97f 030/162: kotlin-mode: Highlight modifier, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 34947b6b35 045/162: Added 'data class' as a keyword, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b2c51ab7ba 057/162: Merge pull request #2 from gergoerdi/master, ELPA Syncer, 2022/01/29