Skip to content

feat: highlight faces #2

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

JimMoen
Copy link

@JimMoen JimMoen commented Feb 20, 2025

few highlight faces:

@JimMoen JimMoen force-pushed the feat-highlight-faces branch from 8cc0a94 to a37f7d2 Compare February 23, 2025 21:59
@@ -306,7 +422,8 @@ Use `treesit-font-lock-level' or `treesit-font-lock-feature-list'
(advice-add #'erlang-font-lock-level-3 :around #'erlang-ts--font-lock-level-3)
(advice-add #'erlang-font-lock-level-4 :around #'erlang-ts--font-lock-level-4)

(treesit-major-mode-setup))
(treesit-major-mode-setup)
(setq-local syntax-propertize-function #'erlang-ts--syntax-propertize))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's prudent to use syntax-propertize-function in a TreeSitter-powered mode, as you'll font-locking stuff at two different levels.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's used to modify char syntax in captured string.
since:

...
  :syntax-table erlang-mode-syntax-table
...

erlang-mode marked char $ as "/", aka character-quote.
see also https://github.com/erlang/otp/blob/master/lib/tools/emacs/erlang.el#L1569

set syntax-propertize-function only for put-text-property to avoid ', ", $ are incorrectly highlighted in string or binary, and now there are triple-quoted string.

(Also, some emacs packages use char-syntax to jump between words.
The erlang char $a causes these packages to try to find another $ character to match the bracket)

A new commit copied erlang-mode-syntax-table and unset $.

@JimMoen JimMoen force-pushed the feat-highlight-faces branch from 9f8ace0 to e6c3a85 Compare March 13, 2025 09:21
- for char like `$'`, `$"`, `$\"`, modify text property as word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants