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

Ligatures not working after following install directions #11

Closed RobertARandolph closed 3 years ago

RobertARandolph commented 3 years ago

I've installed this fine on multiple computers, and I've tried using an identical configuration (copy .emacs.d over and other files).

I've checked that:

My modeline looks like the image below with fira-code-mode on.

Screen Shot 2020-11-12 at 21 54 21

And like this with it off:

Screen Shot 2020-11-12 at 21 54 26

What further debugging information can I provide and how?

RobertARandolph commented 3 years ago

Here's what I see in a buffer with fira-code-mode on, then with it off:

On:

Screen Shot 2020-11-12 at 22 25 54

Off:

Screen Shot 2020-11-12 at 22 26 01
jming422 commented 3 years ago

Interesting. I haven't seen this before, but it looks like there's another font on your system which defines characters for the same part of the Unicode private use area that the Fira Code Symbol font uses (which is \ue100 through \ue16f). For some reason that font is being used to display these characters instead of Fira Code Symbol.

There is likely a way to configure Emacs prefer the Fira Code Symbol font for these characters, but I'm not sure what it is off the top of my head. I'll try and find time in the next few days to look into this and get back to you!

RobertARandolph commented 3 years ago

Thank you. I'll double check and see if I can find anything else going on as well.

RobertARandolph commented 3 years ago

I've uninstalled all non-system-provided fonts and reinstalled Fira Code Symbol, same issue.

I've played with the elisp a bit and did not make any significant progress.

Somewhat interestingly, this method works. It's the only ligature solution that appears to work on this system??

jming422 commented 3 years ago

Hi there, sorry it's been more than a couple days, but I finally got some time to poke around a bit. 😅

First of all, I tried to reproduce with latest emacsformacosx, and it all seemed to work fine for me. Seems like it has to do with some configuration of your particular system.

Second of all, have you tried running M-: (fira-code-mode--setup) RET? I've yet to run across a system where I needed to use that function, but I included it after reading the method you linked to. Try running it and seeing if it fixes it; maybe you could also put the function in your config or in after-make-frame-functions. If the method you linked worked for you, then I'm hopeful that fira-code-mode--setup will fix it.

If it doesn't fix it, then I'm sure there are some macOS system font options that I've never seen before. It could be that something in System Preferences introduces a conflict in this area of Unicode space. Do you have any languages besides English enabled in the "Languages & Region" section of System Preferences? That might do it, but I'm not sure.

jming422 commented 3 years ago

If you want additional debugging info, if you put your point on the character right before a misbehaving ligature begins, you can use M-: (describe-char (+ 1 (point))) RET to pull up a *Help* buffer describing the properties of the character. It might be interesting to compare it to the results of calling that function on the same character on a system where fira-code-mode is behaving as expected.

For reference, here's an example of describe-char's output with one of the more important parts highlighted. The entries for Fira Code-normal before Fira Code Symbol are because I happen to use Fira Code as my regular font as well, but that could be any font and it shouldn't matter. What's important is that Fira Code Symbol is in the list and that it shows the "composed" character before the :, in this case it's =>. Screen Shot 2020-12-08 at 3 54 31 PM

plasorak commented 3 years ago

Hi, continuing on this discussion... What happens if this last line isn't fira code symbol? I have Hannotate and get Japanese or Chinese characters instead.

jming422 commented 3 years ago

If the last line isn't Fira Code Symbol, then you may be seeing ligatures get displayed using some other font besides Fira Code Symbol, which means the ligatures probably won't be showing up right.

Something you could try from my previous comment above:

Second of all, have you tried running M-: (fira-code-mode--setup) RET? I've yet to run across a system where I needed to use that function, but I included it after reading the method you linked to. Try running it and seeing if it fixes it; maybe you could also put the function in your config or in after-make-frame-functions. If the method you linked worked for you, then I'm hopeful that fira-code-mode--setup will fix it.

plasorak commented 3 years ago

Hi, unfortunately fira-code-mode--setup didn't fix it, I still get Chinese characters. It's more like emacs doesn't know about fira code symbols and uses whatever font it comes up with (I have never seen or used the hannotate font). Whilst looking for ways to debug this, I found fira-code-mode-install-fonts and executed it, to make sure I have the font installed, but that didn't solve my problem either.

plasorak commented 3 years ago

ok, I don't know what I changed, but it works after restating my emacs... ¯_(ツ)_/¯

jming422 commented 3 years ago

Glad to hear it! Since there's nothing reproducible here I'm going to close the issue, but feel free to reach out again if other issues crop up.