[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 79d5860 073/495: improve fontification
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 79d5860 073/495: improve fontification |
Date: |
Sat, 7 Aug 2021 09:04:46 -0400 (EDT) |
branch: elpa/go-mode
commit 79d5860655c0813d5f2ecb3c5c9a774b9214c81b
Author: Dominik Honnef <dominikh@fork-bomb.org>
Commit: Dominik Honnef <dominikh@fork-bomb.org>
improve fontification
fix go-type-name-regexp and use [[:space:]] instead of "\\s " for
readability reasons
---
go-mode.el | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 8b3a3ab..1adddf8 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -25,7 +25,7 @@
(defconst go-func-meth-regexp (concat "\\<func\\>\\s *\\(?:(\\s *"
go-identifier-regexp "\\s +" go-type-regexp "\\s *)\\s *\\)?\\("
go-identifier-regexp "\\)("))
(defconst go-builtins '("append" "cap" "close" "complex" "copy" "delete"
"imag" "len" "make" "new" "panic" "print" "println" "real" "recover"))
(defconst go-constants '("nil" "true" "false" "iota"))
-(defconst go-type-name-regexp "\\(?:[*(]\\)*\\(?:\\w+\\.\\)?\\(\\w+\\)") ;;
TODO replace this with something sane
+(defconst go-type-name-regexp (concat "\\(?:[*(]\\)*\\(?:"
go-identifier-regexp "\\.\\)?\\(" go-identifier-regexp "\\)"))
(defgroup go nil
@@ -80,27 +80,27 @@ some syntax analysis.")
)
(if go-fontify-function-calls
- `((,(concat "\\(" go-identifier-regexp "\\)\\s *(") 1
font-lock-function-name-face) ;; function call/method name
- (,(concat "(\\(" go-identifier-regexp "\\))\\s *(") 1
font-lock-function-name-face)) ;; bracketed function call
+ `((,(concat "\\(" go-identifier-regexp "\\)[[:space:]]*(") 1
font-lock-function-name-face) ;; function call/method name
+ (,(concat "(\\(" go-identifier-regexp "\\))[[:space:]]*(") 1
font-lock-function-name-face)) ;; bracketed function call
`((,go-func-meth-regexp 1 font-lock-function-name-face))) ;; method name
`(
- ("\\<type\\>\\s *\\(\\S +\\)" 1 font-lock-type-face) ;; types
- (,(concat "\\<type\\>\\s *" go-identifier-regexp "\\s *"
go-type-name-regexp) 1 font-lock-type-face) ;; types
+ ("\\<type\\>[[:space:]]*\\([^[:space:]]+\\)" 1 font-lock-type-face) ;;
types
+ (,(concat "\\<type\\>[[:space:]]*" go-identifier-regexp "[[:space:]]*"
go-type-name-regexp) 1 font-lock-type-face) ;; types
(,(concat
"\\(?:[[:space:]]+\\|\\]\\)\\[\\([[:digit:]]+\\|\\.\\.\\.\\)?\\]"
go-type-name-regexp) 2 font-lock-type-face) ;; Arrays/slices
(,(concat "map\\[[^]]+\\]" go-type-name-regexp) 1 font-lock-type-face) ;;
map value type
(,(concat "\\(" go-identifier-regexp "\\)" "{") 1 font-lock-type-face)
(,(concat "\\<map\\[" go-type-name-regexp) 1 font-lock-type-face) ;; map
key type
- (,(concat "\\<chan\\>\\s *\\(?:<-\\)?" go-type-name-regexp) 1
font-lock-type-face) ;; channel type
- (,(concat "\\<\\(?:new\\|make\\)\\>\\(?:\\s \\|)\\)*("
go-type-name-regexp) 1 font-lock-type-face) ;; new/make type
+ (,(concat "\\<chan\\>[[:space:]]*\\(?:<-\\)?" go-type-name-regexp) 1
font-lock-type-face) ;; channel type
+ (,(concat "\\<\\(?:new\\|make\\)\\>\\(?:[[:space:]]\\|)\\)*("
go-type-name-regexp) 1 font-lock-type-face) ;; new/make type
;; TODO do we actually need this one or isn't it just a function call?
(,(concat "\\.\\s *(" go-type-name-regexp) 1 font-lock-type-face) ;; Type
conversion
- (,(concat "\\<func\\>\\s +(" go-identifier-regexp "\\s +"
go-type-name-regexp ")") 1 font-lock-type-face) ;; Method receiver
+ (,(concat "\\<func\\>[[:space:]]+(" go-identifier-regexp "[[:space:]]+"
go-type-name-regexp ")") 1 font-lock-type-face) ;; Method receiver
;; Like the original go-mode this also marks compound literal
;; fields. There, it was marked as to fix, but I grew quite
;; accustomed to it, so it'll stay for now.
- ("^\\s *\\(\\w+\\)\\s *:\\(\\S.\\|$\\)" 1 font-lock-constant-face) ;;
Labels and compound literal fields
- ("\\<\\(goto\\|break\\|continue\\)\\>\\s *\\(\\w+\\)" 2
font-lock-constant-face)))) ;; labels in goto/break/continue
+ (,(concat "^[[:space:]]*\\(" go-identifier-regexp
"\\)[[:space:]]*:\\(\\S.\\|$\\)") 1 font-lock-constant-face) ;; Labels and
compound literal fields
+ ("\\<\\(goto\\|break\\|continue\\)\\>[[:space:]]*\\(\\w+\\)" 2
font-lock-constant-face)))) ;; labels in goto/break/continue
(defvar go-mode-map
(let ((m (make-sparse-keymap)))
- [nongnu] elpa/go-mode 63929d2 085/495: get rid of go--flatten, (continued)
- [nongnu] elpa/go-mode 63929d2 085/495: get rid of go--flatten, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 850986e 022/495: Do not loop forever in go-beginning-of-defun if point is in comment and there's no function definition before point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b91c53e 025/495: save buffer before trying to remove unused imports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4371669 029/495: Merge branch 'feature/remove_unused_imports', ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cd13093 034/495: use inhibit-read-only instead of toggle-read-only, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b6dfdd4 037/495: Closes gh-5, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 9dbdf22 041/495: Do not skip over strings when checking for dangling operator, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 95c9519 049/495: when searching for anchor for indentation, do not limit search to one line, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 399393a 057/495: remove dead code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode ee10287 059/495: Revert "Fix indentation for code after multi-line function signature", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 79d5860 073/495: improve fontification,
ELPA Syncer <=
- [nongnu] elpa/go-mode 49b9355 074/495: do not change indentation if in multiline string, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 522543f 077/495: replace several defuns with macros, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4aeb058 078/495: add cache to go-previous-line-has-dangling-op-p, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 438f671 082/495: update documentation, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c2366b2 084/495: formatting, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fb9ab02 087/495: buffer-file-truename is an *abbreviated* truename, so use file-truename instead., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 745c437 092/495: style fixes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c833b77 094/495: Fix cache invalidation for dangling operator cache, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 87c8b6e 096/495: do not use dangling op cache when buffer is narrowed, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8e19ae5 097/495: add some documentation, ELPA Syncer, 2021/08/07