Subject: bug#61667: 29.0.60; Failure to redisplay

From: Dmitry Gutov <[email-masked]>
Date: Thu, 2 Mar 2023 17:45:05 +0200

On 02/03/2023 15:39, Dmitry Gutov wrote:
> On 02/03/2023 11:30, Gregory Heytings wrote:
>>
>>>> So... in both problematic cases is seems like there is a 
>>>> show_back_buffer call right after x_set_title, and yet it does not 
>>>> reflect on screen. Right?
>>>
>>> Yes.
>>>
>>
>> How can you draw such a conclusion without knowing what the back 
>> buffer contains?  The fact that show_back_buffer is called doesn't 
>> imply that it contains what Dmitry expects to see, namely the contents 
>> of the xassociations.rb file.
> 
> The problem here is that there is no subsequent show_back_buffer call 
> which corresponds to the "correct" frame contents. But the correct 
> contents do get displayed (albeit with delay).
> 
> The only next (last) one is me pressing "C-x" in "C-x C-c", I think.

I've done so further investigation. Started with trying to find out 
which part of x_set_name_internal causes the problem. Commented out this 
or that call, and none seemed to make a difference.

So I commented out both existing calls to x_set_name_internal: in 
x_set_name and x_set_title. Recompiled -- and the problem still reproduces.

Then I added --eval "(setq frame-title-format \"aaa\")" to the command 
line, which we previously identified as potential fix/workaround -- the 
problem _still_ reproduces. The frequency seems to be ~the same as 
without it, as long as the x_set_name_internal calls are commented out.

With x_set_name_internal not commented out, (setq frame-title-format 
"aaa") seems to lower the frequency of the issue, which coupled with 
blink-cursor-mode (which was previously on, and which fires timers over 
regular intervals) made it rare enough for me to declare the problem 
absent. And also this addition, which now seems to make the problem 
_more_ likely to happen"

   --eval "(add-hook 'find-file-hook #'redisplay t)

So I went back to the previous Emacs versions.

This MRE:

   src/emacs -Q --eval "(tool-bar-mode -1)" --eval "(menu-bar-mode -1)" 
--eval "(scroll-bar-mode -1)" --eval "(global-set-key \"a\" (lambda () 
(interactive) (insert \"!\") (redisplay) (find-file 
\"xassociations.rb\") ))" --eval "(add-hook 'find-file-hook #'redisplay 
t)" --eval "(blink-cursor-mode -1 )" --eval "(setq frame-title-format 
\"aaa\")"

   Press 'a'. See if the buffer is displayed after a delay.

reproduces (though a little less frequently) in Emacs 28, 27, 26

In 26 it happened ~5 times over 100 tries.

It doesn't seem to reproduce in Emacs 25, though that version is pretty 
buggy here: it tends to hang during startup (around 1 in 6 times) and I 
have to pass --eval "(set-frame-size nil 40 18)" for its window to have 
a reasonable size.

--eval "(modify-frame-parameters nil '((inhibit-double-buffering . t)))" 
still seems to be a reliable fix, so maybe Emacs 25 is by definition 
unaffected.

--eval "(modify-frame-parameters nil '((undecorated . t)))", OTOH, we 
can also cross out from the list of fixes: the problem still happens 
with it, though seemingly less often (first repro at the 15th try).