* 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.
This commit is contained in:
Stefan Monnier
2021-01-19 12:10:48 -05:00
parent 3c58443855
commit deb90c893d
5 changed files with 18 additions and 27 deletions

View File

@@ -326,6 +326,10 @@ the buffer cycles the whole buffer between "only top-level headings",
* 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)).

View File

@@ -880,7 +880,7 @@ since it could result in memory overflow and make Emacs crash."
;; 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,

View File

@@ -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)

View File

@@ -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)
(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'."
@@ -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)
(blink-cursor--start-idle-timer))
should-blink))
@@ -2637,16 +2639,16 @@ 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 (display-blink-cursor-p))))
:initialize 'custom-initialize-delay
(eq system-type 'ms-dos)))
:initialize #'custom-initialize-delay
:group 'cursor
:global t
(blink-cursor-suspend)
(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 #'blink-cursor--rescan-frames)
(add-function :after after-focus-change-function
#'blink-cursor--rescan-frames)
(add-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
(blink-cursor-check)))

View File

@@ -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")
(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 @@ to reading the init file), or afterwards when the user first
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)))))