-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Not working in python-mode? #27
Comments
I can't see a reason why this wouldn't work in |
On Mon, Jul 09 2018, Jonas Bernoulli wrote:
I can't see a reason why this wouldn't work in python-mode. Maybe this is just
an instance of #26.
It doesn't look like. My guess was some quirk in the syntax-table, but I
didn't have time to debug yet.
Out of curiosity, can you reproduce that? A simple python buffer with
# TODO:
should do.
|
Mmh, no. After further testing, with a plain emacs -q it works :/ |
Ok, I actually found what the issue is. |
(setq hl-todo-highlight-punctuation ":"
hl-todo-keyword-faces '(("TODO" . "#000000))) Doesn't work correctly in python-mode. With the sample file: # TEST: me You can see that ":" is not highlighted. Previously I had "TODO:" as a keyword (with the colon directly in the name). The issue here is indeed related to the syntax table of python-mode. In the keyword regexp, "_>" doesn't match correctly after the colon. I recommend moving the anchor "_>" just after the keyword block to avoid this issue: (concat "\\(\\_<" (regexp-opt (mapcar #'car hl-todo-keyword-faces) t) "\\_>"
(and (not (equal hl-todo-highlight-punctuation ""))
(concat "[" hl-todo-highlight-punctuation "]?"))
"\\)[[({:;.,?!]?")) |
- Anchor the keywords themselves, not the punctuation (fixes tarsius#27) - Mach a variable amount of punctuation at the end (highlights correctly "TODO?!?" with hl-todo-highlight-punctuation ":!?"
- Anchor the keywords themselves, not the punctuation (fixes tarsius#27) - Match a variable amount of punctuation after the keyword (highlights correctly "TODO?!?" with hl-todo-highlight-punctuation ":!?")
Exclude the non-word characters from anchoring. This was useful for testing: ;; character syntax meaning ;; TODO TODO: : _ symbol ;; TODO TODO§ § . punctuation ;; TODO() ;; TODO(topic) previously explicitly highlighted, now implicitly ;; TODO:noise previously not highlighted, now highlighted ;; TODOnoise still not highlighted Fixes tarsius#27. See tarsius#28.
I'm using emacs 27 from git so I could be an outlier, but I noticed today that hl-todo doesn't seem to find any hit in python-mode's comments.
The text was updated successfully, but these errors were encountered: