Closed bennyandresen closed 6 years ago
How does Clojure do it? Is only the immediate form highlighted as a comment? And does this highlighting span multiple lines?
Multiple lines (the whole form), see here:
Ok, sure I can add this. The multiple lines part makes it a bit more involved than the other font-locks.
Are indentation rules preserved inside the commented form? Or does it behave like a string, ie. inserting a newline within the captured from will indent at the margin?
I have the former working already. The latter needs requires another approach than font-locks.
03322cf34d94ba99aa86f8b3fa213c81a5c185b7 #_ now supported, I checked Clojure and indeed its the former, and I see why.
Doesn't work for me:
(defn foo-bar [baz]
(setv foo (-> (.get baz QUUX)
(. value)
first))
(or foo 0))
Only (. value)
receives the comment font-lock. Other defns
don't receive any font-lock at all.
Any form with other syntax highlighting broke it for the form, moving this keyword to the top fixes this.
However, the constant 0
is also highlighted and still overwrites the comment tag.
So almost solid, have to understand why constants are special.
I believe #_
should work now for everything: e84eb689b93feca77713c0f3e3303e52772a32f1
Constants are actually handled by highlight-numbers-mode
which was causing issues before.
I can confirm that this works! Thanks @ekaschalk!
Feature Request:
The clojure-mode does it. I checked clojure-mode.el a bit but font-locking makes no sense to me.
Would be nice to have. :-)