emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/dart-mode 06e2d4b 160/192: Respect font-lock-maximum-decor


From: ELPA Syncer
Subject: [nongnu] elpa/dart-mode 06e2d4b 160/192: Respect font-lock-maximum-decoration
Date: Sun, 29 Aug 2021 11:02:09 -0400 (EDT)

branch: elpa/dart-mode
commit 06e2d4b2129b1f4c54e7ba7585b5005e90e5346d
Author: Brady Trainor <mail@bradyt.com>
Commit: Brady Trainor <mail@bradyt.com>

    Respect font-lock-maximum-decoration
    
    This is not intended to coincide completely with suggestions at
    
http://www.gnu.org/software/emacs/manual/html_node/elisp/Levels-of-Font-Lock.html,
    but rather to get the refactoring of font-lock-keywords started.
    
    Specifically, we see only function declarations fontified if we set
    font-lock-maximum-decoration to 1.
---
 dart-mode.el | 46 ++++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/dart-mode.el b/dart-mode.el
index 79eea39..ddda8c6 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -593,24 +593,34 @@ indentation levels from right to left."
          (t (throw 'result nil)))))))
 
 (setq dart-font-lock-defaults
-      `((,dart--async-keywords-re
-         ,(regexp-opt dart--keywords 'words)
-         (,(regexp-opt dart--builtins 'words)  . font-lock-builtin-face)
-         (,(regexp-opt dart--constants 'words) . font-lock-constant-face)
-         (,dart--hex-number-re                 . (1 font-lock-constant-face))
-         (,dart--number-re                     . (1 font-lock-constant-face))
-         (,dart--metadata-re                   . font-lock-constant-face)
-         (,(regexp-opt dart--types 'words)     . font-lock-type-face)
-         (,dart--types-re                      . font-lock-type-face)
-         (dart--function-declaration-func      . font-lock-function-name-face)
-         (dart--declared-identifier-func       . font-lock-variable-name-face)
-         (dart--declared-identifier-anchor-func
-          . (dart--declared-identifier-next-func
-             nil
-             nil
-             (0 font-lock-variable-name-face)))
-         (dart--string-interpolation-id-func   (0 font-lock-variable-name-face 
t))
-         (dart--string-interpolation-exp-func  (0 font-lock-variable-name-face 
t)))))
+      '((dart-font-lock-keywords-1 dart-font-lock-keywords-1
+                                   dart-font-lock-keywords-2
+                                   dart-font-lock-keywords-3)))
+
+(setq dart-font-lock-keywords-1
+      '((dart--function-declaration-func       . 
font-lock-function-name-face)))
+
+(setq dart-font-lock-keywords-2
+      `(,dart--async-keywords-re
+        ,(regexp-opt dart--keywords 'words)
+        (,(regexp-opt dart--builtins 'words)  . font-lock-builtin-face)
+        (,(regexp-opt dart--constants 'words) . font-lock-constant-face)
+        (,dart--hex-number-re                 . (1 font-lock-constant-face))
+        (,dart--number-re                     . (1 font-lock-constant-face))
+        (,dart--metadata-re                   . font-lock-constant-face)
+        (,(regexp-opt dart--types 'words)     . font-lock-type-face)
+        (,dart--types-re                      . font-lock-type-face)
+        (dart--function-declaration-func      . font-lock-function-name-face)
+        (dart--declared-identifier-func       . font-lock-variable-name-face)
+        (dart--declared-identifier-anchor-func
+         . (dart--declared-identifier-next-func
+            nil
+            nil
+            (0 font-lock-variable-name-face)))
+        (dart--string-interpolation-id-func   (0 font-lock-variable-name-face 
t))
+        (dart--string-interpolation-exp-func  (0 font-lock-variable-name-face 
t))))
+
+(setq dart-font-lock-keywords-3 dart-font-lock-keywords-2)
 
 (setq dart-string-delimiter (rx (and
                             ;; Match even number of backslashes.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]