Skip to content

Commit

Permalink
Improve go-dot-mod-mode font lock regexp
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
psanford authored and muirdm committed Oct 16, 2019
1 parent 50e15c7 commit f9174b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9174b2

Please sign in to comment.