You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
#_ comments are not marked as comments (e.g. via syntax-table text property) #425
Actually, I think the regex is fine. My guess would be that the code that uses that regex is just not setting the syntax-table text property. Should be easy to fix.
I saw the comment but didn't succeed in getting enough from it to investigate in a meaningful way :)
It wasn't clear here what "the regex" refers to as, IIUC, the original link no longer points to a regex, and consequently I'm not succeeding in interpreting what "the code that uses that regex" points to.
I checked what might have been or was close to the master branch around June of 2017. Assuming what turned up was not off by much, the regex in question may be:
(defvarclojure--comment-macro-regexp
(rx"#_" (*"") (group-n 1 (not (any ""))))
"Regexp matching the start of a comment sexp.The beginning of match-group 1 should be before the sexp to bemarked as a comment. The end of sexp is found with`clojure-forward-logical-sexp'.
and the code that uses it (indirectly via clojure-comment-regexp) may be the function clojure--search-comment-macro-internal (and may be its friend clojure--search-comment-macro).
Perhaps an appropriate call or calls to put-text-property would be appropriate? Any help / hints on the precise argument values and where such a call or calls ought to go?
Sorry I can't be of more help here, but it's been a while since I've dealt with syntax tables and my memory is not helping.
What I can say is that it is possible to specify certain text properties that should be cleared when font-lock runs on a region. So, in theory, you don't have to manually clear the value if the #_ is removed. Look into font-lock-extra-managed-props.
On a side note, to use edebug to investigate, it seems doing (setq font-lock-support-mode nil) first seems to help a lot...
Oh my. I've had to edebug font-locking functions before and I can say I do not envy you. ;-)
Activity
arichiardi commentedon Jun 14, 2017
Maybe this regex needs tuning?
Malabarba commentedon Jun 19, 2017
Actually, I think the regex is fine. My guess would be that the code that uses that regex is just not setting the syntax-table text property. Should be easy to fix.
sogaiu commentedon Apr 4, 2019
Is this diagnosis still correct? That is, does it still appear to be an easy fix? Any further hints or pointers on how this might be fixed?
dottedmag commentedon Apr 4, 2019
Yes, yes, and see the comment from @Malabarba.
sogaiu commentedon Apr 4, 2019
I saw the comment but didn't succeed in getting enough from it to investigate in a meaningful way :)
It wasn't clear here what "the regex" refers to as, IIUC, the original link no longer points to a regex, and consequently I'm not succeeding in interpreting what "the code that uses that regex" points to.
Any hints / clarifications on these things?
sogaiu commentedon Apr 5, 2019
I checked what might have been or was close to the master branch around June of 2017. Assuming what turned up was not off by much, the regex in question may be:
and the code that uses it (indirectly via clojure-comment-regexp) may be the function clojure--search-comment-macro-internal (and may be its friend clojure--search-comment-macro).
Perhaps an appropriate call or calls to put-text-property would be appropriate? Any help / hints on the precise argument values and where such a call or calls ought to go?
sogaiu commentedon Apr 5, 2019
Does putting something like:
right before the t at the end of clojure--search-comment-macro-internal function seem close?
Will (setq parse-sexp-lookup-properties t) be necessary too?
Also, do those text properties need to be removed if the leading #_ is removed / disabled?
On a side note, to use edebug to investigate, it seems doing (setq font-lock-support-mode nil) first seems to help a lot...Malabarba commentedon Apr 5, 2019
Sorry I can't be of more help here, but it's been a while since I've dealt with syntax tables and my memory is not helping.
What I can say is that it is possible to specify certain text properties that should be cleared when font-lock runs on a region. So, in theory, you don't have to manually clear the value if the
#_is removed. Look intofont-lock-extra-managed-props.Oh my. I've had to edebug font-locking functions before and I can say I do not envy you. ;-)
sogaiu commentedon Apr 5, 2019
Thanks for the hints, font-lock-extra-managed-props sounds promising.
As to debugging font-lock-related functionality, it would be much worse if I had not found font-lock-studio ;)
sogaiu commentedon Apr 6, 2019
The following appears to help here:
@dottedmag @arichiardi @Malabarba any time / interest in giving it a review / try?
andreyorst commentedon Dec 23, 2020
Can confirm that the patch above works:
screenshots with rainbow delimiters
before patch:

with patch:

Although it introduces another bug, which results in wrong matching of ignored parentheses with
show-smartparens-mode:On the other hand, this doesn't happen with
show-paren-mode, so maybe this is a bug in smartparens