mirror of
https://github.com/golang/go
synced 2024-11-11 22:40:22 -07:00
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
This commit is contained in:
parent
f78e7d36a6
commit
4946b420f2
@ -7,7 +7,6 @@
|
|||||||
;;; To do:
|
;;; To do:
|
||||||
|
|
||||||
;; * Indentation is *almost* identical to gofmt
|
;; * 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
|
;; ** We disagree on the indentation of function literals in arguments
|
||||||
;; ** There are bugs with the close brace of struct literals
|
;; ** There are bugs with the close brace of struct literals
|
||||||
;; * Highlight identifiers according to their syntactic context: type,
|
;; * Highlight identifiers according to their syntactic context: type,
|
||||||
@ -401,7 +400,8 @@ indented one level."
|
|||||||
(setq first nil))))
|
(setq first nil))))
|
||||||
|
|
||||||
;; case, default, and labels are outdented 1 level
|
;; case, default, and labels are outdented 1 level
|
||||||
(when (looking-at "\\<case\\>\\|\\<default\\>\\|\\w+\\s *:\\(\\S.\\|$\\)")
|
;; assume that labels are alone on the line
|
||||||
|
(when (looking-at "\\<case\\>\\|\\<default\\>\\|\\w+\\s *:\\s *$")
|
||||||
(decf indent tab-width))
|
(decf indent tab-width))
|
||||||
|
|
||||||
;; Continuation lines are indented 1 level
|
;; Continuation lines are indented 1 level
|
||||||
|
Loading…
Reference in New Issue
Block a user