Skip to content
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

Fix variable name face #212

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bbatsov
Copy link
Contributor

@bbatsov bbatsov commented Feb 4, 2025

The face is used for definitions, not variable references. (think defvar in Elisp)

Old:

That face should have font-locked the names in the var definitions here.

image

New:

Same as above, but with names in var defs in lavender.

Contrary what was indicated in the code that face is used
for variable definitions, not variable references.
@sgoudham
Copy link
Contributor

sgoudham commented Feb 4, 2025

I don't have the context to this but Catppuccin, generally, should only modify the colours in a port and not change the font size / shape / etc. We should always rely on defaults wherever possible so the introduction of this PR feels like we're modifying this elsewhere where we shouldn't be?

If this is introducing new customisation options then I'd personally push back against it as you shouldn't need to configure font settings via a colourscheme.

@bbatsov
Copy link
Contributor Author

bbatsov commented Feb 4, 2025

My point is mostly that the way this was configured simply doesn't make sense in the context of Emacs. From what I gather the original version was written for Vim and then was ported to other editors, but variable-name-face in Emacs is not an usage of a variable, but a definition of a variable and almost all Emacs themes font-lock this, so those would stand out.
It seems to me that whoever styled this, thought this pertains to variable usage, but in reality it doesn't.

E.g. here's how the same snippet looks with the popular Solarized theme:

image

@bbatsov
Copy link
Contributor Author

bbatsov commented Feb 4, 2025

Similarly you'll notice that for some reason doctrings are styled as comments, even if they are strings. Even in the reference catppuccin screenshots those are green:
image

@bbatsov
Copy link
Contributor Author

bbatsov commented Feb 4, 2025

To summarize - my main concern (and the problem I'm trying to solve) is that it seems to me that some of the fundamental font-lock-* colors differ from the ones in the original theme, as probably it wasn't very clear what categories in Emacs map to what categories in Vim.

@jtbx
Copy link
Member

jtbx commented Feb 4, 2025

I don't have the context to this but Catppuccin, generally, should only modify the colours in a port and not change the font size / shape / etc. We should always rely on defaults wherever possible so the introduction of this PR feels like we're modifying this elsewhere where we shouldn't be?

If this is introducing new customisation options then I'd personally push back against it as you shouldn't need to configure font settings via a colourscheme.

@sgoudham Variables such as catppuccin-enlarge-headings have been around since the beginning, but I think removing them would be just fine.

@jtbx
Copy link
Member

jtbx commented Feb 4, 2025

@bbatsov Thanks! I looked into this on #189 and found that different modes use these faces for different things, e.g. nix-ts-mode uses variable-name-face for property names, and c-ts-mode uses variable-name-face for property references. So simply adding a foreground colour to variable-name-face might looks fine for some modes such as elisp mode but it might make c-ts-mode a bit disconcerting due to the amount of colour. It's tricky, it's almost entirely based on how modes use faces and maybe it could work if every mode used every face for the same thing. But I'm afraid it doesn't really work well for a lot of modes...

@bbatsov
Copy link
Contributor Author

bbatsov commented Feb 4, 2025

Yeah, it's true that different modes use this face differently, but I still think it's weird to treat variable definitions and uses in the same manner. Sadly, many major modes were put together hastily without consideration of the semantics of some font-lock-* faces which created a very messy situation across modes.

What about font-lock-doc-face? Would you be open to changing to something that resembles more the face for strings, as the neovim original theme does? (and Emacs themes typically work)

@sgoudham
Copy link
Contributor

@sgoudham Variables such as catppuccin-enlarge-headings have been around since the beginning, but I think removing them would be just fine.

Yeah, I'd like to see them removed in a future PR.

@bbatsov
Copy link
Contributor Author

bbatsov commented Feb 12, 2025

@sgoudham Sure, I can do this. Should I remove only catppuccin-enlarge-headings or all of the configuration options?

@jtbx
Copy link
Member

jtbx commented Feb 12, 2025

catppuccin-enlarge-headings and all the catppuccin-height- variables please :-)

@bbatsov
Copy link
Contributor Author

bbatsov commented Feb 12, 2025

See #217.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants