X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lisp%2Fitimer.el;h=6c2d793a3f7abe7fc7612868ccd47bf6e08551e6;hp=32f93ff9c058fbe64831265dd844aaace2efbe9a;hb=52b3dd1157cecb0f190b11a0874fcb0a5df5e0e2;hpb=b73e352f264e9da0a00159dc29f318305cbe8636 diff --git a/lisp/itimer.el b/lisp/itimer.el index 32f93ff..6c2d793 100644 --- a/lisp/itimer.el +++ b/lisp/itimer.el @@ -48,7 +48,7 @@ ;; ;; See the doc strings of these functions for more information. -(defvar itimer-version "1.08" +(defvar itimer-version "1.09" "Version number of the itimer package.") (defvar itimer-list nil @@ -120,7 +120,7 @@ many seconds.") ;; signal errors appropriately if the arguments are not valid. (defmacro check-itimer (var) - "If VAR is not bound to an itimer, signal wrong-type-argument. + "If VAR is not bound to an itimer, signal `wrong-type-argument'. This is a macro." (list 'setq var (list 'if (list 'itimerp var) var @@ -139,7 +139,7 @@ wrong-type-argument. This is a macro." (list 'list ''string-or-itimer-p var)))))) (defmacro check-nonnegative-number (var) - "If VAR is not bound to a number, signal wrong-type-argument. + "If VAR is not bound to a number, signal `wrong-type-argument'. If VAR is not bound to a positive number, signal args-out-of-range. This is a macro." (list 'setq var @@ -151,7 +151,7 @@ This is a macro." var)))) (defmacro check-string (var) - "If VAR is not bound to a string, signal wrong-type-argument. + "If VAR is not bound to a string, signal `wrong-type-argument'. This is a macro." (list 'setq var (list 'if (list 'stringp var) var @@ -160,16 +160,16 @@ This is a macro." ;; Functions to access and modify itimer attributes. -(defun itimerp (obj) - "Return non-nil if OBJ is an itimer." - (and (consp obj) (eq (length obj) 8))) +(defun itimerp (object) + "Return non-nil if OBJECT is an itimer." + (and (consp object) (eq (length object) 8))) -(defun itimer-live-p (obj) - "Return non-nil if OBJ is an itimer and is active. +(defun itimer-live-p (object) + "Return non-nil if OBJECT is an itimer and is active. ``Active'' means Emacs will run it when it expires. -`activate-timer' must be called on an itimer to make it active. +`activate-itimer' must be called on an itimer to make it active. Itimers started with `start-itimer' are automatically active." - (and (itimerp obj) (memq obj itimer-list))) + (and (itimerp object) (memq object itimer-list))) (defun itimer-name (itimer) "Return the name of ITIMER." @@ -329,7 +329,7 @@ VALUE is the number of seconds until this itimer expires. must be an integer. Optional fourth arg RESTART non-nil means that this itimer should be restarted automatically after its function is called. Normally an itimer - is deleted at expiration after its function has returned. + is deleted at expiration after its function has returned. If non-nil RESTART should be a number indicating the value at which the itimer should be set at restart time. Optional fifth arg IS-IDLE specifies if this is an idle timer. @@ -406,6 +406,14 @@ its FUNCTION will be called when it expires, and so on." (error "itimer named \"%s\" already existing and activated" (itimer-name itimer)))) (let ((inhibit-quit t)) + (if itimer-timer + ;; Modify the itimer timeout value as if it were begun + ;; at the last time when the itimer driver was woken up. + (set-itimer-value + itimer + (+ (itimer-value itimer) + (itimer-time-difference (current-time) + itimer-timer-last-wakeup)))) ;; add the itimer to the global list (setq itimer-list (cons itimer itimer-list)) ;; If the itimer process is scheduled to wake up too late for @@ -505,7 +513,7 @@ x start a new itimer tab-stop-list '(22 32 40 60 67)) (abbrev-mode 0) (auto-fill-mode 0) - (buffer-flush-undo (current-buffer)) + (buffer-disable-undo (current-buffer)) (use-local-map itimer-edit-map) (set-syntax-table emacs-lisp-mode-syntax-table)) @@ -673,7 +681,7 @@ x start a new itimer (inhibit-quit t)) (setq next-wakeup 600) (cond ((and (boundp 'last-command-event-time) - (consp 'last-command-event-time)) + (consp last-command-event-time)) (setq last-event-time last-command-event-time idle-time (itimer-time-difference (current-time) last-event-time))) @@ -714,15 +722,20 @@ x start a new itimer (unwind-protect (condition-case condition-data (save-match-data + ;; Suppress warnings - see comment below. + (defvar last-event-time) + (defvar next-wakeup) + (defvar itimer) + (defvar itimers) + (defvar time-elapsed) (let* ((current-itimer itimer) (quit-flag nil) (inhibit-quit nil) ;; for FSF Emacs timer.el emulation under XEmacs. ;; eldoc expect this to be done, apparently. (this-command nil) - ;; bind these variables so that the - ;; itimer function can't screw with - ;; them. + ;; bind these variables so that the itimer + ;; function can't screw with them. last-event-time next-wakeup itimer itimers time-elapsed) (if (itimer-uses-arguments current-itimer)