Subject: Re: bug#17588: 24.3.91; mouse-face glitchy

From: Eli Zaretskii <[email-masked]>
Date: Sun, 25 May 2014 22:25:31 +0300

> From: Christopher Schmidt <[email-masked]>
> Date: Sun, 25 May 2014 15:04:18 -0400 (EDT)
> 
>     emacs -q
>     M-: (run-at-time nil 0.01
>                      (lambda ()
>                        (with-current-buffer (get-buffer-create "rms")
>                          (with-silent-modifications
>                            (dotimes (_ 10)
>                              (insert (if (= (random 2) 1) "gpl" "fsf") "\n")))
>                          (when (> (- (point-max) (point-min)) 100)
>                            (delete-region (point-min) (+ (point-min) 100)))))) RET
>     C-x 2
>     C-x 3
>     C-x b rms RET
>     C-x o
>     C-x b rms2 RET
>     C-x o
>     C-x b rms2 RET
>     M-: (dotimes (i 1000)
>           (insert (propertize (format "%3d%3d%3d" i i i)
>                               'mouse-face 'highlight)
>                   "\n")) RET
>     # Move your mouse pointer around within the rms2 windows and the
>     # modeline of the rms window.
> 
> I see two glitches with regard to mouse-face highlighting.  Either there
> is no highlighting at all or the font does not switch back to the
> regular one after leaving the connected highlight region.
> 
> This recipe is not exactly reliable.  It usually takes up to 20 seconds
> of mouse movement to trigger the issue here.  Some scrolling helps.
> 
> I realise my recipe puts a lot of pressure on the display engine.  When
> reducing the timer's REPEAT value, the issue does not vanish but is
> harder to reproduce.  My real use-case, which provokes this issue after
> a few minutes, is a process filter which updates the buffer of a window
> exactly once a second.
> 
> When applying this recipe to 24.3 on the same system using the same
> libraries for building the binary, there are some glitches.  Most
> notably the mouse face of mode-line-buffer-identification is not reset
> reliably.  Yet 24.3.91 is a lot worse than 24.3.  IMO this is a
> regression.

I see no problems with this recipe on my system.  Maybe my machine is
faster than yours.

In general, each redisplay requires removing the mouse-highlight and
then re-applying it, so if Emacs cannot keep up, you might see
annoyingly visible flickering or even such extreme effects as you
describe.  There's nothing new here.

May I ask what is the real-life situation where you need to refresh
the display at such high frequency?