aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2021-01-19 12:10:48 -0500
committerStefan Monnier2021-01-19 12:10:48 -0500
commitdeb90c893d3a0094db77753d8a795716784bbc7e (patch)
tree7e1bdae830becf615389842f8a8135980541068f
parent3c584438552f8d01651d7b9358eae5ce8da81fae (diff)
downloademacs-deb90c893d3a0094db77753d8a795716784bbc7e.tar.gz
emacs-deb90c893d3a0094db77753d8a795716784bbc7e.zip
* 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`. * lisp/custom.el (custom-initialize-delay): Fox docstring now that autoload.el preserves the `:initialize` info.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/cus-start.el2
-rw-r--r--lisp/custom.el12
-rw-r--r--lisp/frame.el16
-rw-r--r--lisp/startup.el11
5 files changed, 18 insertions, 27 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 8fc5f3e046c..7a012b48912 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -326,6 +326,10 @@ the buffer cycles the whole buffer between "only top-level headings",
326 326
327* Changes in Specialized Modes and Packages in Emacs 28.1 327* Changes in Specialized Modes and Packages in Emacs 28.1
328 328
329** 'blink-cursor-mode' is now enabled by default regardless of the UI.
330It used to be enabled when Emacs is started in GUI mode but not when started
331in text mode. The cursor still only actually blinks in GUI frames.
332
329** pcase 333** pcase
330+++ 334+++
331*** The `pred` pattern can now take the form (pred (not FUN)). 335*** The `pred` pattern can now take the form (pred (not FUN)).
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 0293d34d1cd..27fdb723441 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 crash."
880 ;; Don't re-add to custom-delayed-init-variables post-startup. 880 ;; Don't re-add to custom-delayed-init-variables post-startup.
881 (unless after-init-time 881 (unless after-init-time
882 ;; Note this is the _only_ initialize property we handle. 882 ;; Note this is the _only_ initialize property we handle.
883 (if (eq (cadr (memq :initialize rest)) 'custom-initialize-delay) 883 (if (eq (cadr (memq :initialize rest)) #'custom-initialize-delay)
884 ;; These vars are defined early and should hence be initialized 884 ;; These vars are defined early and should hence be initialized
885 ;; early, even if this file happens to be loaded late. so add them 885 ;; early, even if this file happens to be loaded late. so add them
886 ;; to the end of custom-delayed-init-variables. Otherwise, 886 ;; to the end of custom-delayed-init-variables. Otherwise,
diff --git a/lisp/custom.el b/lisp/custom.el
index 58ecd0439ad..5e354c4c595 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -125,17 +125,7 @@ This is used in files that are preloaded (or for autoloaded
125variables), so that the initialization is done in the run-time 125variables), so that the initialization is done in the run-time
126context rather than the build-time context. This also has the 126context rather than the build-time context. This also has the
127side-effect that the (delayed) initialization is performed with 127side-effect that the (delayed) initialization is performed with
128the :set function. 128the :set function."
129
130For variables in preloaded files, you can simply use this
131function for the :initialize property. For autoloaded variables,
132you will also need to add an autoload stanza calling this
133function, and another one setting the standard-value property.
134Or you can wrap the defcustom in a progn, to force the autoloader
135to include all of it." ; see eg vc-sccs-search-project-dir
136 ;; No longer true:
137 ;; "See `send-mail-function' in sendmail.el for an example."
138
139 ;; Defvar it so as to mark it special, etc (bug#25770). 129 ;; Defvar it so as to mark it special, etc (bug#25770).
140 (internal--define-uninitialized-variable symbol) 130 (internal--define-uninitialized-variable symbol)
141 131
diff --git a/lisp/frame.el b/lisp/frame.el
index e2d7f21a498..06aab269ddd 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2552,13 +2552,15 @@ Use 0 or negative value to blink forever."
2552This starts the timer `blink-cursor-timer', which makes the cursor blink 2552This starts the timer `blink-cursor-timer', which makes the cursor blink
2553if appropriate. It also arranges to cancel that timer when the next 2553if appropriate. It also arranges to cancel that timer when the next
2554command starts, by installing a pre-command hook." 2554command starts, by installing a pre-command hook."
2555 (when (null blink-cursor-timer) 2555 (cond
2556 ((null blink-cursor-mode) (blink-cursor-mode -1))
2557 ((null blink-cursor-timer)
2556 ;; Set up the timer first, so that if this signals an error, 2558 ;; Set up the timer first, so that if this signals an error,
2557 ;; blink-cursor-end is not added to pre-command-hook. 2559 ;; blink-cursor-end is not added to pre-command-hook.
2558 (setq blink-cursor-blinks-done 1) 2560 (setq blink-cursor-blinks-done 1)
2559 (blink-cursor--start-timer) 2561 (blink-cursor--start-timer)
2560 (add-hook 'pre-command-hook #'blink-cursor-end) 2562 (add-hook 'pre-command-hook #'blink-cursor-end)
2561 (internal-show-cursor nil nil))) 2563 (internal-show-cursor nil nil))))
2562 2564
2563(defun blink-cursor-timer-function () 2565(defun blink-cursor-timer-function ()
2564 "Timer function of timer `blink-cursor-timer'." 2566 "Timer function of timer `blink-cursor-timer'."
@@ -2615,7 +2617,7 @@ stopped by `blink-cursor-suspend'. Internally calls
2615`blink-cursor--should-blink' and returns its result." 2617`blink-cursor--should-blink' and returns its result."
2616 (let ((should-blink (blink-cursor--should-blink))) 2618 (let ((should-blink (blink-cursor--should-blink)))
2617 (when (and should-blink (not blink-cursor-idle-timer)) 2619 (when (and should-blink (not blink-cursor-idle-timer))
2618 (remove-hook 'post-command-hook 'blink-cursor-check) 2620 (remove-hook 'post-command-hook #'blink-cursor-check)
2619 (blink-cursor--start-idle-timer)) 2621 (blink-cursor--start-idle-timer))
2620 should-blink)) 2622 should-blink))
2621 2623
@@ -2637,16 +2639,16 @@ This command is effective only on graphical frames. On text-only
2637terminals, cursor blinking is controlled by the terminal." 2639terminals, cursor blinking is controlled by the terminal."
2638 :init-value (not (or noninteractive 2640 :init-value (not (or noninteractive
2639 no-blinking-cursor 2641 no-blinking-cursor
2640 (eq system-type 'ms-dos) 2642 (eq system-type 'ms-dos)))
2641 (not (display-blink-cursor-p)))) 2643 :initialize #'custom-initialize-delay
2642 :initialize 'custom-initialize-delay
2643 :group 'cursor 2644 :group 'cursor
2644 :global t 2645 :global t
2645 (blink-cursor-suspend) 2646 (blink-cursor-suspend)
2646 (remove-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames) 2647 (remove-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
2647 (remove-function after-focus-change-function #'blink-cursor--rescan-frames) 2648 (remove-function after-focus-change-function #'blink-cursor--rescan-frames)
2648 (when blink-cursor-mode 2649 (when blink-cursor-mode
2649 (add-function :after after-focus-change-function #'blink-cursor--rescan-frames) 2650 (add-function :after after-focus-change-function
2651 #'blink-cursor--rescan-frames)
2650 (add-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames) 2652 (add-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
2651 (blink-cursor-check))) 2653 (blink-cursor-check)))
2652 2654
diff --git a/lisp/startup.el b/lisp/startup.el
index 552802a38d7..7011fbf4583 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1172,6 +1172,7 @@ please check its value")
1172 ;; are dependencies between them. 1172 ;; are dependencies between them.
1173 (nreverse custom-delayed-init-variables)) 1173 (nreverse custom-delayed-init-variables))
1174 (mapc #'custom-reevaluate-setting custom-delayed-init-variables) 1174 (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
1175 (setq custom-delayed-init-variables nil)
1175 1176
1176 ;; Warn for invalid user name. 1177 ;; Warn for invalid user name.
1177 (when init-file-user 1178 (when init-file-user
@@ -1301,12 +1302,6 @@ please check its value")
1301 (startup--setup-quote-display) 1302 (startup--setup-quote-display)
1302 (setq internal--text-quoting-flag t)) 1303 (setq internal--text-quoting-flag t))
1303 1304
1304 ;; Re-evaluate again the predefined variables whose initial value
1305 ;; depends on the runtime context, in case some of them depend on
1306 ;; the window-system features. Example: blink-cursor-mode.
1307 (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
1308 (setq custom-delayed-init-variables nil)
1309
1310 (normal-erase-is-backspace-setup-frame) 1305 (normal-erase-is-backspace-setup-frame)
1311 1306
1312 ;; Register default TTY colors for the case the terminal hasn't a 1307 ;; 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 first
1487opens a graphical frame. 1482opens a graphical frame.
1488 1483
1489This can set the values of `menu-bar-mode', `tool-bar-mode', 1484This can set the values of `menu-bar-mode', `tool-bar-mode',
1490`tab-bar-mode', and `no-blinking-cursor', as well as the `cursor' face. 1485`tab-bar-mode', and `blink-cursor-mode', as well as the `cursor' face.
1491Changed settings will be marked as \"CHANGED outside of Customize\"." 1486Changed settings will be marked as \"CHANGED outside of Customize\"."
1492 (let ((no-vals '("no" "off" "false" "0")) 1487 (let ((no-vals '("no" "off" "false" "0"))
1493 (settings '(("menuBar" "MenuBar" menu-bar-mode nil) 1488 (settings '(("menuBar" "MenuBar" menu-bar-mode nil)
1494 ("toolBar" "ToolBar" tool-bar-mode nil) 1489 ("toolBar" "ToolBar" tool-bar-mode nil)
1495 ("scrollBar" "ScrollBar" scroll-bar-mode nil) 1490 ("scrollBar" "ScrollBar" scroll-bar-mode nil)
1496 ("cursorBlink" "CursorBlink" no-blinking-cursor t)))) 1491 ("cursorBlink" "CursorBlink" blink-cursor-mode nil))))
1497 (dolist (x settings) 1492 (dolist (x settings)
1498 (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals) 1493 (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
1499 (set (nth 2 x) (nth 3 x))))) 1494 (set (nth 2 x) (nth 3 x)))))