aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2021-01-15 23:18:08 -0500
committerStefan Monnier2021-01-15 23:18:08 -0500
commit0732fc31932c75c682c8b65b4dcb4376ca63e8fd (patch)
treefe80ef126fd74275e607bfb4cf51be44fcf8bb00
parent1513ee37a4defbf1db7f26d1e8148843416dc987 (diff)
downloademacs-0732fc31932c75c682c8b65b4dcb4376ca63e8fd.tar.gz
emacs-0732fc31932c75c682c8b65b4dcb4376ca63e8fd.zip
* lisp/frame.el Don't activate `blink-cursor-idle-timer` needlessly.
(blink-cursor-mode): Use `blink-cursor-check` rather than `blink-cursor--start-idle-timer` so we check for the presence of a frame where the cursor can be blinked before activating the idle timer.
-rw-r--r--lisp/frame.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index c71276287aa..e2d7f21a498 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2557,7 +2557,7 @@ command starts, by installing a pre-command hook."
2557 ;; blink-cursor-end is not added to pre-command-hook. 2557 ;; blink-cursor-end is not added to pre-command-hook.
2558 (setq blink-cursor-blinks-done 1) 2558 (setq blink-cursor-blinks-done 1)
2559 (blink-cursor--start-timer) 2559 (blink-cursor--start-timer)
2560 (add-hook 'pre-command-hook 'blink-cursor-end) 2560 (add-hook 'pre-command-hook #'blink-cursor-end)
2561 (internal-show-cursor nil nil))) 2561 (internal-show-cursor nil nil)))
2562 2562
2563(defun blink-cursor-timer-function () 2563(defun blink-cursor-timer-function ()
@@ -2572,14 +2572,14 @@ command starts, by installing a pre-command hook."
2572 (when (and (> blink-cursor-blinks 0) 2572 (when (and (> blink-cursor-blinks 0)
2573 (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done)) 2573 (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done))
2574 (blink-cursor-suspend) 2574 (blink-cursor-suspend)
2575 (add-hook 'post-command-hook 'blink-cursor-check))) 2575 (add-hook 'post-command-hook #'blink-cursor-check)))
2576 2576
2577(defun blink-cursor-end () 2577(defun blink-cursor-end ()
2578 "Stop cursor blinking. 2578 "Stop cursor blinking.
2579This is installed as a pre-command hook by `blink-cursor-start'. 2579This is installed as a pre-command hook by `blink-cursor-start'.
2580When run, it cancels the timer `blink-cursor-timer' and removes 2580When run, it cancels the timer `blink-cursor-timer' and removes
2581itself as a pre-command hook." 2581itself as a pre-command hook."
2582 (remove-hook 'pre-command-hook 'blink-cursor-end) 2582 (remove-hook 'pre-command-hook #'blink-cursor-end)
2583 (internal-show-cursor nil t) 2583 (internal-show-cursor nil t)
2584 (when blink-cursor-timer 2584 (when blink-cursor-timer
2585 (cancel-timer blink-cursor-timer) 2585 (cancel-timer blink-cursor-timer)
@@ -2648,7 +2648,7 @@ terminals, cursor blinking is controlled by the terminal."
2648 (when blink-cursor-mode 2648 (when blink-cursor-mode
2649 (add-function :after after-focus-change-function #'blink-cursor--rescan-frames) 2649 (add-function :after after-focus-change-function #'blink-cursor--rescan-frames)
2650 (add-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames) 2650 (add-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
2651 (blink-cursor--start-idle-timer))) 2651 (blink-cursor-check)))
2652 2652
2653 2653
2654;; Frame maximization/fullscreen 2654;; Frame maximization/fullscreen