bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eli Zaretskii
Subject: bug#20285: 25.0.50; blink-cursor-mode sometimes stops blinking
Date: Fri, 10 Apr 2015 15:42:01 +0300

> From: Tassilo Horn <tsdh@gnu.org>
> Cc: 20285@debbugs.gnu.org
> Date: Fri, 10 Apr 2015 11:28:52 +0200
> 
> I think that it should be generically possible from Lisp to check if a
> redisplay has been performed within a given time frame.  That might be
> useful for other stuff next to `blink-cursor-mode', too.
> 
> That could be achieved by `redisplay' increasing some integer
> redisplay_counter variable whose value can be accessed from Lisp.

But "was redisplay performed?" does not have a simple yes/no answer.
Depending on the circumstances, the display engine can decide to
redisplay one or more windows on one or more frames.  By contrast, you
(in this case) are only interested in the selected window on the
selected frame.  So I don't think a simple counter will cut it; you
might need a counter per window or some such.  And other use cases
might want something even more fine-granular, perhaps.

> Then `blink-cursor-timer-function' could check if the invisibility of
> the cursor has really been manifested (on the glass) and force a
> redisplay when toggling it visible again.
> 
> --8<---------------cut here---------------start------------->8---
> (defvar blink-cursor-redisplay-counter nil)
> 
> (defun blink-cursor-timer-function ()
>   "Timer function of timer `blink-cursor-timer'."
>   (let ((cursor-shown (internal-show-cursor-p)))
>     (internal-show-cursor nil (not cursor-shown))
>     ;; If the cursor was invisible in the last cycle and a redisplay has been
>     ;; performed there, ensure a redisplay now so that it won't end up
>     ;; invisible for an indefinite amount of time.
>     (unless (or cursor-shown
>               (= blink-cursor-redisplay-counter
>                  redisplay-counter))
>       (redisplay 'force))
>     (setq blink-cursor-redisplay-counter redisplay-counter))

What happens if the blink-cursor timer doesn't get run?

> The effect would be that if a timer running too long or processing input
> stops the blinking of the cursor, that would at happen at least in the
> visible cursor state.

If it started with the cursor visible, yes.  But what if the heavy
processing started with the cursor blinked off, and the timer function
didn't get to run for a long time?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]