[Top][All Lists]

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

master deb90c8: * lisp/startup.el: Fix bug#45857, bug#30994, and bug#459

From: Stefan Monnier
Subject: master deb90c8: * lisp/startup.el: Fix bug#45857, bug#30994, and bug#45913.
Date: Tue, 19 Jan 2021 12:10:55 -0500 (EST)

branch: master
commit deb90c893d3a0094db77753d8a795716784bbc7e
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * 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
    * 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
    * lisp/custom.el (custom-initialize-delay): Fox docstring now that
    autoload.el preserves the `:initialize` info.
 etc/NEWS          |  4 ++++
 lisp/cus-start.el |  2 +-
 lisp/custom.el    | 12 +-----------
 lisp/frame.el     | 16 +++++++++-------
 lisp/startup.el   | 11 +++--------
 5 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 8fc5f3e..7a012b4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -326,6 +326,10 @@ the buffer cycles the whole buffer between "only top-level 
 * Changes in Specialized Modes and Packages in Emacs 28.1
+** 'blink-cursor-mode' is now enabled by default regardless of the UI.
+It used to be enabled when Emacs is started in GUI mode but not when started
+in text mode.  The cursor still only actually blinks in GUI frames.
 ** pcase
 *** The `pred` pattern can now take the form (pred (not FUN)).
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 0293d34..27fdb72 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -880,7 +880,7 @@ since it could result in memory overflow and make Emacs 
       ;; Don't re-add to custom-delayed-init-variables post-startup.
       (unless after-init-time
        ;; Note this is the _only_ initialize property we handle.
-       (if (eq (cadr (memq :initialize rest)) 'custom-initialize-delay)
+       (if (eq (cadr (memq :initialize rest)) #'custom-initialize-delay)
            ;; These vars are defined early and should hence be initialized
            ;; early, even if this file happens to be loaded late.  so add them
            ;; to the end of custom-delayed-init-variables.  Otherwise,
diff --git a/lisp/custom.el b/lisp/custom.el
index 58ecd04..5e354c4 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -125,17 +125,7 @@ This is used in files that are preloaded (or for autoloaded
 variables), so that the initialization is done in the run-time
 context rather than the build-time context.  This also has the
 side-effect that the (delayed) initialization is performed with
-the :set function.
-For variables in preloaded files, you can simply use this
-function for the :initialize property.  For autoloaded variables,
-you will also need to add an autoload stanza calling this
-function, and another one setting the standard-value property.
-Or you can wrap the defcustom in a progn, to force the autoloader
-to include all of it."            ; see eg vc-sccs-search-project-dir
-  ;; No longer true:
-  ;; "See `send-mail-function' in sendmail.el for an example."
+the :set function."
   ;; Defvar it so as to mark it special, etc (bug#25770).
   (internal--define-uninitialized-variable symbol)
diff --git a/lisp/frame.el b/lisp/frame.el
index e2d7f21..06aab26 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2552,13 +2552,15 @@ Use 0 or negative value to blink forever."
 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)
     (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'."
@@ -2615,7 +2617,7 @@ stopped by `blink-cursor-suspend'.  Internally calls
 `blink-cursor--should-blink' and returns its result."
   (let ((should-blink (blink-cursor--should-blink)))
     (when (and should-blink (not blink-cursor-idle-timer))
-      (remove-hook 'post-command-hook 'blink-cursor-check)
+      (remove-hook 'post-command-hook #'blink-cursor-check)
@@ -2637,16 +2639,16 @@ This command is effective only on graphical frames.  On 
 terminals, cursor blinking is controlled by the terminal."
   :init-value (not (or noninteractive
-                      (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
   (remove-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
   (remove-function after-focus-change-function #'blink-cursor--rescan-frames)
   (when blink-cursor-mode
-    (add-function :after after-focus-change-function 
+    (add-function :after after-focus-change-function
+                  #'blink-cursor--rescan-frames)
     (add-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
diff --git a/lisp/startup.el b/lisp/startup.el
index 552802a..7011fbf 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1172,6 +1172,7 @@ please check its value")
         ;; 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 @@ please check its value")
     (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)
   ;; Register default TTY colors for the case the terminal hasn't a
@@ -1487,13 +1482,13 @@ to reading the init file), or afterwards when the user 
 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)))))

reply via email to

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