Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some features hang with font ligatures #6468

Closed
tobia opened this issue Jun 30, 2016 · 8 comments
Closed

Some features hang with font ligatures #6468

tobia opened this issue Jun 30, 2016 · 8 comments
Labels
- Bug tracker - Fonts macOS stale marked as a stale issue/pr (usually by a bot)

Comments

@tobia
Copy link

tobia commented Jun 30, 2016

Description

Some features stop responding when some font ligatures are enabled on Mac OS X with:

(set-char-table-range composition-function-table ...)

Reproduction guide

Observed behaviour:

  • Emacs goes to 99% CPU. You need to close the helm buffer (Cmd-w) and then hit Esc to make Spacemacs work again.

Expected behaviour:

  • The requested function should just work, with any sequence of symbols replaced by its ligature as appropriate

I tried to narrow down which of the settings cause it to hang. I got it down to the following two:

(let ((alist '((45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
               (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)"))))
  (dolist (char-regexp alist)
    (set-char-table-range composition-function-table (car char-regexp)
                          `([,(cdr char-regexp) 0 font-shape-gstring]))))

Either of the two (or both) make Emacs hang as described. They seem to enable the ligatures that start with a - or a . which should be:

-> --> ->> -< -<< --> -- --- -~ 
.= .- .. ... ..< 

System Info

  • OS: darwin
  • Emacs: 24.5.1
  • Spacemacs: 0.105.21
  • Spacemacs branch: master (rev. 0283f64)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(emacs-lisp 
 haskell
 (osx :variables osx-use-option-as-meta nil))

Backtrace

screen shot 2016-06-30 at 23 54 29

(sorry, I couldn't figure out how to copy or save the backtrace buffer contents)

@tobia tobia changed the title Helm hangs with font ligatures Some features hang with font ligatures Jun 30, 2016
@tobia
Copy link
Author

tobia commented Jun 30, 2016

I'm pretty sure the culprit is -> because it's a symbol that appears in the screens than hang (helm-theme, M-x…) and most importantly, I can reproduce the issue by enabling this single ligature:

(set-char-table-range composition-function-table 45 '(["->" 0 font-shape-gstring]))

and make the issue go away by disabling it:

(set-char-table-range composition-function-table 45 nil)

I'm an Emacs newbie, so I have a few questions:

  1. Is this a bug in Spacemacs, in Helm, or in Emacs itself?
  2. Can I disable the ligatures in Helm buffers and keep them in source code?
  3. Can you think of any other workaround?

@a13ph
Copy link

a13ph commented Jul 1, 2016

sorry for somewhat passer-by style, but better something useful early even if little

  1. I didn't think ligatures (that stuff at least) are supported yet/well. BTW, take a look at debugging section on Spacemacs github wiki
  2. You should be the one providing test information about that, ideally, by trying to replicate it with/without Helm (you can set your completion to ivy for example), Spacemacs (SPC q D on develop or just run emacs with -q flag to ignore .emacs.d)
  3. Probably possible.

@CarlQLange
Copy link
Contributor

👍 I'm seeing this too. Going to have a little debugging session soon.

@porglezomp
Copy link
Contributor

I wasted a few hours today trying to deal with this before finding this issue. Have any of you guys found a workaround besides disabling ligatures entirely?

@CarlQLange
Copy link
Contributor

I didn't get anywhere. :( I just decided to use prettify-symbols-mode.

@spijet
Copy link

spijet commented Aug 28, 2016

I confirm the same problem on Linux (Exherbo x86_64, Emacs 24.5). Eval'ing the Fira Code example hangs Spacemacs when SPC b b'ing to another buffer.

@fmthoma
Copy link

fmthoma commented Apr 14, 2017

Just a hint (I don't experience this problem, just happened to stumble upon this thread): One culprit could be the regex itself. Some pathological regexes lead to ridiculous amounts of backtracking, which would explain why your CPU is maxed out.
See also this blog post about a similar issue in Atom.

@github-actions
Copy link

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!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Bug tracker - Fonts macOS stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

7 participants