Subject: bug#28040: 25.2; nXML flyspell mode hangs on Yank

From: Avinash Chopde <[email-masked]>
Date: Thu, 10 Aug 2017 16:09:45 -0400

CPU pegs to 100%, can't do anything in emacs, C-g etc no keys work. Have to
kill emacs.

GNU Emacs 25.2.1

Steps to reproduce:

emacs -Q emacs-flyspell-hang.xml   [file contents at end of this email]

M-x flyspell-mode

              Status line shows: (nXML Valid Fly)

When I cut or copy the line in the comment (see comments in attached XML)

C-k  [line with <Element tag=... in the file

Then

Move to outside the XML comment (to line below <Indent4 ..>
and
C-y

Which should paste that text, but instead, it just hangs, and emacs CPU
usage goes to 100%.

emacs does not respond to any keys, have to kill it.

If not using flyspell-mode, it all works fine.

Not sure if the bug system handles attachments, so sending the body of the
file in this email:
File emacs-flyspell-hang.xml:

<Top version="V11">
  <Indent1 tag="AGGRESSIVE" level="NONE">
    <Indent2>
      <Indent3>
        <Indent4 name="CHEAPEST" index="0">

          <!--
              GNU Emacs 25.2.1
              emacs -Q [this file name]
              nXML mode, with M-x flyspell-mode
              Status line shows: (nXML Valid Fly)

              Cut or Copy this line below into the XML, then Yank C-y it
              and Emacs pegs CPU to 100% on the Paste
              Paste has to be in the XML above this comment,
              pasting in this comment seems to work fine and causes no hang.

              <Element tag="ABC">DEF</Element>
          -->
        </Indent4>
      </Indent3>
    </Indent2>
  </Indent1>
</Top>