[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 62276c3 061/496: Indent cases in enums
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 62276c3 061/496: Indent cases in enums |
Date: |
Sun, 29 Aug 2021 11:33:08 -0400 (EDT) |
branch: elpa/swift-mode
commit 62276c39e5cf50286ded6736c8cc19e5fbaa7fff
Author: Chris Barrett <chris.d.barrett@me.com>
Commit: Chris Barrett <chris.d.barrett@me.com>
Indent cases in enums
Fixes #15
---
swift-mode.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/swift-mode.el b/swift-mode.el
index c879eb7..6b39a9d 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -91,6 +91,15 @@
(backward-word 1))
(current-column))))
+(defun swift-indent--at-enum-case? ()
+ "Non-nil if point is at the case keyword at the top-level of an enum
declaration."
+ (save-excursion
+ (back-to-indentation)
+ (when (looking-at (rx bow "case" eow))
+ (backward-up-list)
+ (swift-indent--back-to-start-of-level)
+ (looking-at (rx bow "enum" eow)))))
+
(defun swift-indent--calculate-indentation ()
"Calculate the indentation column to use for `swift-indent-line'.
Returns the column number as an integer."
@@ -142,6 +151,8 @@ Returns the column number as an integer."
(back-to-indentation)
;; Point is now at the beginning of the current line
(cond
+ ((swift-indent--at-enum-case?)
+ 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))
- [nongnu] elpa/swift-mode 0c908ad 103/496: Remove an outdated statement about the indentation code, (continued)
- [nongnu] elpa/swift-mode 0c908ad 103/496: Remove an outdated statement about the indentation code, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 41d38bd 117/496: Clarify syntax table for syntactic fontification., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 18e1e4a 107/496: Highlight attributes as keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 98556c1 120/496: Start work on version 0.3, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8be19fb 108/496: Highlight self and super as keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 3caacf3 007/496: Highlight attributes and _ wildcards, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c8f1dbd 014/496: Update readme, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode adb3c13 039/496: Restore Emacs 24.1 requirement, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ab5e170 044/496: Add a few links, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a44a755 052/496: Add docstrings for internal indent commands, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 62276c3 061/496: Indent cases in enums,
ELPA Syncer <=
- [nongnu] elpa/swift-mode e168b34 128/496: Don't use implicit semicolon for multi-line dot expressions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ee83a1d 137/496: Rename swift-indent-multiline-dot-offset to swift-indent-multiline-statement-offset, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fca914a 165/496: Merge pull request #63 from ckruse/updated_syntax, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8db040e 166/496: fix: underscores are word characters (Word constituents), ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2a21e1b 177/496: Add ternary operator smie grammar, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 641681a 182/496: Fix small typo in comment string, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2b17f71 183/496: Improve grammar and lexer to support access modifier in class definitions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode cac2884 185/496: Add lists to the "type" grammar, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode adfe341 190/496: Add grammar for the protocol definitions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 20134ed 193/496: Use postive lookahead for declaration specifier lexer rule, ELPA Syncer, 2021/08/29