jming422/fira-code-mode

x ligature usage inverted in C mode

dalepsmith opened this issue · 8 comments

The "x" is supposed to be for hex literals, right? I'm getting exactly the opposite.
With int foo(int x) { return x != 0x24; } the 0x24 is normal and the other two "x" are ligatures.

x-fira-code

Ah, you're right. This is a limitation of prettify-symbols-mode's default behavior - see https://stackoverflow.com/a/24458070 for more info - but I forgot that this ligature is supposed to be for 0x style substitutions. Usually I disable the x ligature since I find it unnecessary (don't write a lot of hex), which is why I never noticed it before.

I have a couple ideas for how to make 0x still work - I'll let you know what I find 👍

I'm making good progress on an update that will add this feature to fira-code-mode - I'm planning on using a font-lock keyword to allow for this substitution. I'll update again when it's ready!

I've added this feature as of 152b67b, update is on master & melpa. Give it a shot and let me know if it works for you!

The new hex literal ligature can be turned on/off independently of x getting a ligature in other cases, so if you want the hex literals but not the standalone x ligature, just add "x" to fira-code-mode-disabled-ligatures.

However, bare "x" identifiers are still displayed as the ligature. Is there a way to disable that?

Yes, sorry, that's what I was trying to explain at the end of my last message:

if you want the hex literals but not the standalone x ligature, just add "x" to fira-code-mode-disabled-ligatures

You can set that variable in your config, or using Customize: M-x customize-option RET fira-code-mode-disabled-ligatures RET

Glad the literals are working now 😄

Yess!!

Thank you!