Subject: bug#20285: 25.0.50; blink-cursor-mode sometimes stops blinking

From: Eli Zaretskii <[email-masked]>
Date: Sat, 11 Apr 2015 17:45:21 +0300

> From: Tassilo Horn <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sat, 11 Apr 2015 14:39:45 +0200
> 
> Tassilo Horn <[email-masked]> writes:
> 
> >> If your Emacs is configured with --enable-checking='yes,glyphs', then
> >> you can invoke "M-x trace-redisplay RET", and see every entry to
> >> redisplay_internal announced on stderr.
> >
> > Ok, I'll try that out.
> 
> Done that now and got output like
> 
> redisplay_preserve_echo_area (12)
> redisplay_internal 0
> redisplay_internal 0
> redisplay_preserve_echo_area (8)
> redisplay_internal 0
> redisplay_preserve_echo_area (12)
> redisplay_internal 0
> redisplay_internal 0
> redisplay_preserve_echo_area (12)
> redisplay_internal 0
> redisplay_internal 0

That's what you should get; each "redisplay_internal 0" line is an
entry to redisplay.

> In general, I've been amazed how often redisplay is performed even
> though nothing has changed in neither the single window containing the
> buffer with my latex doc nor the minibuffer.  Ten times a second is very
> likely, maybe even more.

Really?  Is that in "emacs -Q"?  I get only 20 entries to redisplay,
every 0.5 sec, one each for every toggle of the blinking cursor, and
after those it stops.

I can only understand a much more frequent redisplay if you have a lot
of timers, or a high-frequency timer.  When a timer fires, we call
redisplay, AFAIR.

> Then I compiled my latex doc to generate some stress.  Every compile
> takes about a good minute.  That used to work without blinking
> interruption at least four times, but with the fifth time, out of
> sudden, it stuck after
> 
>   redisplay_internal 0

I'm guessing that your LaTeX compilation is via "M-x compile" or a
similar async subprocess.  If so, whether or not redisplay is called
depends on the speed the compilation process emits stuff that Emacs
reads.  If the subprocess outputs a lot of stuff, it will have the
same effect as high-speed keyboard input -- in both cases Emacs will
not enter redisplay until it's idle.

> and would not start anymore until my latex document was compiled and
> AUCTeX echoed "LaTeX: successfully formatted {293} pages".  That seems
> to have triggered the resume of redisplay.

Displaying an echo area message triggers redisplay.

> The redisplay pause was at least 20 to 30 seconds.

If there's no redisplay, you won't see the cursor blink.