EMACS: updated go-mode

This commit is contained in:
Tom Willemsen 2011-09-05 21:51:50 +02:00
parent 61953915a2
commit 27e9297a13

View file

@ -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,
@ -69,8 +68,8 @@
some syntax analysis.") some syntax analysis.")
(defvar go-mode-font-lock-keywords (defvar go-mode-font-lock-keywords
(let ((builtins '("cap" "close" "closed" "len" "make" "new" (let ((builtins '("append" "cap" "close" "complex" "copy" "imag" "len"
"panic" "panicln" "print" "println")) "make" "new" "panic" "print" "println" "real" "recover"))
(constants '("nil" "true" "false" "iota")) (constants '("nil" "true" "false" "iota"))
(type-name "\\s *\\(?:[*(]\\s *\\)*\\(?:\\w+\\s *\\.\\s *\\)?\\(\\w+\\)") (type-name "\\s *\\(?:[*(]\\s *\\)*\\(?:\\w+\\s *\\.\\s *\\)?\\(\\w+\\)")
) )
@ -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