[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode b85033a 309/459: Make fontification a littl
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode b85033a 309/459: Make fontification a little less 'constant-heavy' |
Date: |
Sun, 22 Aug 2021 13:59:50 -0400 (EDT) |
branch: externals/csharp-mode
commit b85033a1b54f1f558ab382a07f5ebceb16fe6172
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Theodor Thornhill <theo@thornhill.no>
Make fontification a little less 'constant-heavy'
---
csharp-mode-tests.el | 8 ++++----
csharp-mode.el | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 13c7238..865d277 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -162,9 +162,9 @@
"using" 'font-lock-keyword-face
"Reference" 'font-lock-type-face
"Under_scored" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"Ok" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"OkV2" 'font-lock-type-face
))
@@ -173,9 +173,9 @@
"namespace" 'font-lock-keyword-face
"Reference" 'font-lock-type-face
"Under_scored" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"Ok" 'font-lock-type-face
- "WithNumbers09" 'font-lock-constant-face
+ "WithNumbers09" 'font-lock-variable-name-face
"Ok" 'font-lock-type-face
))
diff --git a/csharp-mode.el b/csharp-mode.el
index a640ee9..2cd428f 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -241,6 +241,63 @@
(cpp-macro .
c-lineup-dont-change)
(substatement-open . 0)))))
+(c-lang-defconst c-basic-matchers-before
+ "Font lock matchers for basic keywords, labels, references and various
+other easily recognizable things that should be fontified before generic
+casts and declarations are fontified. Used on level 2 and higher."
+ csharp `(
+ ;; Put warning face on unclosed strings
+ ,@(if (version< emacs-version "27.0")
+ ;; Taken from 26.1 branch
+ `(,(c-make-font-lock-search-function
+ (concat ".\\(" c-string-limit-regexp "\\)")
+ '((c-font-lock-invalid-string))))
+ `(("\\s|" 0 font-lock-warning-face t nil)))
+
+ ;; Invalid single quotes
+ c-font-lock-invalid-single-quotes
+
+ ;; Fontify keyword constants
+ ,@(when (c-lang-const c-constant-kwds)
+ (let ((re (c-make-keywords-re nil (c-lang-const
c-constant-kwds))))
+ `((eval . (list ,(concat "\\<\\(" re "\\)\\>")
+ 1 c-constant-face-name)))))
+
+ ;; Fontify all keywords except the primitive types.
+ ,`(,(concat "\\<" (c-lang-const c-regular-keywords-regexp))
+ 1 font-lock-keyword-face)
+
+ ,@(when (c-lang-const c-opt-identifier-concat-key)
+ `(,(c-make-font-lock-search-function
+ ;; Search for identifiers preceded by ".". The anchored
+ ;; matcher takes it from there.
+ (concat (c-lang-const c-opt-identifier-concat-key)
+ (c-lang-const c-simple-ws) "*"
+ (concat "\\("
+ ;; "[" c-upper "]"
+ "[" (c-lang-const c-symbol-chars) "]*"
+ "\\|"
+ "\\)"))
+ `((let (id-end)
+ (goto-char (1+ (match-beginning 0)))
+ (while (and (eq (char-before) ?.)
+ (progn
+ (backward-char)
+ (c-backward-syntactic-ws)
+ (setq id-end (point))
+ (< (skip-chars-backward
+ ,(c-lang-const c-symbol-chars))
+ 0))
+ (not (get-text-property (point) 'face)))
+ (c-put-font-lock-face (point) id-end
+ font-lock-variable-name-face)
+ (c-backward-syntactic-ws)))
+ nil
+ (goto-char (match-end 0))))))
+
+ (eval . (list "\\(!\\)[^=]" 1 c-negation-char-face-name))
+ ))
+
(defcustom csharp-font-lock-extra-types
(list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw"))
(c-make-font-lock-extra-types-blurb "C#" "csharp-mode" (concat))
- [elpa] externals/csharp-mode 9c596c9 283/459: Advice to override only in csharp-mode, (continued)
- [elpa] externals/csharp-mode 9c596c9 283/459: Advice to override only in csharp-mode, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 617dd6d 284/459: Ensure ad-do-it is called on else branch, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3d02042 291/459: makefile: Make repeated test-runs faster to run., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 072c3dc 292/459: Fix parts of `fontification-of-literals-detects-end-of-strings`, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 2ab4d62 293/459: Remove unused import, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode e79d694 299/459: Add standard query operators kwds, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 608805c 300/459: Relicense to GPLv3, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c6ec8c2 306/459: Remove before/after functions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 70d3d89 297/459: Fix cl failure for old cc-mode versions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 919dd65 294/459: Fix c-default-style warnings, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode b85033a 309/459: Make fontification a little less 'constant-heavy',
ELPA Syncer <=
- [elpa] externals/csharp-mode 795b9bb 301/459: Merge pull request #168 from josteink/relicense, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3fc339e 310/459: Add fontification to functions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3526396 305/459: Remove before/after functions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode dbbd17a 312/459: Merge pull request #171 from josteink/fontification-lighter, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 7a41dad 318/459: Add attributes to indentation-tests, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f46d656 321/459: Fix indentation in one defconst, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 49d8392 323/459: Add nullable operator to concatenated identifiers, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 2ee53e4 234/459: Fix some easy checkdoc errors., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 309e2c8 238/459: Create failing test-case., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode cef0d90 243/459: Don't override user's customizations., ELPA Syncer, 2021/08/22