Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
CIDER is not font-locking required vars #1985
CIDER font locks vars and functions from the current namespace and clojure.core functions and vars. It should also font-lock imported vars from your own namespace. But it does not.
This behavior is controlled by
Steps to reproduce the problem
Minimum example is found at https://github.com/dpsutton/font-lock-bug
But make your namespace as small as possible and import a namespace with only a single function in it. I also changed this so it wasn't adding clojure.core, just for making the regex easier to watch. This function is in
Environment & Version information
CIDER version information
a good lein
tip of master
Interestingly, if you change the
Otherwise, as far as I can tell, there are two things that control font-locking: this regex and if something is marked to not be font-locked with some substring properties, either ns forms or local vars. Everything seems like it should work so it must be just the slash escaping.
I played around with this today, because I really want it to work. It seems to be caused by clojure-mode, which font locks the namespace part. https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L840
If I comment that out, it starts working. But I don't know where to go from here to produce a good solution. I hardly know anything about font locking.
By the way, things defined with
Fixing this is kind of annoying, I think. The problem stems from the fact that the font locking is essentially complex. Clojure-mode has a long list of things that it checks for, and the order matters. We want to essentially remove one (or perhaps even two, because there is a rule that says anything starting with 'def', 'with' or 'let' should be colored as macros) element from clojure-mode's
As far as I can see, there are a couple of solutions, none of which is great.
If I had to decide I would chose 1.
But maybe someone has a better idea?
referenced this issue
Sep 19, 2017
I think it might be easiest to just modify the
There might be some better solution as well, but I don't have time to look into this myself. I wrote this ns font-locking code way before CIDER had this feature and because many people use Clojure mode without CIDER I don't think it's a good idea to just remove it.