Commit 1b966390 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(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.
parent 621ca7a2
...@@ -51,7 +51,9 @@ fire repeatedly that many seconds apart." ...@@ -51,7 +51,9 @@ fire repeatedly that many seconds apart."
(error "Invalid timer")) (error "Invalid timer"))
(aset timer 1 (car time)) (aset timer 1 (car time))
(aset timer 2 (if (consp (cdr time)) (car (cdr time)) (cdr 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)) (aset timer 4 (and (numberp delta) (> delta 0) delta))
timer) timer)
...@@ -216,7 +218,9 @@ fire repeatedly that many seconds apart." ...@@ -216,7 +218,9 @@ fire repeatedly that many seconds apart."
;; Delete from queue. ;; Delete from queue.
(cancel-timer timer) (cancel-timer timer)
;; Run handler ;; 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. ;; Re-schedule if requested.
(if (aref timer 4) (if (aref timer 4)
(if (aref timer 7) (if (aref timer 7)
...@@ -391,7 +395,10 @@ If the user does not answer after SECONDS seconds, return DEFAULT-VALUE." ...@@ -391,7 +395,10 @@ If the user does not answer after SECONDS seconds, return DEFAULT-VALUE."
secs (+ secs (* count itemsize))) secs (+ secs (* count itemsize)))
(setq secs nil (setq secs nil
start (length string))))) start (length string)))))
secs)) (if (= start (length string))
secs
(if (string-match "\\`[0-9.]+\\'" string)
(string-to-number string)))))
(provide 'timer) (provide 'timer)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment