Enabling Font Ligatures in emacs-mac-port


Several months ago, I switched to using Iosevka1 as my main font for both editor and terminal.

It's an awesome font with reasonable defaults while providing the same customizability as Input2.

Additionally, it also supports font ligatures3 (while Input removed its support for ligatures in its latest version4)


I first noticed this feature in a talk given by Dave Thomas5. In this talk, his Elixir code looked better in Emacs with the font ligature feature enabled. (Though, he's using a different font, FiraCode maybe)


So I tried to get the same effect in my Emacs.


Then I found this simple function to enable this feature for emacs-mac-port6:

(mac-auto-operator-composition-mode t)

Unfortunately, this function does not exist in GNU Emacs for macOS. Because GNU Emacs doesn't support font ligature yet. (You can kind of enable it via prettify-symbol-mode7)

(P.S. actually, I've tried to move back to GNU Emacs for a lightly better performance. But I found I kinda missed this font ligature feature and other nicer integration with the whole macOS system. And the performance of emacs-mac-port got better and better through Emacs 25 and Emacs 26.0.90. So I think I'm gonna stick with emacs-mac-port for a while.)

The result looks like this:


Hope this post can help you! And you can find more information below: