Subject: bug#40733: 28.0.50; Emacs locks up on paste (yank) of unicode characters

From: Will Bush <[email-masked]>
Date: Mon, 20 Apr 2020 16:27:54 -0500

>
> Does it require all of them, or is there a specific character in that
> sequence that triggers it?
>

I was able to narrow it down to this character (between the back-ticks): `︵`

Gmail (webapp) is not rendering that for me even if I change the font. In
fact, I'm starting to realize I hate using gmail for writing emails because
it doesn't support code blocks either. I haven't gotten around to trying
out Emacs email clients yet, but I'm starting to wish that I had.

So I looked for a program that can turn a character into its codes and
found unum (https://www.fourmilab.ch/webtools/unum/). I inserted a
screenshot of the output (my terminal renders the character fine) because
gmail is mangling the output. I also attached a text file with the same
content as the screenshot just in case.

Any chance of running emacs using gdb so we can see where the CPU
> usage is?

Sure. I'm pretty rusty with gdb, but I'll start looking into it tonight and
get back with you. If you could give me some pointers or link me to a tips
on debugging Emacs that would help a lot.

macOS defines?

Looks like that comes from here:

https://github.com/NixOS/nixpkgs/blob/3bbd074217cd11b6e14abec24655091b83aacc6f/pkgs/applications/editors/emacs/default.nix#L58

Was added in this commit:
aa2160e1b62bdc6795c465e68301ec8684540b24
Author:     Matthew Bauer <[email-masked]>
AuthorDate: Mon May 28 13:33:08 2018 -0400
Commit:     Matthew Bauer <[email-masked]>
CommitDate: Mon May 28 13:35:10 2018 -0400

Parent:     a87b50bc634 emacs: readd version 25
Contained:  master
Follows:    18.03-beta (10672)
Precedes:   18.09-beta (9925)

emacs26: add some tweaks from jwiegley’s overlay

Interestingly,  jwiegley has since removed it from his repo
https://github.com/jwiegley/nix-config in this commit:

69bb0c3ae6985f09ee2f27cea4621db21fcf0474
Author:     John Wiegley <[email-masked]>
AuthorDate: Tue Oct 22 16:40:15 2019 -0700
Commit:     John Wiegley <[email-masked]>
CommitDate: Tue Oct 22 16:40:15 2019 -0700

Parent:     711ed41 updates
Contained:  master

updates

I guess OSX users that install Nix as a package manager can also install
Emacs using that same nix expression. I found what this flag does in the
"Targeting different macOS versions" section of the
`emacs/nextstep/INSTALL` file in the emacs repository. Kinda makes me
wonder if this should be reviewed in the nixpkgs repository.

do 'C-u C-x =' on them so we know what font
> is being used, that would help.
>

Oh cool. I didn't know about that command. So in trying to do this I
realized that Emacs did not completely lock up it was just taking a really
long time. It took a long time to display the character, for `C-u C-x =` to
finish`, and for me to finally select the text and `M-w`. Basically any
time I was interacting with that character it caused long delays.

The output below is from `emacs -Q` again in version 28 like before.
Something interesting to note is that does display the vertical left paren
after some time, but in Emacs 26, which had no lag, only displayed
whitespace.

             position: 146 of 157 (92%), column: 0
            character: ︵ (displayed as ︵) (codepoint 65077, #o177065,
#xfe35)
              charset: unicode (Unicode (ISO10646))
code point in charset: 0xFE35
               script: han
               syntax: (︶    which means: open, matches ︶
             category: .:Base, c:Chinese
             to input: type "C-x 8 RET fe35" or "C-x 8 RET PRESENTATION
FORM FOR VERTICAL LEFT PARENTHESIS"
          buffer code: #xEF #xB8 #xB5
            file code: #xEF #xB8 #xB5 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)

ftcrhb:-GNU-Unifont-normal-normal-normal-Sans-Serif-16-*-*-*-c-80-iso10646-1
(#xDD36)

Character code properties: customize what to show
  name: PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS
  old-name: GLYPH FOR VERTICAL OPENING PARENTHESIS
  general-category: Ps (Punctuation, Open)
  decomposition: (vertical 40) (vertical '(')

There are text properties here:
  fontified            nil
  rear-nonsticky       t