[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/kotlin-mode f42a0745dd 089/162: Ignores blank lines when f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/kotlin-mode f42a0745dd 089/162: Ignores blank lines when finding indent level |
Date: |
Sat, 29 Jan 2022 08:25:25 -0500 (EST) |
branch: elpa/kotlin-mode
commit f42a0745dd56e168981fdb5c14e96d89ee4a985c
Author: Gregg Hernandez <gregg@lucidchart.com>
Commit: Gregg Hernandez <gregg@lucidchart.com>
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 4aabdd99b9 035/162: kotlin-mode: Highlight constructor/initializer blocks, (continued)
- [nongnu] elpa/kotlin-mode 4aabdd99b9 035/162: kotlin-mode: Highlight constructor/initializer blocks, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode fa8f063a1e 082/162: Merge branch 'gregghz-master', ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode c8bbbb4e5a 001/162: initial commit, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b6bb8de0cf 019/162: kotlin-mode: Define context variables keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 3c9b24eb04 021/162: kotlin-mode: Highlight keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 07908984b1 024/162: kotlin-mode: Define constants keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 6837e4a6b1 026/162: kotlin-mode: Treat `_' as being a valid part of word, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 5415f6e320 028/162: kotlin-mode: Define modifier keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b689626987 070/162: handle } else { lines for indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 37b93116c9 085/162: A couple of corrections to the README., ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode f42a0745dd 089/162: Ignores blank lines when finding indent level,
ELPA Syncer <=
- [nongnu] elpa/kotlin-mode 6a579f6549 092/162: Require cc-cmds to load the definition of c-indent-line-or-region, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b2085f5315 100/162: Put key-binding to README, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 666187a086 110/162: Merge pull request #33 from mikegolod/issue-32, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 3b9b51801a 111/162: auto-enable kt mode for kotlin scripts (e.g. for build.gradle.kts), ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode c7f53d4137 124/162: Save point and mark when sending a block to the interpreter, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 002b5dfc21 136/162: Use an older baseline emacs version in travis, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 0786e24d70 142/162: Merge pull request #44 from taku0/propertise-multiline-strings, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 5898586ac4 146/162: Refactor indentation logic, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 193fcc6e16 003/162: Add kotlin-mode.el, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ec34e8627d 002/162: Cask: Refactor - Sort depends-on, ELPA Syncer, 2022/01/29