Subject: Re: bug#24372: 25.1.50; After losing focus, cursor is hidden when moving point

From: Eli Zaretskii <[email-masked]>
Date: Sat, 10 Sep 2016 10:21:33 +0300

> From: Philipp Stephani <[email-masked]>
> Date: Fri, 09 Sep 2016 17:18:12 +0000
> Cc: [email-masked]
> 
>  A simpler recipe that doesn't need explicit focus events is
> 
>  emacs -Q -eval '(progn (setq blink-cursor-delay 0.0) (blink-cursor-suspend) (blink-cursor-check))' 
> 
>  and then start moving point.
> 
> OK, I guess one issue is that setting blink-cursor-delay doesn't restart blink-cursor-idle-timer. (Similarly,
> changing blink-cursor-interval doesn't restart blink-cursor-timer.) While obviously we can't fix that when using
> setq, I'd suggest adding custom setters to the variables nevertheless.
> 
> The direct cause of the issue seems to be that, when blink-cursor-delay is idle, after every command
> blink-cursor-start is called immediately, which hides the cursor.

Thanks.  Does the patch below fix the issue, without introducing any
adverse side effects?

diff --git a/lisp/frame.el b/lisp/frame.el
index cfd40bf..e10f0ce 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2068,7 +2068,10 @@ blink-cursor-start
 	  (run-with-timer blink-cursor-interval blink-cursor-interval
 			  'blink-cursor-timer-function))
     (add-hook 'pre-command-hook 'blink-cursor-end)
-    (internal-show-cursor nil nil)))
+    ;; Start by showing the cursor, so that even if they set
+    ;; blink-cursor-delay to zero, they still see the cursor during
+    ;; the execution of the Emacs commands.
+    (internal-show-cursor nil t)))
 
 (defun blink-cursor-timer-function ()
   "Timer function of timer `blink-cursor-timer'."