[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'."
- [nongnu] elpa/swift-mode c51eaf8 257/496: Fix token for ! & ?, (continued)
- [nongnu] elpa/swift-mode c51eaf8 257/496: Fix token for ! & ?, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ce816a8 270/496: Fix backward-sexp test by adding brackets, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 85e05ea 271/496: Merge pull request #105 from uk-ar/fix-move-by-sexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode befeb2a 017/496: Highlight bools and nil as constants, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 654d5e2 006/496: More work on font locking, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c4943a8 025/496: Add to auto-mode-alist, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0ad90f8 035/496: Fix a typo, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 19a61d9 022/496: fixup! Copy syntax table from rust-mode., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 406f2ba 028/496: Mention Emacs version in readme, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2ca1425 026/496: Remove ackrc and travis yaml for now, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ec9243c 032/496: Tweaks to indentation,
ELPA Syncer <=
- [nongnu] elpa/swift-mode 1b3ebe8 046/496: Remove obsolete require, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 90cdeb5 057/496: Configure travis, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9714a0c 063/496: Fix docstring typo, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e733088 073/496: Merge pull request #20 from ap4y/flycheck_plugin, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5aa4010 082/496: Replace if not with unless, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 3a82dd5 085/496: Add mode menu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 32e08b3 095/496: Add initial implementation of smie based indentation, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b1334e1 101/496: Highlight interpolation expression via syntactic fontification, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d053d31 109/496: Use greedy regex in interpolation highlighting to prevent issues with, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ecb8a87 114/496: Use different lexer rule for case statement in enum to fix issues with, ELPA Syncer, 2021/08/29