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

No highlighting in comment. #172

Open
jcs090218 opened this issue Jul 23, 2020 · 5 comments
Open

No highlighting in comment. #172

jcs090218 opened this issue Jul 23, 2020 · 5 comments

Comments

@jcs090218
Copy link
Contributor

Does anyone encountered that when opening a lua file; the comment doesn't get highlighted. 😕 I have tried to reinstall the package but nothing changes. 😕 😕 😕 😕 😕

@jcs090218
Copy link
Contributor Author

The cause by this is having (modify-syntax-entry ?- "_") inside my lua-hook. Is there a way to avoid this? Thanks!

@immerrr
Copy link
Owner

immerrr commented Jan 8, 2021

Sorry about the delay in response.

Firstly, to start any troubleshooting with Emacs packages it is useful to reproduce the behaviour with emacs -Q -l lua-mode.el to ensure that your personal configuration is not at fault. If the package works without your config, but fails with it, try disabling pieces of it until you arrive at a minimal example that breaks the package. It is much easier to see what is going on from the package perspective when there is a clear and small repro to follow.

Re: the syntax table modification, it is definitely something that will throw Emacs off. If you check the syntax entry in lua-mode itself, you can see that - has multiple syntax flags: it is considered as punctuation (.) and also as the first and the second characters of a comment starting sequence (12). If your new syntax table entry is missing the second part of the syntax descriptor, then it is natural that Emacs is not highlighting anything as comments. This section of Emacs documentation should help you to fix the problem.

@astoff
Copy link
Contributor

astoff commented May 24, 2021

Shouldn't comment-use-syntax be nil in Lua mode? Searching for the regexp "\\s<+" doesn't take you to the next comment, presumably because - has other meanings as well in Lua.

@shubham-cpp
Copy link

shubham-cpp commented May 1, 2022

Facing the same issue.
image

I've this inside my emacs config (modify-syntax-entry ?- "w").

Did try this with vanilla emacs and didn't face this issue but is there a workaround for this when using modify-syntax

@igorepst
Copy link

igorepst commented Apr 25, 2024

I wrote the following right now. Seems to work properly:

(add-hook 'after-change-major-mode-hook
  (lambda()
    (modify-syntax-entry ?_ "w")
    (pcase major-mode
      ('lua-mode
       (modify-syntax-entry ?- "w 12"))
      ('sql-mode
       (modify-syntax-entry ?- "w 12b"))
      (_ (modify-syntax-entry ?- "w")))))

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

No branches or pull requests

5 participants