]> git.eshelyaron.com Git - emacs.git/commitdiff
(zone-timer): New variable holds the idle timer.
authorRichard M. Stallman <rms@gnu.org>
Thu, 13 Jun 2002 22:27:37 +0000 (22:27 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 13 Jun 2002 22:27:37 +0000 (22:27 +0000)
(zone): Don't fiddle with the idle timer at all.
(zone-when-idle): Put the idle timer in zone-timer.
If one is already set up, cancel it and make a new one.
(zone-leave-me-alone): Likewise.

lisp/ChangeLog
lisp/play/zone.el

index fa3842ff0544ab7d907827e72635ebec3727e64f..a87506ec72509efd5897d938ecbd2f47ff6428cc 100644 (file)
@@ -1,3 +1,11 @@
+2002-06-13  Richard M. Stallman  <rms@gnu.org>
+
+       * play/zone.el (zone-timer): New variable holds the idle timer.
+       (zone): Don't fiddle with the idle timer at all.
+       (zone-when-idle): Put the idle timer in zone-timer. 
+       If one is already set up, cancel it and make a new one.
+       (zone-leave-me-alone): Likewise.
+
 2002-06-13  Jason Rumney  <jasonr@gnu.org>
 
        * w32-fns.el (w32-charset-info-alist): Reorder.
index 8c0a581c0886c56616f87418f298ed649d01c087..b2781c8afbf575cd03cd8368b616ced69514ccbc 100644 (file)
@@ -47,6 +47,9 @@
 (defvar zone-idle 20
   "*Seconds to idle before zoning out.")
 
+(defvar zone-timer nil
+  "The timer we use to decide when to zone out, or nil if none.")
+
 (defvar zone-timeout nil
   "*Seconds to timeout the zoning.
 If nil, don't interrupt for about 1^26 seconds.")
@@ -132,9 +135,6 @@ If the element is a function or a list of a function and a number,
 (defun zone ()
   "Zone out, completely."
   (interactive)
-  (let ((timer (get 'zone 'timer)))
-    (and (timerp timer) (cancel-timer timer)))
-  (put 'zone 'timer nil)
   (let ((f (selected-frame))
         (outbuf (get-buffer-create "*zone*"))
         (text (buffer-substring (window-start) (window-end)))
@@ -175,26 +175,25 @@ If the element is a function or a list of a function and a number,
            (sit-for 3)))
         (quit (ding) (message "Zoning...sorry")))
       (when ct (modify-frame-parameters f (list (cons 'cursor-type ct)))))
-    (kill-buffer outbuf)
-    (zone-when-idle zone-idle)))
+    (kill-buffer outbuf)))
 
 ;;;; Zone when idle, or not.
 
 (defun zone-when-idle (secs)
   "Zone out when Emacs has been idle for SECS seconds."
   (interactive "nHow long before I start zoning (seconds): ")
+  (if (timerp zone-timer)
+      (cancel-timer zone-timer))
+  (setq zone-timer nil)
   (or (<= secs 0)
-      (let ((timer (get 'zone 'timer)))
-        (or (eq timer t)
-            (timerp timer)))
-      (put 'zone 'timer (run-with-idle-timer secs t 'zone))))
+      (setq zone-timer (run-with-idle-timer secs t 'zone))))
 
 (defun zone-leave-me-alone ()
   "Don't zone out when Emacs is idle."
   (interactive)
-  (let ((timer (get 'zone 'timer)))
-    (and (timerp timer) (cancel-timer timer)))
-  (put 'zone 'timer t)
+  (if (timerp zone-timer)
+      (cancel-timer zone-timer))
+  (setq zone-timer nil)
   (message "I won't zone out any more"))