Commit 4946b420 authored by Russ Cox's avatar Russ Cox

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
parent f78e7d36
......@@ -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 "\\<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))
;; Continuation lines are indented 1 level
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment