summaryrefslogtreecommitdiff
path: root/lisp/timer.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-03-24 02:05:38 +0000
committerRichard M. Stallman <rms@gnu.org>1996-03-24 02:05:38 +0000
commit1b96639086a32d97510457ab856c3f5f2640fd53 (patch)
tree870504c181cef2aedce35c9af70e92cdb01b279b /lisp/timer.el
parent621ca7a223232ba4af0f76cb4d49edc3cba40ad9 (diff)
downloademacs-1b96639086a32d97510457ab856c3f5f2640fd53.tar.gz
(timer-set-time): Don't set usecs to nil.
(timer-duration): Return nil if junk at end of string. Handle just a number--treat it as number of seconds.
Diffstat (limited to 'lisp/timer.el')
-rw-r--r--lisp/timer.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/timer.el b/lisp/timer.el
index 95e41965fce..bbf59d185d6 100644
--- a/lisp/timer.el
+++ b/lisp/timer.el
@@ -51,7 +51,9 @@ fire repeatedly that many seconds apart."
(error "Invalid timer"))
(aset timer 1 (car time))
(aset timer 2 (if (consp (cdr time)) (car (cdr time)) (cdr time)))
- (aset timer 3 (if (consp (cdr time)) (nth 2 time) 0))
+ (aset timer 3 (or (and (consp (cdr time)) (consp (cdr (cdr time)))
+ (nth 2 time))
+ 0))
(aset timer 4 (and (numberp delta) (> delta 0) delta))
timer)
@@ -216,7 +218,9 @@ fire repeatedly that many seconds apart."
;; Delete from queue.
(cancel-timer timer)
;; Run handler
- (apply (aref timer 5) (aref timer 6))
+ (condition-case nil
+ (apply (aref timer 5) (aref timer 6))
+ (error nil))
;; Re-schedule if requested.
(if (aref timer 4)
(if (aref timer 7)
@@ -391,7 +395,10 @@ If the user does not answer after SECONDS seconds, return DEFAULT-VALUE."
secs (+ secs (* count itemsize)))
(setq secs nil
start (length string)))))
- secs))
+ (if (= start (length string))
+ secs
+ (if (string-match "\\`[0-9.]+\\'" string)
+ (string-to-number string)))))
(provide 'timer)