From: Russ Cox Date: Wed, 24 Aug 2011 20:47:12 +0000 (-0400) Subject: misc/emacs: refine label detection X-Git-Tag: weekly.2011-09-01~96 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4946b420f217e65e581bd6299b71f74654570717;p=gostls13.git 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 --- 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