]> code.delx.au - gnu-emacs/commitdiff
* frame.el (blink-cursor-start): Set timer first.
authorChong Yidong <cyd@stupidchicken.com>
Sun, 20 Aug 2006 14:43:29 +0000 (14:43 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 20 Aug 2006 14:43:29 +0000 (14:43 +0000)
(blink-cursor-end): Ignore timer cancelling errors.
Suggested by Ken Manheimer.

lisp/ChangeLog
lisp/frame.el

index 7052812ddd03fba024397535fca27d644704b2e2..9214570678c86c528fac10ea719507e224e2870e 100644 (file)
@@ -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'.
index a92fa3c8133e214ec0b96d65c8de6aebda5d8063..873cec6c783a65399054a201ba7c85708e0c0b6e 100644 (file)
@@ -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))
 
-
 \f
 ;; Hourglass pointer