From 4946b420f217e65e581bd6299b71f74654570717 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 24 Aug 2011 16:47:12 -0400 Subject: [PATCH] misc/emacs: refine label detection Based on idea in http://patch-tracker.debian.org/patch/series/view/golang/1:59-1/008-emacs-mode-key-literal-indent.patch Fixes #2174. R=amdragon, ajmani, amdragon CC=golang-dev https://golang.org/cl/4922049 --- misc/emacs/go-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index ba7f72397d..1c90af865f 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -7,7 +7,6 @@ ;;; To do: ;; * Indentation is *almost* identical to gofmt -;; ** We think struct literal keys are labels and outdent them ;; ** We disagree on the indentation of function literals in arguments ;; ** There are bugs with the close brace of struct literals ;; * Highlight identifiers according to their syntactic context: type, @@ -401,7 +400,8 @@ indented one level." (setq first nil)))) ;; case, default, and labels are outdented 1 level - (when (looking-at "\\\\|\\\\|\\w+\\s *:\\(\\S.\\|$\\)") + ;; assume that labels are alone on the line + (when (looking-at "\\\\|\\\\|\\w+\\s *:\\s *$") (decf indent tab-width)) ;; Continuation lines are indented 1 level