[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/kotlin-mode dd24461721 128/162: Add prefix to class method
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/kotlin-mode dd24461721 128/162: Add prefix to class methods |
Date: |
Sat, 29 Jan 2022 08:25:30 -0500 (EST) |
branch: elpa/kotlin-mode
commit dd24461721534d25ae1d937ab6571e883ef1758c
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Add prefix to class methods
Class methods should have prefix.
We should use `cl-setf' rather than `setf'.
---
kotlin-mode.el | 66 +++++++++++++++++++++++++++++++---------------------------
1 file changed, 35 insertions(+), 31 deletions(-)
diff --git a/kotlin-mode.el b/kotlin-mode.el
index e5c7b92373..f81b132517 100644
--- a/kotlin-mode.el
+++ b/kotlin-mode.el
@@ -346,7 +346,7 @@
(defun kotlin-mode--line-continuation()
"Return whether this line continues a statement in the previous line"
(or
- (kotlin-mode--line-begins "\\([\.=:]\\|->\\|[sg]et\\b\\)")
+ (kotlin-mode--line-begins "\\([.=:]\\|->\\|[sg]et\\b\\)")
(save-excursion
(kotlin-mode--prev-line)
(kotlin-mode--line-ends "\\([=:]\\|->\\)"))))
@@ -384,7 +384,8 @@
We scroll backwards until the net-bracket-count is zero, and this point
determines the desired indentation level for the current line.")
-(cl-defmethod count-to-line-start ((counter kotlin-mode--bracket-counter))
+(cl-defmethod kotlin-mode--count-to-line-start
+ ((counter kotlin-mode--bracket-counter))
"Count the brackets on the current line, starting from the cursor
position, and working backward, incrementing the count
+1 for open-brackets, -1 for close-brackets.
@@ -392,17 +393,17 @@
(save-excursion
(while (and (<= (oref counter count) 0) (not (bolp)))
(backward-char)
- (cond ((looking-at "\\s\(")
- (oset counter count (+ (oref counter count) 1)))
- ((looking-at "\\s\)")
- (oset counter count (- (oref counter count) 1)))))
+ (cond ((looking-at "\\s(")
+ (cl-incf (oref counter count)))
+ ((looking-at "\\s)")
+ (cl-decf (oref counter count)))))
(cond
;; If the net-bracket-count is zero, use this indentation
((= (oref counter count) 0)
(oset counter finished t)
(if (oref counter use-base)
- (add-indent counter (kotlin-mode--base-indentation))
- (add-indent counter (current-indentation))))
+ (kotlin-mode--add-indent counter (kotlin-mode--base-indentation))
+ (kotlin-mode--add-indent counter (current-indentation))))
;; If we've now counted more open-brackets than close-brackets,
;; use the indentation of the content immediately following the
;; final open-bracket.
@@ -413,37 +414,40 @@
(skip-syntax-forward "-")
(let (position)
(setq position (point))
- (add-indent counter (- position (re-search-backward "^"))))))))
+ (kotlin-mode--add-indent counter
+ (- position (re-search-backward "^"))))))))
-(cl-defmethod count-leading-close-brackets
+(cl-defmethod kotlin-mode--count-leading-close-brackets
((counter kotlin-mode--bracket-counter))
"Count any close-bracket at the start of the current line."
- (if (looking-at "\\s\)")
+ (if (looking-at "\\s)")
(oset counter use-base nil))
- (subtract-count counter (skip-syntax-forward ")")))
+ (kotlin-mode--subtract-count counter (skip-syntax-forward ")")))
-(cl-defmethod count-trailing-open-brackets
+(cl-defmethod kotlin-mode--count-trailing-open-brackets
((counter kotlin-mode--bracket-counter))
"If the bracket count is at zero, and there are open-brackets at the end
of the line, do not count them, but add a single indentation level."
(if (= (oref counter count) 0)
(cond ((not (= (skip-syntax-backward "(") 0))
- (add-indent counter kotlin-tab-width)
+ (kotlin-mode--add-indent counter kotlin-tab-width)
(oset counter use-base nil)))))
-(cl-defmethod add-count ((counter kotlin-mode--bracket-counter) val)
- (oset counter count (+ (oref counter count) val)))
+(cl-defmethod kotlin-mode--add-count
+ ((counter kotlin-mode--bracket-counter) val)
+ (cl-incf (oref counter count) val))
-(cl-defmethod subtract-count ((counter kotlin-mode--bracket-counter) val)
- (oset counter count (- (oref counter count) val)))
+(cl-defmethod kotlin-mode--subtract-count
+ ((counter kotlin-mode--bracket-counter) val)
+ (cl-decf (oref counter count) val))
-(cl-defmethod add-indent ((counter kotlin-mode--bracket-counter) val)
- (oset counter indent (+ (oref counter indent) val)))
+(cl-defmethod kotlin-mode--add-indent
+ ((counter kotlin-mode--bracket-counter) val)
+ (cl-incf (oref counter indent) val))
-(cl-defmethod finished ((counter kotlin-mode--bracket-counter))
+(cl-defmethod kotlin-mode--finished ((counter kotlin-mode--bracket-counter))
(oref counter finished))
-
(defun kotlin-mode--in-comment-block ()
"Return whether the cursor is within a standard comment block structure
of the following format:
@@ -476,23 +480,23 @@
(let ((bracket-counter (kotlin-mode--bracket-counter)))
(save-excursion
(skip-syntax-forward "-")
- (count-leading-close-brackets bracket-counter))
+ (kotlin-mode--count-leading-close-brackets bracket-counter))
(save-excursion
(progn (kotlin-mode--prev-line) (end-of-line))
- (count-trailing-open-brackets bracket-counter)
- (count-to-line-start bracket-counter)
- (while (and (not (finished bracket-counter)) (not (bobp)))
+ (kotlin-mode--count-trailing-open-brackets bracket-counter)
+ (kotlin-mode--count-to-line-start bracket-counter)
+ (while (and (not (kotlin-mode--finished bracket-counter))
+ (not (bobp)))
(progn (kotlin-mode--prev-line) (end-of-line))
- (count-to-line-start bracket-counter)
- )
- (incf cur-indent (oref bracket-counter indent))))
+ (kotlin-mode--count-to-line-start bracket-counter))
+ (cl-incf cur-indent (oref bracket-counter indent))))
(cond ((kotlin-mode--line-continuation)
;; Add extra indentation if the line continues the previous one
- (incf cur-indent kotlin-tab-width))
+ (cl-incf cur-indent kotlin-tab-width))
((kotlin-mode--in-comment-block)
;; Add one space of extra indentation if inside a comment block
- (incf cur-indent)))
+ (cl-incf cur-indent)))
(if cur-indent
(indent-line-to cur-indent)
- [nongnu] elpa/kotlin-mode 1ed0c5589e 098/162: Merge pull request #22 from russel/master, (continued)
- [nongnu] elpa/kotlin-mode 1ed0c5589e 098/162: Merge pull request #22 from russel/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 8574583b30 105/162: Fix highlighting escaped identifiers in interpolations, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode eb3704e0e2 106/162: Set adaptive-fill-regexp to comment-start-skip, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 77d709ab54 107/162: Merge pull request #30 from CyberShadow/pull-20180624-142858, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode f08724b978 115/162: Improve handling of bracket-based indentation, ELPA Syncer, 2022/01/29
- [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 <=
- [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, 2022/01/29
- [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