unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Markus Triska <triska@metalevel.at>
Cc: 53798@debbugs.gnu.org
Subject: bug#53798: 27.1; OSX: (redisplay) does not reliably redisplay
Date: Sat, 05 Feb 2022 15:10:21 +0200	[thread overview]
Message-ID: <83leyp1mte.fsf@gnu.org> (raw)
In-Reply-To: <m2y22pfprh.fsf@metalevel.at> (message from Markus Triska on Sat,  05 Feb 2022 13:42:58 +0100)

> From: Markus Triska <triska@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)))





  reply	other threads:[~2022-02-05 13:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 12:42 bug#53798: 27.1; OSX: (redisplay) does not reliably redisplay Markus Triska
2022-02-05 13:10 ` Eli Zaretskii [this message]
2022-02-05 17:29   ` Markus Triska
2022-02-05 18:04     ` Eli Zaretskii
2022-02-05 18:24       ` Markus Triska
2022-02-05 18:38         ` Eli Zaretskii
2022-02-05 18:55           ` Markus Triska

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83leyp1mte.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=53798@debbugs.gnu.org \
    --cc=triska@metalevel.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).