branch: elpa/go-mode
commit f9174b22aee956dd9a1a875b46bdadb281a912cb
Author: Peter Sanford <[email protected]>
Commit: Muir Manders <[email protected]>
Improve go-dot-mod-mode font lock regexp
All the go.mod keywords are bounded by the beginning of line and
whitespace so we use that as our regexp boundaries instead of
word/symbol boundaries.
Closes: #302 [via git-merge-pr]
---
go-mode.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index c4be225..afc1e13 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -2635,11 +2635,11 @@ If BUFFER, return the number of characters in that
buffer instead."
(defconst go-dot-mod-mode-keywords
'("module" "go" "require" "replace" "exclude")
- "All keywords in the Go language. Used for font locking.")
+ "All keywords for go.mod files. Used for font locking.")
(defvar go-dot-mod-font-lock-keywords
`(
- (,(concat "\\_<" (regexp-opt go-dot-mod-mode-keywords t) "\\_>") .
font-lock-keyword-face))
+ (,(concat "^\\s-*" (regexp-opt go-dot-mod-mode-keywords t) "\\s-") .
font-lock-keyword-face))
"Keyword highlighting specification for `go-dot-mod-mode'.")
;;;###autoload