[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode e3cb72b 360/496: Fix `swift-mode:forward-sexp`
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode e3cb72b 360/496: Fix `swift-mode:forward-sexp` for `up-list` and `down-list` |
Date: |
Sun, 29 Aug 2021 11:34:07 -0400 (EDT) |
branch: elpa/swift-mode
commit e3cb72b0ebdd4cf7e08b8188b692fbec17c8e90b
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Fix `swift-mode:forward-sexp` for `up-list` and `down-list`
---
swift-mode.el | 39 +++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index 224e3d4..3ba9ff3 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -84,16 +84,43 @@ See `forward-sexp for ARG."
(setq arg (or arg 1))
(if (< 0 arg)
(while (< 0 arg)
- (while (eq
- (swift-mode:token:type (swift-mode:forward-token-or-list))
- 'implicit-\;))
+ (while (eq (swift-mode:token:type (swift-mode:forward-sexp-1))
+ 'implicit-\;))
(setq arg (1- arg))))
(while (< arg 0)
- (while (eq
- (swift-mode:token:type (swift-mode:backward-token-or-list))
- 'implicit-\;))
+ (while (eq (swift-mode:token:type (swift-mode:backward-sexp-1))
+ 'implicit-\;))
(setq arg (1+ arg))))
+(defun swift-mode:forward-sexp-1 ()
+ "Move forward a token or list.
+
+Signal `scan-error' if it hits closing parentheses."
+ (let ((token (swift-mode:forward-token-or-list))
+ (pos (point)))
+ (when (memq (swift-mode:token:type token) '(\] \) }))
+ (goto-char pos)
+ (signal 'scan-error
+ (list "Unbalanced parentheses"
+ (swift-mode:token:start token)
+ (swift-mode:token:end token))))
+ token))
+
+(defun swift-mode:backward-sexp-1 ()
+ "Move backward a token or list.
+
+Signal `scan-error' if it hits opening parentheses."
+ (let ((token (swift-mode:backward-token-or-list))
+ (pos (point)))
+ (when (memq (swift-mode:token:type token) '(\[ \( {))
+ (goto-char pos)
+ (signal 'scan-error
+ (list "Unbalanced parentheses"
+ (swift-mode:token:start token)
+ (swift-mode:token:end token))))
+ token))
+
+
;; Imenu
(defun swift-mode:mk-regex-for-def (keyword)
- [nongnu] elpa/swift-mode 9211980 312/496: Bump version to 2.1.2, (continued)
- [nongnu] elpa/swift-mode 9211980 312/496: Bump version to 2.1.2, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 3d27871 313/496: Tweak README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 86eb49c 323/496: Fix indentation of for-in, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 78cea9d 337/496: Improve CI, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 63580e8 339/496: Speed-up indentation for colon, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e91e924 347/496: Bump version to 2.2.4, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9892096 350/496: Bump version to 2.3.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 55ea958 354/496: Fix syntax error, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e8d9a5d 363/496: Bump version to 3.0.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 99ff376 362/496: Improve functions related to defuns, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e3cb72b 360/496: Fix `swift-mode:forward-sexp` for `up-list` and `down-list`,
ELPA Syncer <=
- [nongnu] elpa/swift-mode 50394e4 357/496: Bump version to 2.4.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 82ee822 361/496: Fix code styles, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5df00bc 367/496: Fix typo, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 1167fec 369/496: Fix comment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e58e4e0 368/496: Tweak test, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 089853c 384/496: Fix typo "identifer" to "identifier", ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e81ab53 381/496: Fix comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8d4a5a5 373/496: Add kill/mark/narrow-to-sentence, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a042764 374/496: Fix indentation of comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8c45f69 383/496: Bump version to 4.0.1, ELPA Syncer, 2021/08/29