Subject: Re: bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width

From: Paul Rankin <[email-masked]>
Date: Tue, 13 Feb 2018 12:15:17 +1000

Sorry I didn't include my system before:

macOS High Sierra 10.13.3 (17D47)
MacBook Pro (Retina, 15-inch, Mid 2015)
Emacs.app built from emacs-26 branch

It's definitely a freeze. Emacs becomes unresponsive and needs to be force quit. I've recorded a video showing how it all goes down:

https://gfycat.com/gifs/detail/ImmaculateLazyAfricanjacana

I've included the on-screen keyboard viewer, but this isn't really helpful, because when Emacs freezes it blocks the keystrokes, but you can see when it freezes on C-n the n key remains depressed. After that I'm hammering away at C-b and M-< and M-v trying to move point back into view. You can see that mouse clicks on the tool bar or menu also have no effect.

From the video you can also see that the window can be resized, and when the force quit dialogue comes up the keystrokes are no longer blocked, so I doubt it's a macOS issue.

Finally, the errors printed to the terminal are:

2018-02-13 10:44:01.623 Emacs[9161:2638527] IMKClient Stall detected, *please Report* your user scenario attaching a spindump (or sysdiagnose) that captures the problem - (imkxpc_deadKeyStateWithReply:) block performed very slowly (1.25 secs).

I can understand that the real-world use case might not make sense to your own use of Emacs, but in the use I described, it means Emacs freezes by just changing the font size... not good.

-- 
https://www.paulwrankin.com

> On 13 Feb 2018, at 5:51 am, Eli Zaretskii <[email-masked]> wrote:
> 
>> From: Paul Rankin <[email-masked]>
>> Date: Mon, 12 Feb 2018 16:49:39 +1000
>> 
>> 1. emacs -Q
>> 2. make sure window is 80 columns wide
>> 3. insert a block of text that exceeds the window text width and causes wrapping
>> 4. set region over this text
>> 5. (put-text-property (region-beginning) (region-end) 'wrap-prefix '(space :align-to 81))
>> 6. move point to or past this text
>> 
>> Expected result:
>> 
>> I'm not sure, but I guess window should scroll horizontally to display point.
> 
> It can't.  (And anyway, horizontal scrolling only happens when lines
> are truncated.)
> 
> What the above wrap-prefix does is ask for 81 columns of whitespace
> each time we need to continue a line on the next screen line, before
> the text of that continuation line.  But 81 columns is more than the
> window can show, so the wrap prefix itself causes another continuation
> line to appear, which then needs another wrap prefix, etc. etc., ad
> nauseam.
> 
> IOW, asking for a 81-column wrap-prefix in a 80-column wide window
> makes no sense, and leaves redisplay no way of showing point -- or
> even showing more than one screen line of text.
> 
>> Actual results:
>> 
>> Emacs freezes and needs to be killed.
> 
> I don't think I see a freeze here.  What I see is that the cursor
> disappears, and Emacs repeatedly enters redisplay (because point is
> not visible) -- which is why you might think Emacs freezes.  But if
> you type C-b enough times, or even just type M-<, cursor will
> eventually reappear, the "freezing" will stop, and Emacs will start
> behaving normally again.  Although you sometimes need to wait for that
> to happen for a few dozen seconds.
> 
> Is that what you see?  Or do you see something different?  (For the
> record, I inserted a 90-character line into *scratch*, then marked it,
> and typed the put-text-property form.)
> 
>> In Emacs versions prior to 26, this use to just wrap the transition text, but something has changed with 26 to cause the freezing.
> 
> What do you mean by "just wrap the transition text"?  Can you tell
> what you see in previous versions with the recipe above?
> 
> What I see in previous versions of Emacs is something similar to Emacs
> 26, except that the cursor instead of disappearing jumps to the end of
> the first screen line (which is a clearly bogus location), and stays
> there until you type C-b enough times to get point into the visible
> portion of the text line inserted at the beginning of the recipe.  Do
> you see something different?
> 
> Thanks.