Mercurial > emacs
comparison lisp/timer.el @ 19588:f51f46bef183
(timer-event-handler): Reactivate timer first,
then run the handler function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 28 Aug 1997 01:03:17 +0000 |
parents | 95f0456681cc |
children | 01102e63ed88 |
comparison
equal
deleted
inserted
replaced
19587:7d59cb04d2d9 | 19588:f51f46bef183 |
---|---|
262 (let ((inhibit-quit t)) | 262 (let ((inhibit-quit t)) |
263 (if (timerp timer) | 263 (if (timerp timer) |
264 (progn | 264 (progn |
265 ;; Delete from queue. | 265 ;; Delete from queue. |
266 (cancel-timer timer) | 266 (cancel-timer timer) |
267 ;; Run handler | |
268 (condition-case nil | |
269 (apply (aref timer 5) (aref timer 6)) | |
270 (error nil)) | |
271 ;; Re-schedule if requested. | 267 ;; Re-schedule if requested. |
272 (if (aref timer 4) | 268 (if (aref timer 4) |
273 (if (aref timer 7) | 269 (if (aref timer 7) |
274 (timer-activate-when-idle timer) | 270 (timer-activate-when-idle timer) |
275 (timer-inc-time timer (aref timer 4) 0) | 271 (timer-inc-time timer (aref timer 4) 0) |
280 (< 0 (timer-until timer (current-time)))) | 276 (< 0 (timer-until timer (current-time)))) |
281 (let ((repeats (/ (timer-until timer (current-time)) | 277 (let ((repeats (/ (timer-until timer (current-time)) |
282 (aref timer 4)))) | 278 (aref timer 4)))) |
283 (if (> repeats timer-max-repeats) | 279 (if (> repeats timer-max-repeats) |
284 (timer-inc-time timer (* (aref timer 4) repeats))))) | 280 (timer-inc-time timer (* (aref timer 4) repeats))))) |
285 (timer-activate timer)))) | 281 (timer-activate timer))) |
282 ;; Run handler. | |
283 ;; We do this after rescheduling so that the handler function | |
284 ;; can cancel its own timer successfully with cancel-timer. | |
285 (condition-case nil | |
286 (apply (aref timer 5) (aref timer 6)) | |
287 (error nil))) | |
286 (error "Bogus timer event")))) | 288 (error "Bogus timer event")))) |
287 | 289 |
288 ;; This function is incompatible with the one in levents.el. | 290 ;; This function is incompatible with the one in levents.el. |
289 (defun timeout-event-p (event) | 291 (defun timeout-event-p (event) |
290 "Non-nil if EVENT is a timeout event." | 292 "Non-nil if EVENT is a timeout event." |