[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 490ab34 051/496: Simplify indentation command
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 490ab34 051/496: Simplify indentation command |
Date: |
Sun, 29 Aug 2021 11:33:06 -0400 (EDT) |
branch: elpa/swift-mode
commit 490ab34bd4db371bfb012f6970a7bf03324b7e32
Author: Chris Barrett <chris.d.barrett@me.com>
Commit: Chris Barrett <chris.d.barrett@me.com>
Simplify indentation command
Remove redundant branches in `swift-indent--calculate-indentation`
retained from the original rust-mode implementation.
Fixes #13
---
swift-mode.el | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index b3fed55..bd93d33 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -87,13 +87,6 @@
(backward-word 1))
(current-column))))
-(defun swift-indent--rewind-to-beginning-of-current-level-expr ()
- (let ((current-level (swift-indent--paren-level)))
- (back-to-indentation)
- (while (> (swift-indent--paren-level) current-level)
- (backward-up-list)
- (back-to-indentation))))
-
(defun swift-indent--calculate-indentation ()
"Calculate the indentation column to use for `swift-indent-line'.
Returns the column number as an integer."
@@ -145,32 +138,9 @@ Returns the column number as an integer."
(back-to-indentation)
;; Point is now at the beginning of the current line
(cond
- ;; If this line begins with "else" or "{", stay on the
- ;; baseline as well (we are continuing an expression,
- ;; but the "else" or "{" should align with the beginning
- ;; of the expression it's in.)
- ((looking-at (rx (or (and bow "else" eow) "{")))
- baseline)
;; Cases are indented to the same level as the enclosing switch
statement.
((looking-at (rx bow (or "case" "default") eow))
(- baseline swift-indent-offset))
-
- ;; If we are at the first line, no indentation is needed, so stay
at baseline.
- ((save-excursion
- (swift-indent--rewind-irrelevant)
- ;; Point is now at the end of the previous line
- (= 1 (line-number-at-pos (point))))
- baseline)
-
- ((save-excursion
- (swift-indent--rewind-irrelevant)
- ;; Point is now at the end of the previous line
- ;; If the previous line ends with any of these:
- ;; { ? : ( , ; [ }
- ;; then we are at the beginning of an expression, so stay on
the baseline.
- (looking-back "[(,:;?[{}]\\|[^|]|"))
- baseline)
-
(t
baseline)))))))))
- [nongnu] elpa/swift-mode 19d909b 468/496: Migrate to Eldev, (continued)
- [nongnu] elpa/swift-mode 19d909b 468/496: Migrate to Eldev, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 02a1726 476/496: Introduce some font-lock tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode abbd06e 478/496: Fix error on indenting a closing paren outside strings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ad12a30 486/496: Remove Cask from README, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 1b47a09 495/496: Bump version to 8.3.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 561cacb 043/496: Code style, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 396f297 058/496: Fix test docstring typo, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 60956cb 081/496: fixup! Add swift repl commands to mode map, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d59cae7 355/496: Fix indentation of string interpolations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2aeef85 425/496: Update copyright notice, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 490ab34 051/496: Simplify indentation command,
ELPA Syncer <=
- [nongnu] elpa/swift-mode 66bfbc5 056/496: Add indentation tests, add makefile runner task, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ead0ae5 055/496: Fix spelling error in readme, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 049c6d6 439/496: Use `assoc-default`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ba4d981 473/496: Use seq-contains-p if available, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 86f8f62 447/496: Bump version to 8.0.1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 90686cb 450/496: Add `some` keyword of Swift 5.1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode acfc7fd 452/496: Fix comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0daff60 463/496: Fix unreadable characters appearing in repl prompt, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5597eaf 467/496: Avoid max-lisp-eval-depth in font-lock-match-expr, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8f1a697 483/496: Fix documentations, ELPA Syncer, 2021/08/29