From 09298c417bac81ac9ca8b529ab3387e1ffb68d3f Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Thu, 20 Feb 2025 19:41:07 +0300 Subject: [PATCH 1/2] Don't highlight preprocessor syntax Purescript has no preprocessor, this is a Haskell legacy. This fixes highlight in multiline strings. --- purescript-font-lock.el | 2 -- tests/purescript-font-lock-tests.el | 1 - 2 files changed, 3 deletions(-) diff --git a/purescript-font-lock.el b/purescript-font-lock.el index 2757a09..692ae46 100644 --- a/purescript-font-lock.el +++ b/purescript-font-lock.el @@ -211,8 +211,6 @@ Returns keywords suitable for `font-lock-keywords'." (setq keywords `(;; NOTICE the ordering below is significant ;; - ("^#.*$" 0 'font-lock-preprocessor-face t) - (,toplevel-keywords 1 (symbol-value 'purescript-keyword-face)) (,reservedid 1 (symbol-value 'purescript-keyword-face)) (,reservedsym 1 (symbol-value 'purescript-operator-face)) diff --git a/tests/purescript-font-lock-tests.el b/tests/purescript-font-lock-tests.el index 8cbe9d9..d24725a 100644 --- a/tests/purescript-font-lock-tests.el +++ b/tests/purescript-font-lock-tests.el @@ -75,7 +75,6 @@ hello (7 19 font-lock-string-face)))) (ert-deftest multiline-string-with-hash () - :expected-result :failed (purescript-test-ranges "foo = \"\"\" # a string with hashtag From 12c4d60f4f28107e12f5615f01455d74256358e7 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Tue, 25 Feb 2025 01:46:33 +0300 Subject: [PATCH 2/2] Limit multiline-comment test to Emacs 28+ --- tests/purescript-font-lock-tests.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/purescript-font-lock-tests.el b/tests/purescript-font-lock-tests.el index d24725a..984d33a 100644 --- a/tests/purescript-font-lock-tests.el +++ b/tests/purescript-font-lock-tests.el @@ -126,8 +126,10 @@ where vertical bar is omitted" " '((1 57 font-lock-doc-face)))) -(ert-deftest multiline-comment () - (purescript-test-ranges +;; For some unknown reason this fails on older Emacses +(when (>= emacs-major-version 28) + (ert-deftest multiline-comment () + (purescript-test-ranges "{- multiline comment -- | not a doc @@ -138,12 +140,12 @@ noncomment {--} noncomment " - '((1 64 font-lock-comment-face) - (65 66 font-lock-comment-delimiter-face) - (67 78 nil) - (79 80 font-lock-comment-face) - (81 82 font-lock-comment-delimiter-face) - (83 93 nil)))) + '((1 64 font-lock-comment-face) + (65 66 font-lock-comment-delimiter-face) + (67 78 nil) + (79 80 font-lock-comment-face) + (81 82 font-lock-comment-delimiter-face) + (83 93 nil))))) (ert-deftest multiline-comment-w-delimiter-inside () :expected-result :failed