[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode a414da8 465/495: Fontify "font-lock-negation-char-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode a414da8 465/495: Fontify "font-lock-negation-char-face" |
Date: |
Sat, 7 Aug 2021 09:06:10 -0400 (EDT) |
branch: elpa/go-mode
commit a414da86a48e490baeb24386fad495b47ec56fd9
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Fontify "font-lock-negation-char-face"
We now add "font-lock-negation-char-face" to unary "!" operators. This
face is meant to make sometimes easy-to-miss negation operators a bit
more jumpy outy.
Closes: #314 [via git-merge-pr]
---
go-mode.el | 2 ++
test/go-font-lock-test.el | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index ae9cdb9..8b681ed 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -450,6 +450,8 @@ For mode=set, all covered lines will have this weight."
;; Arrays/slices: []<type> | [123]<type> | [some.Const]<type> |
[someConst]<type> | [...]<type>
(,(concat "\\[\\(?:[[:digit:]]+\\|" go-qualified-identifier-regexp "\\|"
go-identifier-regexp "\\|\\.\\.\\.\\)?\\]" go-type-name-regexp) 1
font-lock-type-face)
+ ("\\(!\\)[^=]" 1 font-lock-negation-char-face)
+
(,(concat go-type-name-regexp "{") 1 font-lock-type-face)
(,(concat "\\_<map\\_>\\[[^]]+\\]" go-type-name-regexp) 1
font-lock-type-face) ;; map value type
(,(concat "\\_<map\\_>\\[" go-type-name-regexp) 1 font-lock-type-face) ;;
map key type
diff --git a/test/go-font-lock-test.el b/test/go-font-lock-test.el
index 6a20e77..e8fab24 100644
--- a/test/go-font-lock-test.el
+++ b/test/go-font-lock-test.el
@@ -97,6 +97,17 @@ KcaseK string:
(should-fontify "[]KmapK[TfooT]TbarT")
(should-fontify "KmapK[[1][2][three]*Tfoo.ZarT][four][]*Tbar.ZarT"))
+(ert-deftest go--fontify-negation ()
+ ;; Fontify unary "!".
+ (should-fontify "N!Nfoo")
+
+ ;; Alternate fontification with multiple "!".
+ (should-fontify "N!N!foo")
+ (should-fontify "N!N!N!Nfoo")
+
+ ;; Don't fontify "!=" operator.
+ (should-fontify "foo != bar"))
+
(defun should-fontify (contents)
"Verify fontification.
@@ -114,7 +125,7 @@ expects \"make\" to be a (B)uiltin and \"int\" to be a
(T)type."
;; First pass through buffer looks for the face tags. We delete
;; the tags and record the expected face ranges in `faces'.
(let ((case-fold-search nil) faces start start-pos)
- (while (re-search-forward "[TBKCFS]" nil t)
+ (while (re-search-forward "[TBKCFSN]" nil t)
(let ((found-char (char-before)))
(backward-delete-char 1)
(if start
@@ -126,7 +137,8 @@ expects \"make\" to be a (B)uiltin and \"int\" to be a
(T)type."
(?K 'font-lock-keyword-face)
(?C 'font-lock-constant-face)
(?F 'font-lock-function-name-face)
- (?S 'font-lock-string-face))))
+ (?S 'font-lock-string-face)
+ (?N 'font-lock-negation-char-face))))
(setq faces (append faces `((,face ,start-pos ,(point))))))
(setq start nil))
(setq start found-char)
- [nongnu] elpa/go-mode cec546c 306/495: Clarify some points in NEWS, (continued)
- [nongnu] elpa/go-mode cec546c 306/495: Clarify some points in NEWS, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 5c1c546 307/495: Don't fontify parenthesis of multi-line type declaration, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 99b06da 408/495: Describe gofmt-args in the readme and the gofmt docstring (also gofmt-command), ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7c50c80 410/495: Always move back to same column after applying rcs patch, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e20a54a 426/495: Speed up go-previous-line-has-dangling-op-p, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1650ae5 434/495: Fix multiline case statement indent., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1fcf76d 435/495: Fix indentation regexes to be case insensitive, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8796ec6 446/495: indent: fix floating point literal with trailing point, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1bbe1d0 451/495: update default go-packages-function to use go list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 50e15c7 457/495: Add major mode for go.mod files: go-dot-mod-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a414da8 465/495: Fontify "font-lock-negation-char-face",
ELPA Syncer <=
- [nongnu] elpa/go-mode 1ef3e95 476/495: Fix fontification of single line composite literal., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode db8284d 485/495: Handle godef "no object" error, ELPA Syncer, 2021/08/07