changeset 72455:94094ff11364

* frame.el (blink-cursor-start): Set timer first. (blink-cursor-end): Ignore timer cancelling errors. Suggested by Ken Manheimer.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 20 Aug 2006 14:43:29 +0000
parents 1b7664312e38
children 044730770048
files lisp/ChangeLog lisp/frame.el
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Aug 20 12:53:20 2006 +0000
+++ b/lisp/ChangeLog	Sun Aug 20 14:43:29 2006 +0000
@@ -1,3 +1,9 @@
+2006-08-20  Chong Yidong  <cyd@stupidchicken.com>
+
+	* frame.el (blink-cursor-start): Set timer first.
+	(blink-cursor-end): Ignore timer cancelling errors.
+	Suggested by Ken Manheimer.
+
 2006-08-20  Juanma Barranquero  <lekktu@gmail.com>
 
 	* newcomment.el (comment-box): Call `comment-normalize-vars'.
--- a/lisp/frame.el	Sun Aug 20 12:53:20 2006 +0000
+++ b/lisp/frame.el	Sun Aug 20 14:43:29 2006 +0000
@@ -1291,11 +1291,13 @@
 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 @@
 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