jming422 / fira-code-mode

Emacs minor mode for Fira Code ligatures using prettify-symbols
GNU General Public License v3.0
103 stars 11 forks source link

fira-code-mode-enable-hex-literal activates in non-hex locations #28

Closed mwanderman closed 8 months ago

mwanderman commented 8 months ago

fira-code-mode turns x into the hex ligature in incorrect places: when x is by itself and when 0 preceeds the x even though there are more characters. It would be better to check for \b0x[a-fA-F0-9] to reduce the false positives.

This is how it renders

# Taken from www.10x.com
def add(x, y):
    return x + y

fira code

jming422 commented 8 months ago

Good find, thank you for reporting! Pushing an update now that should fix this: CleanShot 2024-02-28 at 09 28 06

mwanderman commented 8 months ago

Thanks for the quick response. It's much improved (good thought on 0xabcdefg and 0xhex), but x by itself still shows up as the ligature.

def add(x, y):
    return x + y

fira

jming422 commented 8 months ago

I'm unable to reproduce this on my config:

CleanShot 2024-03-01 at 16 43 18 CleanShot 2024-03-01 at 16 42 38

If you put your point over the x, does it return to its usual glyph, or does it keep showing the multiplication symbol while your point is over it?

If it returns to normal on hover, then adding "x" to fira-code-mode-disabled-ligatures may fix this as long as another package isn't also changing prettify-symbols-alist (I know python-mode sometimes does this, adding extra ligatures to that variable).

If it doesn't change on hover, then it is probably a font-lock issue... if you quit Emacs all the way and reopen and it continues happening only after enabling fira-code-mode, let me know and I can continue investigating