Subject: bug#25265: [PATCH] Rework NS event handling (bug#25265)

From: Eli Zaretskii <[email-masked]>
Date: Sun, 01 Jan 2017 17:42:58 +0200

> Date: Sun, 1 Jan 2017 15:03:52 +0000
> From: Alan Third <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> OK, I’m running into performance bugs with this almost straight away.
> 
> It all looks OK until I start flyspell-mode. Then it appears that
> redisplay is only called every two or three keypresses. It looks like
> Emacs is still going fine, though, as messages to the modeline appear,
> even if the action isn’t immediately displayed in the buffer.
> 
> For example, I open up an org file and start flyspell-mode, then I hit
> the down arrow which should take me to a heading but the cursor
> doesn’t move. Then I hit TAB, and I get a message in the modeline
> telling me that the section associated with the heading has been
> expanded, but the buffer is still displayed with the cursor on the
> previous line and the section not expanded. Finally I hit the down
> arrow again and the buffer updates to display the expanded section and
> the cursor where I’d expect it.
> 
> emacsclient runs with a delay, which I guess corresponds to the
> timeout on the NS event queue check.
> 
> I’m not at all sure how to fix these problems.

Do you understand the problems, though?

The crucial question is why isn't redisplay being called as it was
called before the changes?  One way of answering that would be to run
the previous version under a debugger, put a breakpoint in
redisplay_internal, show a backtrace to see who called it, and
continue.  Then do the same in the new version, and see if you can
spot any differences.

Do you really need to type several keys to get redisplay?  Or is it
enough to type just one and wait for some time?  IOW, if you type one
key, then wait, does redisplay ever happen?

Thanks.