Use a different face for the extension
Closed this issue · 7 comments
Is there any provision to use a different face for extensions than the "file-name-sans-extension"?
I don't understand the question. file-name-sans-extension
is a function, yes? How is that related to faces?
Yeah I didn't explain that well. I want the file extension to be a different color than the base file name. To me, it's nice to do that because it de-emphasizes the extension in favor of the main part of the file name.
For example, diredfl
does it in this screenshot, where ".bookmarks" is yellow and ".el" after it is green.
Seems like a feature that might be a good fit for dired-rainbow
. It doesn't look to me like dired-rainbow-define
currently has the flexibility to do that (easily).
I think I could expose a low-level version where you can plug a regexp, but is it worth it if diredfl
does it already? Or is it impossible to combine the two packages? In that case it makes more sense.
Both packages modify the file name. But only one font-lock rule can apply to a given region at a time so we can't have dired-rainbow
color the main file name and diredfl
color the extension at the same time, because dired-rainbow
colors the whole thing.
So we would need one rule for the base file name and a separate rule for the extension, regardless of which package those rules are in.
At least that's my best understanding. I'm still pretty new at this. Maybe there's a way to set precedence?
font-lock can be applied on the same region any number of times but the rules need to be written in a way that tells Emacs how to resolve the conflicts. I don't do that in dired-rainbow.
I will accept a pull request for this feature but I don't have the time now to implement it and test it myself.
I can't find dired-rainbow-file-regexp-group
in the latest version. How can I just color the file name base?
Updated: Sorry, I just notice the PR is close.