branch: elpa/haskell-tng-mode commit 7326aada1c3ec35002d571d10938e1d17242f37b Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
modules and more efficient none --- haskell-tng-font-lock.el | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/haskell-tng-font-lock.el b/haskell-tng-font-lock.el index bda9ce4..24fc9cb 100644 --- a/haskell-tng-font-lock.el +++ b/haskell-tng-font-lock.el @@ -114,6 +114,10 @@ (: symbol-start (char ?\\)))) . 'haskell-tng:keyword) + ;; some things look nicer without faces + (,(rx (any ?\( ?\) ?\[ ?\] ?\{ ?\} ?,)) + (0 'default)) + ;; TypeFamilies (,(rx word-start "type" (+ space) (group "family") word-end) (1 'haskell-tng:keyword)) @@ -139,8 +143,6 @@ (group (opt ,qual) (| ,conid ,consym)))) (1 'haskell-tng:type)) - ;; TODO modules - ;; imports (haskell-tng:font:import:keyword (,(rx-to-string @@ -162,14 +164,29 @@ (haskell-tng:font:explicit-constructors (haskell-tng:font:multiline:anchor-rewind 1) (haskell-tng:font:multiline:anchor-rewind) - (0 'haskell-tng:constructor)) + (0 'haskell-tng:constructor keep)) (,(rx-to-string `(: word-start ,conid word-end)) (haskell-tng:font:multiline:anchor-rewind 1) (haskell-tng:font:multiline:anchor-rewind) - (0 'haskell-tng:type)) + (0 'haskell-tng:type keep)) ;; EXT:ExplicitNamespaces ) + (haskell-tng:font:module:keyword + (,(rx-to-string `(: word-start "module" word-end (+ space) + (group symbol-start (* ,conid ".") ,conid symbol-end))) + (haskell-tng:font:multiline:anchor-rewind) + (haskell-tng:font:multiline:anchor-rewind) + (1 'haskell-tng:module)) + (haskell-tng:font:explicit-constructors + (haskell-tng:font:multiline:anchor-rewind 1) + (haskell-tng:font:multiline:anchor-rewind) + (0 'haskell-tng:constructor keep)) + (,(rx-to-string `(: word-start ,conid word-end)) + (haskell-tng:font:multiline:anchor-rewind 1) + (haskell-tng:font:multiline:anchor-rewind) + (0 'haskell-tng:type keep))) + ;; TODO: pragmas ;; TODO: numeric / char primitives? ;; TODO: haddock, different face vs line comments, and some markup. @@ -186,11 +203,6 @@ (,(rx-to-string `(: symbol-start (| ,conid ,consym) symbol-end)) . 'haskell-tng:constructor) - ;; some things look nicer without faces - (haskell-tng:font:none - (0 'default t)) - ;; TODO: remove faces instead of adding 'default - ))) (defun haskell-tng:font:multiline:anchor-rewind (&optional group jump) @@ -220,16 +232,6 @@ Some complexity to avoid matching on operators." (goto-char open) (re-search-forward (rx (+ anything)) close t))))))) -(defun haskell-tng:font:none (limit) - "Things that should not be fontified." - (when-let ((p (re-search-forward - (rx (any ?\( ?\) ?\[ ?\] ?\{ ?\} ?,)) - limit t)) - (pp (syntax-ppss))) - (if (or (nth 3 pp) (nth 4 pp)) - (haskell-tng:font:none limit) - p))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Here are `function' matchers for use in `font-lock-keywords' and ;; `font-lock-extend-region-functions' procedures for extending the region.