comparison lisp/gnus/gnus-demon.el @ 73139:1ae580684ad1

* gnus-demon.el (gnus-demon): Use with-local-quit to avoid hangs.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 26 Sep 2006 18:05:41 +0000
parents 1077b8039c32
children aeb79612dc36 bb0e318b7c53
comparison
equal deleted inserted replaced
73138:5f998245817f 73139:1ae580684ad1
216 ((null idle) t) ; Don't care about idle. 216 ((null idle) t) ; Don't care about idle.
217 ((numberp idle) ; Numerical idle... 217 ((numberp idle) ; Numerical idle...
218 (< idle gnus-demon-idle-time)) ; Idle timed out. 218 (< idle gnus-demon-idle-time)) ; Idle timed out.
219 (t (< 0 gnus-demon-idle-time)))) ; Or just need to be idle. 219 (t (< 0 gnus-demon-idle-time)))) ; Or just need to be idle.
220 ;; So we call the handler. 220 ;; So we call the handler.
221 (progn 221 (with-local-quit
222 (ignore-errors (funcall (car handler))) 222 (ignore-errors (funcall (car handler)))
223 ;; And reset the timer. 223 ;; And reset the timer.
224 (setcar (nthcdr 1 handler) 224 (setcar (nthcdr 1 handler)
225 (gnus-demon-time-to-step 225 (gnus-demon-time-to-step
226 (nth 1 (assq (car handler) gnus-demon-handlers))))))) 226 (nth 1 (assq (car handler) gnus-demon-handlers)))))))
230 ) 230 )
231 ((and (not (numberp idle)) 231 ((and (not (numberp idle))
232 (gnus-demon-is-idle-p)) 232 (gnus-demon-is-idle-p))
233 ;; We want to call this handler each and every time that 233 ;; We want to call this handler each and every time that
234 ;; Emacs is idle. 234 ;; Emacs is idle.
235 (ignore-errors (funcall (car handler)))) 235 (with-local-quit
236 (ignore-errors (funcall (car handler)))))
236 (t 237 (t
237 ;; We want to call this handler only if Emacs has been idle 238 ;; We want to call this handler only if Emacs has been idle
238 ;; for a specified number of timesteps. 239 ;; for a specified number of timesteps.
239 (and (not (memq (car handler) gnus-demon-idle-has-been-called)) 240 (and (not (memq (car handler) gnus-demon-idle-has-been-called))
240 (< idle gnus-demon-idle-time) 241 (< idle gnus-demon-idle-time)
241 (gnus-demon-is-idle-p) 242 (gnus-demon-is-idle-p)
242 (progn 243 (with-local-quit
243 (ignore-errors (funcall (car handler))) 244 (ignore-errors (funcall (car handler)))
244 ;; Make sure the handler won't be called once more in 245 ;; Make sure the handler won't be called once more in
245 ;; this idle-cycle. 246 ;; this idle-cycle.
246 (push (car handler) gnus-demon-idle-has-been-called))))))))) 247 (push (car handler) gnus-demon-idle-has-been-called)))))))))
247 248