-
-
Notifications
You must be signed in to change notification settings - Fork 247
Make three font-lock faces customizable #466
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
Conversation
Two notes from me:
|
71c19e1
to
9ed4724
Compare
9ed4724
to
f8dc91b
Compare
IOW, clojure-mode currently decides that (I could open a PR introducing 12 deffaces... but better to go on an as-needed basis) |
That certainly seems related to me. :-) |
"Face used to font-lock the Clojure global constants: nil, true, false." | ||
:package-version '(clojure-mode . "3.0.0")) | ||
|
||
(defface clojure-def-symbol-face |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm don't like this idea. There's nothing special about definitions that warrants a different face for them.
"Face used to font-lock the symbols `def`, `defn`, and all detected variants (be them from clojure.core or not)." | ||
:package-version '(clojure-mode . "3.0.0")) | ||
|
||
(defface clojure-lambda-arg-face |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why they can't be font-locked as variables, as this is what they are. That seems like an odd decision to me. And I don't think we use the variable face for anything but them.
But what you're suggesting goes against the spirit of what your saying - we don't care about definitions, we care about I general I'm ok to add some extra faces for things that are not part of the standard Emacs font-locking, but I'm not ok with adding faces for subjective reasons. |
Hi there, thanks for sharing your reasoning!
Fair enough, although it also can be frustrating to be limited by design decisions made maybe decades ago. font-lock presumes that all languages' syntaxes can be mapped 1-1 to each other, e.g. all languages have "constants" (therefore That's a noble goal to seek, and probably it's good enough 95% of the times. But eventually someone will want finer-grained control for his favorite language. Maybe if I explain my exact use case you'll see it better. Corrections welcome.
It's great that those names are in a distinct, stronger color from anything else. That way my eyes can easily find the
The names aren't prominent anymore. So, the symbols
I hope I gave a good-enough rationale! In any case, we can make the docstrings advocate the "normal" thing: - "Face used to font-lock the Clojure global constants: nil, true, false."
+ "Face used to font-lock the Clojure global constants: nil, true, false. Note that you should normally configure font-lock-constant-face instead" WDYT? Cheers - Victor |
Rumination appreciated! I see the point of your screenshot, it's nice but if you look at the third defn, there's no contrast between Generally I strive to keep things visually separated: |
f8dc91b
to
9ac4fa0
Compare
9ac4fa0
to
507f9e3
Compare
Updated PR to solve merge conflicts. Could you give a think to the pending disagreement? |
CIDER: for stability, they are deprecated functions I depended on clj-refactor: simlply for allowing the CIDER fork, since it had a package-require clojure-mode: for clojure-emacs/clojure-mode#466
I completely forgot about this. The first face doesn't really make sense anymore as we dropped the notion of special face for interop forms. We also dropped the notion of a special face for SNAKE_CASE constants, I guess having a special face for 3 constants is pointless now. And I still don't think that definitions warrant a special face, so I'm inclined to just reject this suggestion. @clojure-emacs/cider any thoughts from anyone else? |
No issue, thanks for the reply! I was thinking, while my goal is somewhat reasonable (namely: to color Clojure as I deem semantic), the needs of 1 developer shouldn't impact the clojure-mode codebase. Perhaps a cleaner solution would be to separate the relevant .el parts to a different So basically you'd have the same code as today, but split into more files. |
Well, you can always replicate the approach of https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode-extra-font-locking.el This is some font-locking that used to live in clojure-mode, but I deemed it too unreliable and removed it, but I still provided it as a package in case someone really liked it. |
Introduce
clojure-global-constant-face
,clojure-def-symbol-face
,clojure-lambda-arg-face
.Updated tests, although I couldn't get to run them (never had done so. Tried with
M-x ert
):