3

I experienced a freeze which can be reproduced very easily on GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.18, cairo version 1.16.0) of 2020-08-25 .

  1. emacs -Q
  2. Copy the Unicode U+27B0 into the scratch buffer: ➰
  3. Emacs frozen for a whole minute and displays ➰.

Remarkably, the response time for other symbols in this Unicode table is quite different, e.g.

  • ➑ takes 30 seconds
  • ➐ is instant.

Is this issue known?

Updates

what-cursor-position

C-u C-x = on the pasted symbol gives (screenshot because Emacs frozen): enter image description here

Profiling & Benchmarking

Unfortunately, this scenario escaped the profiling...

enter image description here

...and the benchmarking which outputs immediately the result when the symbol is not yet present.

enter image description here

Firmin Martin
  • 1,265
  • 7
  • 23
  • That's quite odd. I can't reproduce it here, also on Emacs 28.0.50. I copied the text directly from Firefox and yanked it into the scratch buffer. Each symbol pasted instantly. Maybe it has something to do with the fonts you are using? I have DejaVu Sans Mono:pixelsize=15:foundry=PfEd:weight=normal:slant=normal:width=normal:spacing=100:scalable=true – Tyler Oct 15 '20 at 17:36
  • Thanks. I used `describe-font` on the empty buffer, it's quite the same `DejaVu Sans Mono:pixelsize=18:foundry=PfEd:weight=normal:slant=normal:width=normal:spacing=100:scalable=true`. However, once ➰ is present in the buffer, even `M-x` takes a very long time. – Firmin Martin Oct 15 '20 at 17:52
  • Can't reproduce it either (also 28.0.50 but a few months old). – NickD Oct 15 '20 at 17:57
  • I press `` after that `describe-font` prompts "default current choice for ASCII chars", maybe this font is not the one used for the symbol? I don't know much about fonts. – Firmin Martin Oct 15 '20 at 17:58
  • If you put your cursor on the symbol and say `C-u C-x =` what do you get? – NickD Oct 15 '20 at 17:59
  • @NickD See updated screenshot. If I understand correctly the problematic font is `Symbola` ? I remember that I used to install this font for ancient greek. It can be downloaded [here](https://dn-works.com/ufas/). – Firmin Martin Oct 15 '20 at 18:12
  • Mine says `ftcrhb:-Free-Symbola-normal-normal-semicondensed-*-16-*-*-*-*-0-iso10646-1 (#xF4B)` – NickD Oct 15 '20 at 18:32
  • I removed `Symbola` from `~/.fonts` and ran `fc-cache`. Now it runs faster, but still has to wait 20s. The new font is `ftcrhb:-GNU -FreeSerif-normal-normal-normal-*-18-*-*-*-*-0-iso10646-1 (#x14F4)` – Firmin Martin Oct 15 '20 at 18:41
  • Can you try this with the latest emacs master from git? That has a change to ensure we don't iterate over all the fonts available unless absolutely necessary – rpluim Oct 16 '20 at 09:53
  • @rpluim Just installed latest emacs `28.0.50 of 2020-10-16`. It's the same: 50s CPU time for Symbola font, 20s for FreeSerif font. – Firmin Martin Oct 16 '20 at 21:44
  • You should [profile](https://www.gnu.org/software/emacs/manual/html_node/elisp/Profiling.html#Profiling) the code. – NickD Oct 17 '20 at 17:06
  • @NickD Please see the update. I failed to do so. Maybe the symbol is written in the buffer immediately, but it's the rendering which takes a huge time. – Firmin Martin Oct 17 '20 at 22:37
  • In case it's related: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39133 – phils Oct 18 '20 at 02:05
  • @phils Thanks. The behaviour is the same, especially "when the glyph is present, everything slows down". However, as I just rebuilt Emacs, the patch is already applied. – Firmin Martin Oct 18 '20 at 02:39

1 Answers1

2

I fixed this issue and couple other ones at the same time: it prevented me to use telega and elfeed as Emacs slows down considerably when some fancy Unicode should be rendered. This "bug" or font issue reaches nightmare level as it can't be debugged through standard approaches (it depends on buffer contents). Moreover, it wastes package maintainer time as it is highly non-reproducible.

Fortunately, the package unicode-fonts (available on Melpa) fixes this problem.

Basically,

  1. Install the minimum useful fonts (DejaVu Sans, DejaVu Sans Mono, Quivira, Symbola, Noto Sans and Noto Sans Symbols).
  2. Put this in your configuration
  (use-package unicode-fonts
   :ensure t
   :config 
  (unicode-fonts-setup))

It will take a couple seconds to set up the first time. The mapping will be written persistently with pcache for subsequent startup.

Firmin Martin
  • 1,265
  • 7
  • 23
  • 1
    I had a similar problem and was able to fix that problem with your solution. I was using unicode "dead head" symbol in strings in python code. Not sure about the root of the problem I am using python-mode, eglot with pysl. – buhtz Jul 23 '22 at 12:34
  • 1
    I have to add that the well known `Package cl is deprecated` message is caused by this package or by two depending packages from the same author. https://github.com/rolandwalker/list-utils/issues/6 – buhtz Apr 16 '23 at 15:03