emacs-elpa-diffs
[Top][All Lists]
Advanced

[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)))))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]