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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swift-mode ec9243c 032/496: Tweaks to indentation


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode ec9243c 032/496: Tweaks to indentation
Date: Sun, 29 Aug 2021 11:33:02 -0400 (EDT)

branch: elpa/swift-mode
commit ec9243c9c1ecf1e63286ec8b3b04479e2688d86a
Author: Chris Barrett <chris.d.barrett@me.com>
Commit: Chris Barrett <chris.d.barrett@me.com>

    Tweaks to indentation
---
 swift-indent.el | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/swift-indent.el b/swift-indent.el
index d6eba24..0b97d6c 100644
--- a/swift-indent.el
+++ b/swift-indent.el
@@ -143,23 +143,25 @@ Returns the column number as an integer."
             ;; 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
-               (or
-                ;; If we are at the first line, no indentation is needed, so 
stay at baseline...
-                (= 1 (line-number-at-pos (point)))
-                ;; ..or 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 "[(,:;?[{}]\\|[^|]|")
-                ;; or if the previous line is the end of an attribute, stay at 
the baseline...
-                (progn 
(swift-indent--rewind-to-beginning-of-current-level-expr) (looking-at "#"))))
+               (= 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
-             ;; Otherwise, we are continuing the same expression from the 
previous line,
-             ;; so add one additional indent level
-             (+ baseline swift-indent-offset))))))))))
+             baseline)))))))))
 
 (defun swift-indent-line ()
   "Indent the current line.  Also see `swift-indent-offset'."



reply via email to

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