diff options
author | Rui Ueyama <ruiu@google.com> | 2014-03-27 17:35:07 -0400 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2014-03-27 17:35:07 -0400 |
commit | 3395ac48610ecc58f4131b9812046d87b343219b (patch) | |
tree | afb5abbd9a56adf2fa96ff4e19fb57be28ac3a50 /misc | |
parent | 0e3ecd00009ef86aca9df91c2947ab0ed7b570f0 (diff) | |
download | go-3395ac48610ecc58f4131b9812046d87b343219b.tar.gz |
misc/emacs: do not highlight built-in function if not followed by '('
Name of built-in function is not reserved word in Go, and you can
use it as variable name. "new" is often used as local variable, for
instance.
This patch is to apply font-lock-builtin-face only when built-in
function name is followed by '(', so that it doesn't highlight
non-function variable that happen to have the same name as built-in
function.
LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://codereview.appspot.com/79260043
Committer: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/emacs/go-mode.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/emacs/go-mode.el b/misc/emacs/go-mode.el index a536a17d2..29b1fa442 100644 --- a/misc/emacs/go-mode.el +++ b/misc/emacs/go-mode.el @@ -262,7 +262,7 @@ For mode=set, all covered lines will have this weight." ;; doesn't understand that (append `((,(go--regexp-enclose-in-symbol (regexp-opt go-mode-keywords t)) . font-lock-keyword-face) - (,(go--regexp-enclose-in-symbol (regexp-opt go-builtins t)) . font-lock-builtin-face) + (,(concat "\\(" (go--regexp-enclose-in-symbol (regexp-opt go-builtins t)) "\\)[[:space:]]*(") 1 font-lock-builtin-face) (,(go--regexp-enclose-in-symbol (regexp-opt go-constants t)) . font-lock-constant-face) (,go-func-regexp 1 font-lock-function-name-face)) ;; function (not method) name |