You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emacs multipass regexp based font lock functionality as defined by font-lock-syntactic-kaywords has a couple of issues with Haskell code, mostly due to heavily overloaded meanings for dot and apostrophe. Meaning of dot as either a module name separator or composition or part of other operator is hard to get right with multipass syntax highlighter.
The solution is to use font-lock-fontify-region-function. It should go over specified fragment of source code using haskell-lexeme-looking-at-token and directly apply faces to token and/or fragments of tokens.
Example how this can be done is in haskell-syntax-propertize-function defined in PR #1039.
Summary:
set font-lock-fontify-region-function to haskell-font-lock-fontify-region
haskell-font-lock-fontify-region should use haskell-lexeme-looking-at-token
haskell-font-lock-fontify-region should apply faces directly
haskell-font-lock-fontify-region should also apply compose directly (subsuming prettify-symbols that has similar issues)
haskell-font-lock-fontify-region should define more faces, for example modules could use different face than constructors
haskell-font-lock-keywords should go away completely
The text was updated successfully, but these errors were encountered:
Emacs multipass regexp based font lock functionality as defined by
font-lock-syntactic-kaywords
has a couple of issues with Haskell code, mostly due to heavily overloaded meanings for dot and apostrophe. Meaning of dot as either a module name separator or composition or part of other operator is hard to get right with multipass syntax highlighter.The solution is to use
font-lock-fontify-region-function
. It should go over specified fragment of source code usinghaskell-lexeme-looking-at-token
and directly apply faces to token and/or fragments of tokens.Example how this can be done is in
haskell-syntax-propertize-function
defined in PR #1039.Summary:
font-lock-fontify-region-function
tohaskell-font-lock-fontify-region
haskell-font-lock-fontify-region
should usehaskell-lexeme-looking-at-token
haskell-font-lock-fontify-region
should apply faces directlyhaskell-font-lock-fontify-region
should also applycompose
directly (subsuming prettify-symbols that has similar issues)haskell-font-lock-fontify-region
should define more faces, for example modules could use different face than constructorshaskell-font-lock-keywords
should go away completelyThe text was updated successfully, but these errors were encountered: