Not working in python-mode? #27
Closed
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 "]?"))
"\\)[[({:;.,?!]?")) |
wavexx
added a commit
to wavexx/hl-todo
that referenced
this issue
Jul 10, 2018
- 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 ":!?"
wavexx
added a commit
to wavexx/hl-todo
that referenced
this issue
Jul 10, 2018
- 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 ":!?")
wavexx
added a commit
to wavexx/hl-todo
that referenced
this issue
Oct 3, 2018
tarsius
added a commit
to wavexx/hl-todo
that referenced
this issue
Oct 3, 2018
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: