GNU bug report logs - #53798
27.1; OSX: (redisplay) does not reliably redisplay

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Sat, 5 Feb 2022 12:44:02 UTC

Severity: normal

Found in version 27.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Markus Triska <triska <at> metalevel.at>
Cc: 53798 <at> debbugs.gnu.org
Subject: bug#53798: 27.1; OSX: (redisplay) does not reliably redisplay
Date: Sat, 05 Feb 2022 15:10:21 +0200
> From: Markus Triska <triska <at> metalevel.at>
> Date: Sat, 05 Feb 2022 13:42:58 +0100
> 
> 
> To reproduce this issue, please start Emacs with:
> 
>     $ emacs -Q
> 
> and evaluate the following form:
> 
>     (while t
>       (insert "\n" (make-string 50 ?a))
>       (redisplay)
>       (sit-for 0.1))
> 
> At first, this works completely as intended: We see a growing number of
> lines in the buffer, and we are shown each fresh line as it appears:
> 
>     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>     ...
> 
> However, as soon as any key is pressed, the output becomes erratic in
> the sense that for long stretches of time, we see no new lines at all,
> and then several of them appear immediately at the same time.
> 
> The snippet uses (redisplay) after writing each line in order to show
> the line as it appears. I therefore expect to continue to see, also when
> a key is pressed, each line immediately after it is written in the
> buffer, not batches of multiple lines to be shown after several of them
> have already been written. Is there any way to obtain this behaviour?

sit-for exits immediately if some input is available, and pressing a
key makes input available.  So the loop starts iterating much faster
than before, because sit-for no longer waits for 0.1 sec.  And that is
what you see.

If I modify the snippet as below, it behaves the same no matter
whether you press a key or not.

  (while t
    (insert "\n" (make-string 50 ?a))
    (redisplay)
    (or (sit-for 0.1)
	(read-char)))




This bug report was last modified 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.