From f9ac92c539946ca1f4dc77e044dd05708c71e03d Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 20 Aug 2006 14:43:29 +0000 Subject: [PATCH] * frame.el (blink-cursor-start): Set timer first. (blink-cursor-end): Ignore timer cancelling errors. Suggested by Ken Manheimer. --- lisp/ChangeLog | 6 ++++++ lisp/frame.el | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7052812ddd0..9214570678c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-20 Chong Yidong + + * frame.el (blink-cursor-start): Set timer first. + (blink-cursor-end): Ignore timer cancelling errors. + Suggested by Ken Manheimer. + 2006-08-20 Juanma Barranquero * newcomment.el (comment-box): Call `comment-normalize-vars'. diff --git a/lisp/frame.el b/lisp/frame.el index a92fa3c8133..873cec6c783 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1291,11 +1291,13 @@ 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) - (add-hook 'pre-command-hook 'blink-cursor-end) - (internal-show-cursor nil nil) + ;; 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-timer (run-with-timer blink-cursor-interval blink-cursor-interval - 'blink-cursor-timer-function)))) + 'blink-cursor-timer-function)) + (add-hook 'pre-command-hook 'blink-cursor-end) + (internal-show-cursor nil nil))) (defun blink-cursor-timer-function () "Timer function of timer `blink-cursor-timer'." @@ -1308,10 +1310,11 @@ When run, it cancels the timer `blink-cursor-timer' and removes itself as a pre-command hook." (remove-hook 'pre-command-hook 'blink-cursor-end) (internal-show-cursor nil t) - (cancel-timer blink-cursor-timer) + (condition-case nil + (cancel-timer blink-cursor-timer) + (error nil)) (setq blink-cursor-timer nil)) - ;; Hourglass pointer -- 2.39.5