summaryrefslogtreecommitdiff
path: root/lisp/frame.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2006-08-20 14:43:29 +0000
committerChong Yidong <cyd@stupidchicken.com>2006-08-20 14:43:29 +0000
commitf9ac92c539946ca1f4dc77e044dd05708c71e03d (patch)
tree508f76602a3188e6be07b62a40a7851e114b61c7 /lisp/frame.el
parent525efc448c2e574527761c8650a39c182d609788 (diff)
downloademacs-f9ac92c539946ca1f4dc77e044dd05708c71e03d.tar.gz
* frame.el (blink-cursor-start): Set timer first.
(blink-cursor-end): Ignore timer cancelling errors. Suggested by Ken Manheimer.
Diffstat (limited to 'lisp/frame.el')
-rw-r--r--lisp/frame.el13
1 files changed, 8 insertions, 5 deletions
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