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

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

[nongnu] elpa/haskell-mode 3e146c1a89 2/2: Merge pull request #1818 from


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-mode 3e146c1a89 2/2: Merge pull request #1818 from jasagredo/jasagredo/improve-cabal-font-lock
Date: Wed, 16 Aug 2023 10:00:12 -0400 (EDT)

branch: elpa/haskell-mode
commit 3e146c1a89db257bb75c7b33fa2a5a1a85aabd51
Merge: de7f13faaf e437466bc2
Author: Steve Purcell <steve@sanityinc.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #1818 from jasagredo/jasagredo/improve-cabal-font-lock
    
    Improve cabal font-lock
---
 haskell-cabal.el | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/haskell-cabal.el b/haskell-cabal.el
index 21cdfb0b08..c0707009fe 100644
--- a/haskell-cabal.el
+++ b/haskell-cabal.el
@@ -99,22 +99,29 @@ By default these are:
 (defvar haskell-cabal-font-lock-keywords
   ;; The comment syntax can't be described simply in syntax-table.
   ;; We could use font-lock-syntactic-keywords, but is it worth it?
-  '(("^[ \t]*--.*" . font-lock-comment-face)
-    ("^ *\\([^ \t:]+\\):" (1 font-lock-keyword-face))
-    ("^\\(Library\\)[ \t]*\\({\\|$\\)" (1 font-lock-keyword-face))
-    ("^\\(Library\\|Executable\\|Test-Suite\\|Benchmark\\|Common\\|package\\)[ 
\t]+\\([^\n \t]*\\)"
+  '(;; comments
+    ("^[ \t]*--.*" . font-lock-comment-face)
+    ;; fields ending in colon
+    ("^ *\\([^ \t:]+\\):\\( +\\|$\\)" (1 font-lock-keyword-face))
+    ;; stanzas that start a line, followed by an identifier
+    
("^\\(Library\\|Executable\\|Test-Suite\\|Benchmark\\|Common\\|Package\\|Flag\\|Repository\\)[
 \t]+\\([^\n \t]*\\)"
      (1 font-lock-keyword-face) (2 font-lock-function-name-face))
-    ("^\\(Flag\\|install-dirs\\|repository\\)[ \t]+\\([^\n \t]*\\)"
-     (1 font-lock-keyword-face) (2 font-lock-constant-face))
-    ("^\\(Source-Repository\\)[ \t]+\\(head\\|this\\)"
-     (1 font-lock-keyword-face) (2 font-lock-constant-face))
-    
("^\\(haddock\\|source-repository-package\\|program-options\\|program-locations\\|program-default-options\\)\\([
 \t]\\|$\\)"
-     (1 font-lock-keyword-face))
-    ("^ *\\(if\\)[ \t]+.*\\({\\|$\\)" (1 font-lock-keyword-face))
-    ("^ *\\(}[ \t]*\\)?\\(else\\)[ \t]*\\({\\|$\\)"
-     (2 font-lock-keyword-face))
-    ("\\<\\(?:True\\|False\\)\\>"
-     (0 font-lock-constant-face))))
+    ;; stanzas that start a line, followed by a constant
+    ("^\\(Source-Repository\\)[ \t]+\\(head\\|this\\)" (1 
font-lock-keyword-face) (2 font-lock-constant-face))
+    ;; stanzas that start a line, followed by a constant in cabal config
+    ("^\\(install-dirs\\)[ \t]+\\(global\\|user\\)" (1 font-lock-keyword-face) 
(2 font-lock-constant-face))
+    ;; stanzas that start a line
+    ("^\\(Library\\|Custom-Setup\\|source-repository-package\\)[ \t]*$" (1 
font-lock-keyword-face))
+    ;; stanzas that start a line in cabal config
+    ("^\\(haddock\\|init\\|program-locations\\|program-default-options\\)[ 
\t]*$" (1 font-lock-keyword-face))
+    ;; stanzas that can live inside if-blocks
+    ("^[ \t]*\\(program-options\\)$" (1 font-lock-keyword-face))
+    ;; if clause
+    ("^ *\\(if\\|elif\\)[ \t]+.*$" (1 font-lock-keyword-face))
+    ;; else clause
+    ("^ *\\(else\\)[ \t]*$" (1 font-lock-keyword-face))
+    ;; True/False
+    ("\\<\\(?:True\\|False\\)\\>" (0 font-lock-constant-face))))
 
 (defvar haskell-cabal-buffers nil
   "List of Cabal buffers.")



reply via email to

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