[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/kotlin-mode 1f60b01659 148/162: Fix indentation of multili
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/kotlin-mode 1f60b01659 148/162: Fix indentation of multiline comment at the beginning of buffer |
Date: |
Sat, 29 Jan 2022 08:25:31 -0500 (EST) |
branch: elpa/kotlin-mode
commit 1f60b0165972df8cef46ed8409bf06d0c0ff425e
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Fix indentation of multiline comment at the beginning of buffer
Example:
/*
* aaa
* bbb
* ccc
*/
---
kotlin-mode.el | 18 +++++++++++-------
test/kotlin-mode-test.el | 29 +++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/kotlin-mode.el b/kotlin-mode.el
index 0c31e91dbd..adf5cc5497 100644
--- a/kotlin-mode.el
+++ b/kotlin-mode.el
@@ -148,8 +148,9 @@
;; b-style comment
(modify-syntax-entry ?/ ". 124b" st)
- (modify-syntax-entry ?* ". 23" st)
+ (modify-syntax-entry ?* ". 23n" st)
(modify-syntax-entry ?\n "> b" st)
+ (modify-syntax-entry ?\r "> b" st)
st))
@@ -537,20 +538,23 @@ fun foo() {
of the following format:
/**
* Description here
- */ "
+ */"
(save-excursion
(let ((in-comment-block nil)
- (keep-going (not (kotlin-mode--line-ends "\\*\\*/"))))
+ (keep-going (and
+ (not (kotlin-mode--line-begins "\\*\\*+/"))
+ (not (kotlin-mode--line-begins "/\\*"))
+ (nth 4 (syntax-ppss)))))
(while keep-going
(kotlin-mode--prev-line)
(cond
+ ((kotlin-mode--line-begins "/\\*")
+ (setq keep-going nil)
+ (setq in-comment-block t))
((bobp)
(setq keep-going nil))
((kotlin-mode--line-contains "\\*/")
- (setq keep-going nil))
- ((kotlin-mode--line-begins "/\\*")
- (setq keep-going nil)
- (setq in-comment-block t))))
+ (setq keep-going nil))))
in-comment-block)))
(defun kotlin-mode--indent-line ()
diff --git a/test/kotlin-mode-test.el b/test/kotlin-mode-test.el
index bbb39e504d..fe96b6218a 100644
--- a/test/kotlin-mode-test.el
+++ b/test/kotlin-mode-test.el
@@ -117,6 +117,35 @@ return a + b
(kotlin-mode--indent-line)
(should (equal text (buffer-string))))))
+(ert-deftest kotlin-mode--indent-comment-at-bob--test ()
+ (with-temp-buffer
+ (let ((text "/*
+ *
+ *
+ */"))
+ (pop-to-buffer (current-buffer))
+ (insert text)
+ (goto-char (point-min))
+ (kotlin-mode)
+ (setq-local indent-tabs-mode nil)
+ (setq-local tab-width 4)
+ (setq-local kotlin-tab-width 4)
+
+ (kotlin-mode--indent-line)
+ (should (equal text (buffer-string)))
+
+ (forward-line)
+ (kotlin-mode--indent-line)
+ (should (equal text (buffer-string)))
+
+ (forward-line)
+ (kotlin-mode--indent-line)
+ (should (equal text (buffer-string)))
+
+ (forward-line)
+ (kotlin-mode--indent-line)
+ (should (equal text (buffer-string))))))
+
(defun next-non-empty-line ()
"Moves to the next non-empty line"
(forward-line)
- [nongnu] elpa/kotlin-mode 9fa0d75997 119/162: Tidy up bracked-based indentation into a class, and fix bugs, (continued)
- [nongnu] elpa/kotlin-mode 9fa0d75997 119/162: Tidy up bracked-based indentation into a class, and fix bugs, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 76921927de 117/162: Add a test for correct indentation of sample.kt, and get it to pass (with a few tweaks), ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 511e0a4ee3 121/162: Add in more kotlin keywords and indent get/set methods for properties, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 21ae667561 126/162: Add highlighted keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b2d5ff65fc 125/162: Highlight single quotes and back quotes, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode dd24461721 128/162: Add prefix to class methods, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 6aa6d56c0a 131/162: Merge pull request #42 from taku0/add_keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 2f8a57ba64 138/162: Comment out failing emacs versions and link associated bugs, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 3062e14ac0 140/162: Merge pull request #47 from Emacs-Kotlin-Mode-Maintainers/emacs-version-test, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode d8d6461395 145/162: Fix warnings in tests, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 1f60b01659 148/162: Fix indentation of multiline comment at the beginning of buffer,
ELPA Syncer <=
- [nongnu] elpa/kotlin-mode 9fba76ff2b 155/162: Fix highlighting of backquotes, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 3e0c34087b 162/162: Merge pull request #61 from taku0/make_underbar_symbol, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode cbeeef8986 015/162: kotlin-mode: Define type declaration keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode c6207be613 038/162: kotlin-mode: Add kotin-mode--syntax-propertize-function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 78db8656d4 047/162: Fixed font lock for types, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 1624e7d795 052/162: add 'nested' and 'inner' class modifiers, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 4787bf94c1 058/162: Ignore dist folder produce by `cask package`, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode d4e97ffa4b 095/162: Switch from using a Bash script to using Make for the tests. Though 'cask exec eert-runner' also works to run the tests., ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b86f9b4607 147/162: Fix indentation after comment containing close brackets, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode fe905c587a 023/162: kotlin-mode: Highlight classes/enums, ELPA Syncer, 2022/01/29