Subject: bug#30994: closed (Re: bug#45857: 28.0.50; Not possible to set package-user-dir in early-init.el)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 19 Jan 2021 17:13:02 +0000

Your bug report

#30994: 27.0.50; Cursor doesn't blink (X window system)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
30994: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30994
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#45857: 28.0.50; Not possible to set package-user-dir in early-init.el
From: Stefan Monnier <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Tue, 19 Jan 2021 12:11:57 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

> Maybe some time in the future this need will re-appear at which point we
> may want to introduce some fancier system to control which var is
> initialized when, but I think for now the patch below is
> a better solution.

Pushed,

        Stefan

>
>         Stefan
>
>
> 2021-01-15  Stefan Monnier  <[email-masked]>
>
>     * lisp/startup.el: Fix bug#45857, bug#30994, and bug#45913.
>
>     (command-line): Don't re-evaluate the `custom-delayed-init-variables`
>     a second time after reading the `early-init.el` file.
>     (x-apply-session-resources): Set `blink-cursor-mode` rather than
>     `no-blinking-cursor`.
>
>     * lisp/frame.el (blink-cursor-start): Turn `blink-cursor-mode` off
>     if `blink-cursor-mode` was set to nil.
>     (blink-cursor-mode): Default to it being enabled regardless of
>     `window-system`.
>
>
> diff --git a/lisp/frame.el b/lisp/frame.el
> index e2d7f21a49..06aab269dd 100644
> --- a/lisp/frame.el
> +++ b/lisp/frame.el
> @@ -2552,13 +2552,15 @@ blink-cursor-start
>  This starts the timer `blink-cursor-timer', which makes the cursor blink
>  if appropriate.  It also arranges to cancel that timer when the next
>  command starts, by installing a pre-command hook."
> -  (when (null blink-cursor-timer)
> +  (cond
> +   ((null blink-cursor-mode) (blink-cursor-mode -1))
> +   ((null blink-cursor-timer)
>      ;; Set up the timer first, so that if this signals an error,
>      ;; blink-cursor-end is not added to pre-command-hook.
>      (setq blink-cursor-blinks-done 1)
>      (blink-cursor--start-timer)
>      (add-hook 'pre-command-hook #'blink-cursor-end)
> -    (internal-show-cursor nil nil)))
> +    (internal-show-cursor nil nil))))
>  
>  (defun blink-cursor-timer-function ()
>    "Timer function of timer `blink-cursor-timer'."
> @@ -2637,9 +2639,8 @@ blink-cursor-mode
>  terminals, cursor blinking is controlled by the terminal."
>    :init-value (not (or noninteractive
>  		       no-blinking-cursor
> -		       (eq system-type 'ms-dos)
> -		       (not (display-blink-cursor-p))))
> -  :initialize 'custom-initialize-delay
> +		       (eq system-type 'ms-dos)))
> +  :initialize #'custom-initialize-delay
>    :group 'cursor
>    :global t
>    (blink-cursor-suspend)
> diff --git a/lisp/startup.el b/lisp/startup.el
> index 552802a38d..7011fbf458 100644
> --- a/lisp/startup.el
> +++ b/lisp/startup.el
> @@ -1172,6 +1172,7 @@ command-line
>          ;; are dependencies between them.
>          (nreverse custom-delayed-init-variables))
>    (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
> +  (setq custom-delayed-init-variables nil)
>  
>    ;; Warn for invalid user name.
>    (when init-file-user
> @@ -1301,12 +1302,6 @@ command-line
>      (startup--setup-quote-display)
>      (setq internal--text-quoting-flag t))
>  
> -  ;; Re-evaluate again the predefined variables whose initial value
> -  ;; depends on the runtime context, in case some of them depend on
> -  ;; the window-system features.  Example: blink-cursor-mode.
> -  (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
> -  (setq custom-delayed-init-variables nil)
> -
>    (normal-erase-is-backspace-setup-frame)
>  
>    ;; Register default TTY colors for the case the terminal hasn't a
> @@ -1487,13 +1482,13 @@ x-apply-session-resources
>  opens a graphical frame.
>  
>  This can set the values of `menu-bar-mode', `tool-bar-mode',
> -`tab-bar-mode', and `no-blinking-cursor', as well as the `cursor' face.
> +`tab-bar-mode', and `blink-cursor-mode', as well as the `cursor' face.
>  Changed settings will be marked as \"CHANGED outside of Customize\"."
>    (let ((no-vals  '("no" "off" "false" "0"))
>  	(settings '(("menuBar" "MenuBar" menu-bar-mode nil)
>  		    ("toolBar" "ToolBar" tool-bar-mode nil)
>  		    ("scrollBar" "ScrollBar" scroll-bar-mode nil)
> -		    ("cursorBlink" "CursorBlink" no-blinking-cursor t))))
> +		    ("cursorBlink" "CursorBlink" blink-cursor-mode nil))))
>      (dolist (x settings)
>        (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
>  	  (set (nth 2 x) (nth 3 x)))))

Subject: 27.0.50; Cursor doesn't blink (X window system)
From: Michael Heerdegen <[email-masked]>
To: [email-masked]
Date: Fri, 30 Mar 2018 05:31:20 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

I start emacs -Q (under openbox in X on Debian if it matters), and I get
an Emacs where the cursor doesn't blink.  Thankfully only on master but
not with an emacs-26 build.

The problem is simply that `blink-cursor-mode' is not turned on when
starting, but I can successfully enable it.

The reason is that at the moment the :init-value expression of
`blink-cursor-mode' is evaluated, `window-system' is bound to nil,
i.e. when installing the following:

>From befd2667396125748d6e9e0e15c5fc38f7846082 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <[email-masked]>
Date: Fri, 30 Mar 2018 04:25:00 +0200
Subject: [PATCH] WIP: test no-blinking-cursor

---
 lisp/frame.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/frame.el b/lisp/frame.el
index fbf2f6e773..b07e2800ba 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2357,10 +2357,12 @@ blink-cursor-mode
 
 This command is effective only on graphical frames.  On text-only
 terminals, cursor blinking is controlled by the terminal."
-  :init-value (not (or noninteractive
-		       no-blinking-cursor
-		       (eq system-type 'ms-dos)
-		       (not (memq window-system '(x w32 ns)))))
+  :init-value (progn
+                (message "window-system: %S" window-system)
+                (not (or noninteractive
+		         no-blinking-cursor
+		         (eq system-type 'ms-dos)
+                         (not (memq window-system '(x w32 ns))))))
   :initialize 'custom-initialize-delay
   :group 'cursor
   :global t
-- 
2.16.2

I get a *Messages* buffer like

| window-system: nil
| For information about GNU Emacs and the GNU system, type C-h C-a.

After starting up,

window-system
   ==> x

as expected.

Thanks,

Michael.

In GNU Emacs 27.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.22.29)
 of 2018-03-30 built on drachen
Repository revision: befd2667396125748d6e9e0e15c5fc38f7846082
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux buster/sid