spacemacs
spacemacs copied to clipboard
Ligatures interact badly with header-line-format, hanging emacs
Description :octocat:
Enabling unicode-font-ligatures for all modes causes bad interactions with magit and hangs emacs.
In particular, setting header-line-format
to some string that would
contain a ligature, in a major-mode selected by
unicode-fonts-ligature-modes
, appears to immediately cause the emacs
process to hang.
Reproduction guide :beetle:
- Enable unicode-fonts layer with
unicode-fonts-enable-ligatures
set to t - Start Emacs
- Navigate to some git repo
- Press
SPC g s
- Press
l L
(magit-log-branches
)
Observed behaviour: :eyes: :broken_heart:
Emacs hangs, using 100% CPU, as soon as magit-set-header-line-format
is called.
Expected behaviour: :heart: :smile: Magit shows log of all local branches.
System Info :computer:
- OS: darwin
- Emacs: 27.1
- Spacemacs: 0.300.0
- Spacemacs branch: unicode-fonts-layer-docs (rev. 691dc6e98)
- Graphic display: t
- Distribution: spacemacs-base
- Editing style: hybrid
- Completion: ivy
- Layers:
(spell-checking
(syntax-checking :variables syntax-checking-use-original-bitmaps t)
(auto-completion :variables auto-completion-idle-delay 1.0)
(ivy :variables ivy-enable-advanced-buffer-information t)
helpful ibuffer
(org :variables org-projectile-file "TODO.org" org-want-todo-bindings t)
(unicode-fonts :variables unicode-fonts-enable-ligatures t unicode-fonts-ligature-modes
'(prog-mode text-mode magit-log-mode))
autohotkey c-c++ csv nil emacs-lisp nil nil html
(javascript :variables javascript-fmt-tool 'prettier javascript-fmt-on-save t)
json markdown ocaml perl5 python ruby rust scheme shell-scripts sql
(typescript :variables typescript-fmt-tool 'prettier typescript-fmt-on-save t)
yaml nixos osx git
(version-control :variables version-control-diff-tool nil)
spacemacs-completion spacemacs-layouts spacemacs-editing spacemacs-editing-visual spacemacs-evil spacemacs-language spacemacs-misc spacemacs-modeline spacemacs-navigation spacemacs-org spacemacs-project spacemacs-purpose spacemacs-visual command-log fasd finance
(shell :variables shell-enable-smart-eshell t)
spotify bcc32-org)
- System configuration features: NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER
Backtrace :paw_prints:
None, Emacs just hangs as soon as header-line-format
is set.
I have had a bit of a play with this and could not get this issue in magit however I did get this when finding a file with SPC f f
I narrowed it down to ..
and ...
when removing them from unicode-fonts-ligature-set
I was then able to use find file.
@bcc32 if you could try the below ligature set and let me know if this sorts out your issue.
unicode-fonts-ligature-set '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
"+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
"<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
"##" "#(" "#?" "#_" "%%" ".=" ".-" ".?" "+>" "++" "?:"
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
"\\" "://")
Strange. I was able to reproduce with magit using both macos and linux. I don't have any issue with find-file
; I'm using ivy, which doesn't use a header-line unlike helm. If you use helm, maybe that's what happened?
Using your suggested ligature set does not fix the issue for me, but removing the "--"
entry does (occurs in the string Commits in --branches
).
One way around this issue would be to only enable ligatures by default in prog-mode
and text-mode
, skipping weird special and fundamental modes.
I found a few threads mentioning similar issues:
- https://github.com/tonsky/FiraCode/issues/158
- https://github.com/emacsorphanage/helm-ag/issues/308
- https://www.reddit.com/r/emacs/comments/icem4s/emacs_271_freezes_when_using_font_ligatures/
Apparently this might be fixed in Emacs by https://github.com/emacs-mirror/emacs/commit/fe903c5ab7354b97f80ecf1b01ca3ff1027be446, which should hopefully be part of Emacs 28.
I also just encountered this same issue in org-mode, FWIW. Probably another instance of --
.
this is an upstream bug. Unicode ligature conflicts with multiple component in lsp-mode and lsp-ui-mode, such as hearderline, sideline, and code lens.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
I think this is indeed stale, now that Spacemacs only enables ligatures in prog-mode by default. At least, the out-of-the-box behavior is not buggy, and I believe the bug is mitigated in Emacs 28+. Closing.