unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
@ 2018-02-12  6:49 Paul Rankin
  2018-02-12 19:51 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Rankin @ 2018-02-12  6:49 UTC (permalink / raw)
  To: 30432

So this took me a while to track down because it seemed so unpredictable, but I can now reliably freeze Emacs when some text has a wrap-prefix that exceeds the window text width.

To reproduce:

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.

Actual results:

Emacs freezes and needs to be killed.

Real-world use case:

In Fountain Mode (a major mode for screenwriting) text needs to aligned using line-prefix and wrap-prefix. Text for scene transitions uses a space of 45 columns. When the font size is increased, it's very easy for the 45-column space plus the transition text to exceed the current window text width.

In Emacs versions prior to 26, this use to just wrap the transition text, but something has changed with 26 to cause the freezing.

** Please do not reply asking me to change Fountain Mode to use auto-fill. The existing syntax doesn't work this way. **

-- 
https://www.paulwrankin.com






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-02-12  6:49 bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width Paul Rankin
@ 2018-02-12 19:51 ` Eli Zaretskii
  2018-02-13  2:15   ` Paul Rankin
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-02-12 19:51 UTC (permalink / raw)
  To: Paul Rankin; +Cc: 30432

> From: Paul Rankin <hello@paulwrankin.com>
> 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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-02-12 19:51 ` Eli Zaretskii
@ 2018-02-13  2:15   ` Paul Rankin
  2018-02-13  2:18     ` Paul Rankin
  2018-02-13  5:15     ` Eli Zaretskii
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Rankin @ 2018-02-13  2:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30432

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 <eliz@gnu.org> wrote:
> 
>> From: Paul Rankin <hello@paulwrankin.com>
>> 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.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-02-13  2:15   ` Paul Rankin
@ 2018-02-13  2:18     ` Paul Rankin
  2018-02-13  2:30       ` Paul Rankin
  2018-02-13  5:15     ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Paul Rankin @ 2018-02-13  2:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30432

On 13 Feb 2018, at 12:15 pm, Paul Rankin <hello@paulwrankin.com> wrote:
> 
> 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

Sorry, I didn't realise this video site is truncated to 60 seconds, which doesn't adequately illustrate the issue. I'm uploading a new one now.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-02-13  2:18     ` Paul Rankin
@ 2018-02-13  2:30       ` Paul Rankin
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Rankin @ 2018-02-13  2:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30432

This video has the whole show. I select a paragraph of lorem ipsum, put the wrap-prefix of 90 and then zap, Emacs becomes a zombie.

https://gfycat.com/WarpedImpureFlickertailsquirrel

In the vid I'm both clicking and hitting C-b, M-<, etc. but nothing.

-- 
https://www.paulwrankin.com

> On 13 Feb 2018, at 12:18 pm, Paul Rankin <hello@paulwrankin.com> wrote:
> 
> On 13 Feb 2018, at 12:15 pm, Paul Rankin <hello@paulwrankin.com> wrote:
>> 
>> 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
> 
> Sorry, I didn't realise this video site is truncated to 60 seconds, which doesn't adequately illustrate the issue. I'm uploading a new one now.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-02-13  2:15   ` Paul Rankin
  2018-02-13  2:18     ` Paul Rankin
@ 2018-02-13  5:15     ` Eli Zaretskii
  2018-02-13  5:57       ` Paul Rankin
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-02-13  5:15 UTC (permalink / raw)
  To: Paul Rankin; +Cc: 30432

> From: Paul Rankin <hello@paulwrankin.com>
> Date: Tue, 13 Feb 2018 12:15:17 +1000
> Cc: 30432@debbugs.gnu.org
> 
> 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

Yes, I tried the emacs-26 branch as well.  What I reported was from
that branch's build.

> It's definitely a freeze. Emacs becomes unresponsive and needs to be force quit.

Did you try C-g 2 or 3 times?  If so, did it help?

> 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.

I agree the result is not good even if Emacs behaves like it does on
my system, which is not a total freeze.  I'll try to see if I can find
some reasonable way out of this situation.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-02-13  5:15     ` Eli Zaretskii
@ 2018-02-13  5:57       ` Paul Rankin
  2018-03-20 17:10         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Rankin @ 2018-02-13  5:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30432

On 13 Feb 2018, at 3:15 pm, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Paul Rankin <hello@paulwrankin.com>
>> Date: Tue, 13 Feb 2018 12:15:17 +1000
>> Cc: 30432@debbugs.gnu.org
>> 
>> 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
> 
> Yes, I tried the emacs-26 branch as well.  What I reported was from
> that branch's build.
> 
>> It's definitely a freeze. Emacs becomes unresponsive and needs to be force quit.
> 
> Did you try C-g 2 or 3 times?  If so, did it help?

Yep, C-g many times but no help.

>> 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.
> 
> I agree the result is not good even if Emacs behaves like it does on
> my system, which is not a total freeze.  I'll try to see if I can find
> some reasonable way out of this situation.

A few more bits of info:

- I think the freeze is entirely temporary, however the time frozen *seems* to increase linearly depending on the number of offending lines, so a buffer with only one or two extending lines might recover in a second or two, but a buffer with many offending lines will appear permanently frozen.

- Move attempted point motion on offending lines appears to prolong the freeze.

- The freeze will be very minimal (a second or two) if point skips over the wrap-prefix text entirely, e.g. apply wrap-prefix to lines in the middle of buffer, then M-> to eobp.

- No freeze occurs if point is at eobp and moves back to bobp with M-< in the same circumstances as above.

- The freeze will occur if the wrapped text is scrolled into view from below, e.g. same circumstances as above, move point to eobp then mouse wheel up.

- When point moves to an affected position and things become frozen, the line number in the mode line will display as "??"






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-02-13  5:57       ` Paul Rankin
@ 2018-03-20 17:10         ` Eli Zaretskii
  2018-03-29  5:00           ` Paul W. Rankin
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-03-20 17:10 UTC (permalink / raw)
  To: Paul Rankin; +Cc: 30432

> From: Paul Rankin <hello@paulwrankin.com>
> Date: Tue, 13 Feb 2018 15:57:16 +1000
> Cc: 30432@debbugs.gnu.org
> 
> > I agree the result is not good even if Emacs behaves like it does on
> > my system, which is not a total freeze.  I'll try to see if I can find
> > some reasonable way out of this situation.
> 
> A few more bits of info:
> 
> - I think the freeze is entirely temporary, however the time frozen *seems* to increase linearly depending on the number of offending lines, so a buffer with only one or two extending lines might recover in a second or two, but a buffer with many offending lines will appear permanently frozen.
> 
> - Move attempted point motion on offending lines appears to prolong the freeze.
> 
> - The freeze will be very minimal (a second or two) if point skips over the wrap-prefix text entirely, e.g. apply wrap-prefix to lines in the middle of buffer, then M-> to eobp.
> 
> - No freeze occurs if point is at eobp and moves back to bobp with M-< in the same circumstances as above.
> 
> - The freeze will occur if the wrapped text is scrolled into view from below, e.g. same circumstances as above, move point to eobp then mouse wheel up.
> 
> - When point moves to an affected position and things become frozen, the line number in the mode line will display as "??"

Thanks, I think I fixed this.  Please try the latest master branch.

(It turns out wrap-prefix handling already had a smart defense against
such calamities, but it needed help when the prefix was created by the
likes of (space ...) properties.)





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-03-20 17:10         ` Eli Zaretskii
@ 2018-03-29  5:00           ` Paul W. Rankin
  2018-03-30 12:59             ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Paul W. Rankin @ 2018-03-29  5:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30432

On 21 Mar 2018, at 3:10 am, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> Thanks, I think I fixed this.  Please try the latest master branch.
> 
> (It turns out wrap-prefix handling already had a smart defense against
> such calamities, but it needed help when the prefix was created by the
> likes of (space ...) properties.)

Thanks Eli. I built from master branch and this appears mostly fixed to me, although I'm still getting a similar temporary freeze when moving point backwards onto a problematic line, e.g.

1. Emacs -Q
2. In scratch buffer, M-x fundamental-mode (just to be sure)
3. M-^ on the second line (to join a line of 80+ chars)
4. M-: (put-text-property (region-beginning) (region-end) 'wrap-prefix '(space :align-to 81))
5. C-n until point is past text line
6. C-p

Here I get a temporary freeze.

However if I resize the window wider than 80 cols and navigate point around, there is no freeze.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-03-29  5:00           ` Paul W. Rankin
@ 2018-03-30 12:59             ` Eli Zaretskii
  2018-05-07 18:38               ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-03-30 12:59 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: 30432

> From: "Paul W. Rankin" <hello@paulwrankin.com>
> Date: Thu, 29 Mar 2018 15:00:07 +1000
> Cc: 30432@debbugs.gnu.org
> 
> Thanks Eli. I built from master branch and this appears mostly fixed to me, although I'm still getting a similar temporary freeze when moving point backwards onto a problematic line, e.g.
> 
> 1. Emacs -Q
> 2. In scratch buffer, M-x fundamental-mode (just to be sure)
> 3. M-^ on the second line (to join a line of 80+ chars)
> 4. M-: (put-text-property (region-beginning) (region-end) 'wrap-prefix '(space :align-to 81))
> 5. C-n until point is past text line
> 6. C-p
> 
> Here I get a temporary freeze.

Right, a similar fix needed to be applied elsewhere.

Should be fixed now.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
  2018-03-30 12:59             ` Eli Zaretskii
@ 2018-05-07 18:38               ` Eli Zaretskii
       [not found]                 ` <0C03687D-D0D4-46CE-B409-6A2E55C8A5FA@paulwrankin.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-05-07 18:38 UTC (permalink / raw)
  To: hello; +Cc: 30432

> Date: Fri, 30 Mar 2018 15:59:51 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 30432@debbugs.gnu.org
> 
> > From: "Paul W. Rankin" <hello@paulwrankin.com>
> > Date: Thu, 29 Mar 2018 15:00:07 +1000
> > Cc: 30432@debbugs.gnu.org
> > 
> > Thanks Eli. I built from master branch and this appears mostly fixed to me, although I'm still getting a similar temporary freeze when moving point backwards onto a problematic line, e.g.
> > 
> > 1. Emacs -Q
> > 2. In scratch buffer, M-x fundamental-mode (just to be sure)
> > 3. M-^ on the second line (to join a line of 80+ chars)
> > 4. M-: (put-text-property (region-beginning) (region-end) 'wrap-prefix '(space :align-to 81))
> > 5. C-n until point is past text line
> > 6. C-p
> > 
> > Here I get a temporary freeze.
> 
> Right, a similar fix needed to be applied elsewhere.
> 
> Should be fixed now.

Ping?  Paul, if you had a chance to see whether this fixes your
problems in the real-life use cases, I'd like to close the bug.

Thanks.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width
       [not found]                   ` <2F164141-0F75-45C9-8211-ADAF2B005C16@paulwrankin.com>
@ 2018-05-08 17:16                     ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2018-05-08 17:16 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: 30432-done

> From: "Paul W. Rankin" <hello@paulwrankin.com>
> Date: Tue, 8 May 2018 17:29:36 +1000
> 
> All look perfect on my end when built from master.

Great, thanks for testing.  I'm therefore closing this bug.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-05-08 17:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12  6:49 bug#30432: 26.0.91; freeze when text wrap-prefix exceeds window text width Paul Rankin
2018-02-12 19:51 ` Eli Zaretskii
2018-02-13  2:15   ` Paul Rankin
2018-02-13  2:18     ` Paul Rankin
2018-02-13  2:30       ` Paul Rankin
2018-02-13  5:15     ` Eli Zaretskii
2018-02-13  5:57       ` Paul Rankin
2018-03-20 17:10         ` Eli Zaretskii
2018-03-29  5:00           ` Paul W. Rankin
2018-03-30 12:59             ` Eli Zaretskii
2018-05-07 18:38               ` Eli Zaretskii
     [not found]                 ` <0C03687D-D0D4-46CE-B409-6A2E55C8A5FA@paulwrankin.com>
     [not found]                   ` <2F164141-0F75-45C9-8211-ADAF2B005C16@paulwrankin.com>
2018-05-08 17:16                     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).