branch: elpa/nix-mode
commit 86b7195b3e0597b28e92ebba36568676ad9f1916
Author: Matthew Justin Bauer <[email protected]>
Commit: GitHub <[email protected]>

    Use warning font lock for upper case vars
    
    warn on upper case variable names consistent with styling
---
 nix-mode.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/nix-mode.el b/nix-mode.el
index 3a613e9a3b..067e8d09d4 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -59,10 +59,15 @@
     ("\\_<toString\\_>" . font-lock-builtin-face)
     ("\\_<true\\_>" . font-lock-builtin-face)
 
+    ;; variable assignments
+    ;; warn on upper case variable names
+    ("\\<\\([A-Z_][a-zA-Z0-9_'\-\.]*\\)[ \t]*="
+     (1 font-lock-warning-face nil nil) ;; capitalized
+    ("\\<\\([a-z][a-zA-Z0-9_'\-\.]*\\)[ \t]*="
+     (1 font-lock-variable-name-face nil nil)) ;; uncapitalized
+
     ("[a-zA-Z][a-zA-Z0-9\\+-\\.]*:[a-zA-Z0-9%/\\?:@&=\\+\\$,_\\.!~\\*'-]+"
      . font-lock-constant-face)
-    ("\\<\\([a-zA-Z_][a-zA-Z0-9_'\-\.]*\\)[ \t]*="
-     (1 font-lock-variable-name-face nil nil))
     ("<[a-zA-Z0-9._\\+-]+\\(/[a-zA-Z0-9._\\+-]+\\)*>"
      . font-lock-constant-face)
     ("[a-zA-Z0-9._\\+-]*\\(/[a-zA-Z0-9._\\+-]+\\)+"

Reply via email to