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

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

[nongnu] elpa/go-mode e0de87c 075/495: do not indent labels in column 0


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode e0de87c 075/495: do not indent labels in column 0 but in normal indentation minus one
Date: Sat, 7 Aug 2021 09:04:46 -0400 (EDT)

branch: elpa/go-mode
commit e0de87c991d4965260a0845ccff9e44f318f7891
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>

    do not indent labels in column 0 but in normal indentation minus one
---
 go-mode.el                  | 8 ++------
 indentation_tests/labels.go | 5 +++++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/go-mode.el b/go-mode.el
index 4409d8f..549f547 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -214,12 +214,8 @@ some syntax analysis.")
     (if (go-in-string-or-comment-p)
         (goto-char point)
       (setq indent (go-indentation-at-point))
-      (cond
-       ((looking-at "case .+:\\|default:")
-        (setq indent (- indent tab-width)))
-       ((looking-at "[[:word:]]+:\\([[:space:]]*/.+\\)?$")
-        (setq indent 0)))
-
+      (if (looking-at "[[:word:]]+:\\([[:space:]]*/.+\\)?$\\|case 
.+:\\|default:")
+          (setq indent (- indent tab-width)))
       (setq shift-amt (- indent (current-column)))
       (if (zerop shift-amt)
           nil
diff --git a/indentation_tests/labels.go b/indentation_tests/labels.go
index a954855..3b005bc 100644
--- a/indentation_tests/labels.go
+++ b/indentation_tests/labels.go
@@ -8,4 +8,9 @@ Label2:
        code()
 Label3: // Comments!
        code()
+
+       for {
+       Label4:
+               // code
+       }
 }



reply via email to

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