aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman2002-06-13 22:27:37 +0000
committerRichard M. Stallman2002-06-13 22:27:37 +0000
commit216640c5ded06bab6f8b1aa3ee900f86e3d886b3 (patch)
tree4402cc2f0045dde263844cb7b81e52f127db0539 /lisp
parent9dde4e0c8f89a33195cdbe33fe18ce8b89e07a92 (diff)
downloademacs-216640c5ded06bab6f8b1aa3ee900f86e3d886b3.tar.gz
emacs-216640c5ded06bab6f8b1aa3ee900f86e3d886b3.zip
(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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/play/zone.el23
2 files changed, 19 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fa3842ff054..a87506ec725 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12002-06-13 Richard M. Stallman <rms@gnu.org>
2
3 * play/zone.el (zone-timer): New variable holds the idle timer.
4 (zone): Don't fiddle with the idle timer at all.
5 (zone-when-idle): Put the idle timer in zone-timer.
6 If one is already set up, cancel it and make a new one.
7 (zone-leave-me-alone): Likewise.
8
12002-06-13 Jason Rumney <jasonr@gnu.org> 92002-06-13 Jason Rumney <jasonr@gnu.org>
2 10
3 * w32-fns.el (w32-charset-info-alist): Reorder. 11 * w32-fns.el (w32-charset-info-alist): Reorder.
diff --git a/lisp/play/zone.el b/lisp/play/zone.el
index 8c0a581c088..b2781c8afbf 100644
--- a/lisp/play/zone.el
+++ b/lisp/play/zone.el
@@ -47,6 +47,9 @@
47(defvar zone-idle 20 47(defvar zone-idle 20
48 "*Seconds to idle before zoning out.") 48 "*Seconds to idle before zoning out.")
49 49
50(defvar zone-timer nil
51 "The timer we use to decide when to zone out, or nil if none.")
52
50(defvar zone-timeout nil 53(defvar zone-timeout nil
51 "*Seconds to timeout the zoning. 54 "*Seconds to timeout the zoning.
52If nil, don't interrupt for about 1^26 seconds.") 55If 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,
132(defun zone () 135(defun zone ()
133 "Zone out, completely." 136 "Zone out, completely."
134 (interactive) 137 (interactive)
135 (let ((timer (get 'zone 'timer)))
136 (and (timerp timer) (cancel-timer timer)))
137 (put 'zone 'timer nil)
138 (let ((f (selected-frame)) 138 (let ((f (selected-frame))
139 (outbuf (get-buffer-create "*zone*")) 139 (outbuf (get-buffer-create "*zone*"))
140 (text (buffer-substring (window-start) (window-end))) 140 (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,
175 (sit-for 3))) 175 (sit-for 3)))
176 (quit (ding) (message "Zoning...sorry"))) 176 (quit (ding) (message "Zoning...sorry")))
177 (when ct (modify-frame-parameters f (list (cons 'cursor-type ct))))) 177 (when ct (modify-frame-parameters f (list (cons 'cursor-type ct)))))
178 (kill-buffer outbuf) 178 (kill-buffer outbuf)))
179 (zone-when-idle zone-idle)))
180 179
181;;;; Zone when idle, or not. 180;;;; Zone when idle, or not.
182 181
183(defun zone-when-idle (secs) 182(defun zone-when-idle (secs)
184 "Zone out when Emacs has been idle for SECS seconds." 183 "Zone out when Emacs has been idle for SECS seconds."
185 (interactive "nHow long before I start zoning (seconds): ") 184 (interactive "nHow long before I start zoning (seconds): ")
185 (if (timerp zone-timer)
186 (cancel-timer zone-timer))
187 (setq zone-timer nil)
186 (or (<= secs 0) 188 (or (<= secs 0)
187 (let ((timer (get 'zone 'timer))) 189 (setq zone-timer (run-with-idle-timer secs t 'zone))))
188 (or (eq timer t)
189 (timerp timer)))
190 (put 'zone 'timer (run-with-idle-timer secs t 'zone))))
191 190
192(defun zone-leave-me-alone () 191(defun zone-leave-me-alone ()
193 "Don't zone out when Emacs is idle." 192 "Don't zone out when Emacs is idle."
194 (interactive) 193 (interactive)
195 (let ((timer (get 'zone 'timer))) 194 (if (timerp zone-timer)
196 (and (timerp timer) (cancel-timer timer))) 195 (cancel-timer zone-timer))
197 (put 'zone 'timer t) 196 (setq zone-timer nil)
198 (message "I won't zone out any more")) 197 (message "I won't zone out any more"))
199 198
200 199