;ELC ;;; compiled by rms@mole.gnu.ai.mit.edu on Thu Apr 4 11:55:12 1996 ;;; from file /gd/gnu/emacs/19.0/lisp/timer.el ;;; emacs version 19.30.95.1. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`timer.el' was compiled for Emacs 19.29 or later")) #@24 Create a timer object. (defalias 'timer-create #[nil "\"I )" [make-vector 8 nil timer 0 t] 4 (#$ . 469)]) #@32 Return t if OBJECT is a timer. (defalias 'timerp #[(object) " !\n GU" [vectorp object 8] 2 (#$ . 590)]) #@223 Set the trigger time of TIMER to TIME. TIME must be in the internal format returned by, e.g., `current-time'. If optional third argument DELTA is a non-zero integer, make the timer fire repeatedly that many seconds apart. (defalias 'timer-set-time #[(timer time &optional delta) " !\n! @I A: A@ AI A:7 AA:7 88I \nK\nVK\nI " [timerp timer error "Invalid timer" 1 time 2 3 0 4 delta] 4 (#$ . 706)]) #@158 Set the trigger idle time of TIMER to SECS. If optional third argument REPEAT is non-nil, make the timer fire each time Emacs is idle for that many seconds. (defalias 'timer-set-idle-time #[(timer secs &optional repeat) " !\n! I I I  \"  I " [timerp timer error "Invalid timer" 1 0 2 3 timer-inc-time secs 4 repeat] 3 (#$ . 1151)]) #@89 Advance TIME by SECS seconds and optionally USECS microseconds. SECS may be a fraction. (defalias 'timer-relative-time #[(time secs &optional usecs) "@A:A@AA8, \\!A !Z_!\\\f!\\ ʥ\\ \" \f̥\\\f\" \f U?h E+" [time 2 0 micro low high usecs floatp secs floor 1000000 mod 65536 logand 65535] 6 (#$ . 1511)]) #@97 Increment the time set in TIMER by SECS seconds and USECS microseconds. SECS may be a fraction. (defalias 'timer-inc-time #[(timer secs &optional usecs) " H H HE # @I A@I 8*I)" [timer-relative-time timer 1 2 3 secs usecs time 0] 5 (#$ . 1884)]) #@223 Set the trigger time of TIMER to TIME. TIME must be in the internal format returned by, e.g., `current-time'. If optional third argument DELTA is a non-zero integer, make the timer fire repeatedly that many seconds apart. (defalias 'timer-set-time-with-usecs #[(timer time usecs &optional delta) " !\n! @I A: A@ AI I \n9\nV9\nI " [timerp timer error "Invalid timer" 1 time 2 3 usecs 4 delta 0] 4 (#$ . 2160)]) #@62 Make TIMER call FUNCTION with optional ARGS when triggering. (defalias 'timer-set-function #[(timer function &optional args) " !\n! I I " [timerp timer error "Invalid timer" 5 function 6 args] 3 (#$ . 2610)]) #@41 Put TIMER on the list of active timers. (defalias 'timer-activate #[(timer) " ! H H H H H @HVt H @HUP H @HVt H @HU H @HU H @HV  A ,  B  B I I*LJ!" [timerp timer 1 2 3 5 timer-list nil last timers 0 7 error "Invalid or uninitialized timer"] 4 (#$ . 2839)]) #@56 Arrange to activate TIMER whenever Emacs is next idle. (defalias 'timer-activate-when-idle #[(timer) " ! H H H H H @HVt H @HUP H @HVt H @HU H @HU H @HV  A ,  B  B I I*LJ!" [timerp timer 1 2 3 5 timer-idle-list nil last timers 0 t 7 error "Invalid or uninitialized timer"] 4 (#$ . 3201)]) (defalias (quote disable-timeout) (quote cancel-timer)) #@46 Remove TIMER from the list of active timers. (defalias 'cancel-timer #[(timer) " !\n! \" \"LJ" [timerp timer error "Invalid timer" delq timer-list timer-idle-list nil] 3 (#$ . 3651)]) #@72 Cancel all timers scheduled by `run-at-time' which would run FUNCTION. (defalias 'cancel-function-timers #[(function) " @H = @\" A) : @H =2 @ \" A#)" [timer-list tail 5 function delq timer-idle-list nil] 4 (#$ . 3855) "aCancel timers of function: "]) (byte-code " #!B!B!, BƇ" [define-key special-event-map [timer-event] timer-event-handler boundp timer-event-last-2 nil current-load-list timer-event-last-1 timer-event-last] 4) #@52 Call the handler for the timer in the event EVENT. (defalias 'timer-event-handler #[(event) "\n !B !H!̏HKH8!KH#!K!*" [timer-event-last-1 timer-event-last-2 timer-event-last event copy-sequence t timer inhibit-quit timerp cancel-timer nil (byte-code " H H\"" [apply timer 5 6] 4) ((error)) 4 7 timer-activate-when-idle timer-inc-time 0 timer-activate error "Bogus timer event"] 4 (#$ . 4363) "e"]) #@38 Non-nil if EVENT is a timeout event. (defalias 'timeout-event-p #[(event) "< @=" [event timer-event] 2 (#$ . 4826)]) #@408 Perform an action after a delay of SECS seconds. Repeat the action every REPEAT seconds, if REPEAT is non-nil. TIME should be a string like "11:23pm", nil meaning now, a number of seconds from now, or a value from `encode-time'. REPEAT may be an integer or floating point number. The action is to call FUNCTION with arguments ARGS. This function returns a timer object which you can use in `cancel-timer'. (defalias 'run-at-time #[(time repeat function &rest args) "  \";&!% \f\");\\!!  \nY[\nͦ\nͥ 8 8 8 8&*:e!tt! ##!)" [time current-time timer-relative-time timer-duration secs require diary-lib diary-entry-time decode-time now hhmm 0 encode-time 100 3 4 5 8 error "Invalid time format" repeat "Invalid repetition interval" timer-create timer timer-set-time timer-set-function function args timer-activate] 10 (#$ . 4956) "sRun at time: \nNRepeat interval: \naFunction: "]) #@298 Perform an action after a delay of SECS seconds. Repeat the action every REPEAT seconds, if REPEAT is non-nil. SECS and REPEAT may be integers or floating point numbers. The action is to call FUNCTION with arguments ARGS. This function returns a timer object which you can use in `cancel-timer'. (defalias 'run-with-timer #[(secs repeat function &rest args) "\n \f %" [apply run-at-time secs repeat function args] 6 (#$ . 5941) "sRun after delay (seconds): \nNRepeat interval: \naFunction: "]) #@195 Add a timer to run SECS seconds from now, to call FUNCTION on OBJECT. If REPEAT is non-nil, repeat the timer every REPEAT seconds. This function is for compatibility; see also `run-with-timer'. (defalias 'add-timeout #[(secs function object &optional repeat) " \n \f$" [run-with-timer secs repeat function object] 5 (#$ . 6446)]) #@315 Perform an action the next time Emacs is idle for SECS seconds. If REPEAT is non-nil, do this each time Emacs is idle for SECS seconds. SECS may be an integer or a floating point number. The action is to call FUNCTION with arguments ARGS. This function returns a timer object which you can use in `cancel-timer'. (defalias 'run-with-idle-timer #[(secs repeat function &rest args) "  \f# # ! )" [timer-create timer timer-set-function function args timer-set-idle-time secs repeat timer-activate-when-idle] 4 (#$ . 6785) (list (read-from-minibuffer "Run after idle (seconds): " nil nil t) (y-or-n-p "Repeat each time Emacs is idle? ") (intern (completing-read "Function: " obarray (quote fboundp) t)))]) (defalias 'with-timeout-handler #[(tag) " \"" [throw tag timeout] 3]) #@450 Run BODY, but if it doesn't finish in SECONDS seconds, give up. If we give up, we run the TIMEOUT-FORMS and return the value of the last one. The call should look like: (with-timeout (SECONDS TIMEOUT-FORMS...) BODY...) The timeout is checked whenever Emacs waits for some kind of external event (such as keyboard input, input from subprocesses, or a certain time); if the program loops without waiting in any way, the timeout will not be detected. (defalias 'with-timeout '(macro . #[(list &rest body) "@A\nBBEBEBBBE BBBBE*" [list timeout-forms seconds let ((with-timeout-tag (cons nil nil)) with-timeout-value with-timeout-timer) if catch with-timeout-tag progn setq with-timeout-timer run-with-timer (nil (quote with-timeout-handler) with-timeout-tag) with-timeout-value body (nil) ((cancel-timer with-timeout-timer) with-timeout-value)] 11 (#$ . 7582)])) #@114 Like (y-or-n-p PROMPT), with a timeout. If the user does not answer after SECONDS seconds, return DEFAULT-VALUE. (defalias 'y-or-n-p-with-timeout #[(prompt seconds default-value) "Bč  !\n+" [nil with-timeout-timer with-timeout-value with-timeout-tag (byte-code " \f$!‡" [run-with-timer seconds nil with-timeout-handler with-timeout-tag with-timeout-timer y-or-n-p prompt with-timeout-value] 5) default-value cancel-timer] 4 (#$ . 8471)]) #@54 Alist mapping temporal words to durations in seconds (defvar timer-duration-words (byte-code "BBBBBBBBBBBBB_B" ["microsec" 1e-006 "microsecond" 1e-006 "millisec" .001 "millisecond" .001 "sec" 1 "second" "min" 60 "minute" "hour" 3600 "day" 86400 "week" 604800 "fortnight" 1209600 "month" 2592000 "year" 365.25] 16) (#$ . 8943)) #@72 Return number of seconds specified by STRING, or nil if parsing fails. (defalias 'timer-duration #[(string) " #JȔ\"!\" \"A@\f_\\FG* GUV\fb\"b!+" [0 t case-fold-search start secs string-match "[ ]*\\([0-9.]+\\)?[ ]*\\([a-z]+[a-rt-z]\\)s?[ ]*" string 1 string-to-number match-string assoc 2 timer-duration-words itemsize count nil "\\`[0-9.]+\\'"] 5 (#$ . 9308)]) (provide (quote timer))