Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use font-lock-fontify-region-function directly #1131

Closed
6 tasks
gracjan opened this issue Feb 4, 2016 · 3 comments
Closed
6 tasks

Use font-lock-fontify-region-function directly #1131

gracjan opened this issue Feb 4, 2016 · 3 comments

Comments

@gracjan
Copy link
Contributor

gracjan commented Feb 4, 2016

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
@gracjan
Copy link
Contributor Author

gracjan commented Feb 4, 2016

@deepfire, I'm pinging you about this one issue as I know you were good with large overhauls. Can you fix this one?

@gracjan
Copy link
Contributor Author

gracjan commented Feb 16, 2016

Step in this direction is in #1157.

@gracjan
Copy link
Contributor Author

gracjan commented Feb 18, 2016

Hmm, there might be an issue with rainbow-identifiers. Investigate.

@gracjan gracjan closed this as completed Jul 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant