2

Is there a way to enable ligatures in Emacs other than using font-lock?

I'm asking because font-lock is slow on reasonably large buffers.

After having read it https://www.reddit.com/r/emacs/comments/os6z0d/is_there_support_for_ligatures_in_gnu_emacs/ it seems to me like Emacs is lacking built-in support for ligatures. Afaict, ligatures should be implemented in the font-rendering layer. Am I wrong?

1 Answer 1

4

Like a comment on the reddit thread you linked says, Emacs with HARFBUZZ support can use https://github.com/mickeynp/ligature.el (available on Melpa as ligature)

My config for Julia Mono:

(use-package ligature
  :config
  (ligature-set-ligatures '(prog-mode
                            org-mode
                            lsp
                            cc-mode
                            haskell-mode
                            emacs-lisp-mode)
                          '("->" "<-" "-->" "<--" "<-->"
                            "|>" "<|" "=>" "==>" "::"))
  (global-ligature-mode t))
2
  • Thank you so much.
    – Nordlöw
    Commented Nov 14, 2022 at 12:46
  • I just discoverd JuliaMono, but I can't get ligatures to work in Emacs. It's strange, because I'm using ligature.el just fine with various NerdFonts with ligatures.
    – g-gundam
    Commented Sep 2, 2023 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.