[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/kotlin-mode ea5f378e40 129/162: Merge pull request #43 fro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/kotlin-mode ea5f378e40 129/162: Merge pull request #43 from taku0/add-prefix-to-methods |
Date: |
Sat, 29 Jan 2022 08:25:30 -0500 (EST) |
branch: elpa/kotlin-mode
commit ea5f378e40d9e0f244f3b9a247fa2239f5364d03
Merge: d6720fe9bc dd24461721
Author: Gregg Hernandez <greggory.hz@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #43 from taku0/add-prefix-to-methods
Add prefix to class methods
---
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 82db4dce0c 077/162: basic indentation test, (continued)
- [nongnu] elpa/kotlin-mode 82db4dce0c 077/162: basic indentation test, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 49ef724e96 076/162: additional keywords and smarter highlighting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 257647d5d6 083/162: handle chained method calls on multiple lines, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode e1540a5ddf 087/162: Merge pull request #10 from gregghz/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ad16798e02 091/162: Set proper indentation for closing brackets preceded by a blank line, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ebcf6f3730 102/162: switch to tab-width, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 1b6d311168 108/162: Merge pull request #31 from jojojames/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 734b08408c 103/162: Add send-{block, buffer, line, region}-and-focus functions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 472ae23d6a 113/162: Fix syntax highlighting of star-projected types, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 002dd1497c 112/162: Merge pull request #36 from mikegolod/issue-35, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode ea5f378e40 129/162: Merge pull request #43 from taku0/add-prefix-to-methods,
ELPA Syncer <=
- [nongnu] elpa/kotlin-mode b4b575ce3a 130/162: Merge pull request #41 from ppareit/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 5dbf5dbf5f 132/162: Add *~ to .gitignore, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode e8100a9070 137/162: Adds more emacs versions to test matrix, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 29730e7908 153/162: Add Makefile, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 5d2d7b4f5a 157/162: Make underscore and at sign as a part of a symbol, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 613539eedc 042/162: Fix trailing parentheses, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode b4b1ace8cc 043/162: In kotlin-mode.el: (c) -> ©, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 9762ca895d 050/162: The characters '?' and '!' are now font-locked properly in types, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 8910b4bf55 054/162: Add "as" to set of statement keywords, ELPA Syncer, 2022/01/29
- [nongnu] elpa/kotlin-mode 4aef379a2a 062/162: Removed rx dependency from Caskfile, ELPA Syncer, 2022/01/29