From 5f99a51ef64871113ead6de0f645eb3d24d65225 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Tue, 30 Sep 2025 10:18:34 -0600 Subject: [PATCH] Correct Cabal comment syntax highlighting Previously it highlighted the entire line as a comment. This fixes it to ignore the leading whitespace, highlight the `--` as a comment delimiter, then highlight the remainder as the actual comment. --- haskell-cabal.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/haskell-cabal.el b/haskell-cabal.el index f37a3702..cd8fa1d3 100644 --- a/haskell-cabal.el +++ b/haskell-cabal.el @@ -100,7 +100,8 @@ By default these are: ;; The comment syntax can't be described simply in syntax-table. ;; We could use font-lock-syntactic-keywords, but is it worth it? '(;; comments - ("^[ \t]*--.*" . font-lock-comment-face) + ("^[ \t]*\\(--\\)\\(.*\\)" + (1 font-lock-comment-delimiter-face) (2 font-lock-comment-face)) ;; fields ending in colon ("^ *\\([^ \t:]+\\):\\( +\\|$\\)" (1 font-lock-keyword-face)) ;; stanzas that start a line, followed by an identifier