Subject: Re: bug#34179: 27.0.50; message hangs when buffer with process visible

From: martin rudalics <[email-masked]>
Date: Fri, 25 Jan 2019 17:51:53 +0100

> You are right, but window-font-width called by
 > window-max-chars-per-line also calls select-window.
 >
 > Btw, I don't think replacing with-selected-window with
 > with-current-buffer will necessarily yield the same results.

Right.  I attach a more correct patch now that does not select a
window in these cases.  Michael, please check whether it fixes your
use case.

 > And we
 > cannot in general forbid calls to with-selected-window in hooks called
 > from run_window_change_functions anyway, can we?

Certainly not.

 >> I can't get the hang with a single frame.  Can you?
 >
 > OK, but does that change anything?  Why is having a separate frame a
 > problem?

That's what I would have liked to find out.

 >> It's an infloop triggered in ‘window-configuration-change-hook’ and it
 >> was always easy to trigger an infloop there.
 >
 > Not sure I understand what you mean.  The loop is in
 > redisplay_internal, not in window-configuration-change-hook.  How was
 > it easy to trigger that in the past?  And even if it was, shouldn't we
 > avoid such a loop?

Agreed.

 > In any case, it is way too easy to do in functions called from
 > run_window_change_functions something that sets
 > windows_or_buffers_changed, so automatically retrying redisplay based
 > on that variable after run_window_change_functions returns is IMO
 > dangerous.

But what would be the alternatives?  Having clients ask for redisplay
explicitly every time they are in a hook?  Or maybe just suppress
redisplay_other_windows when running from the hook.

Thanks, martin