From: Lars Ingebrigtsen Date: Fri, 3 Sep 2021 08:40:21 +0000 (+0200) Subject: Make recent timer changes more backwards-compatible X-Git-Tag: emacs-28.0.90~1202 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d1f324766631ad15b1e893463e93000298f44480;p=emacs.git Make recent timer changes more backwards-compatible * lisp/emacs-lisp/timer.el (timerp, timer-event-handler): Make backwards-compatible with old .elc files that have their own versions of `timer-create'd structures. --- diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index f7715109c82..5c658eba803 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -57,7 +57,10 @@ (defun timerp (object) "Return t if OBJECT is a timer." - (and (vectorp object) (= (length object) 10))) + (and (vectorp object) + ;; Timers are now ten elements, but old .elc code may have + ;; shorter versions of `timer-create'. + (<= 9 (length object) 10))) (defsubst timer--check (timer) (or (timerp timer) (signal 'wrong-type-argument (list #'timerp timer)))) @@ -293,7 +296,8 @@ This function is called, by name, directly by the C code." repeats))))) ;; If we want integral multiples, we have to recompute ;; the repetition. - (when (and (timer--integral-multiple timer) + (when (and (> (length timer) 9) ; Backwards compatible. + (timer--integral-multiple timer) (not (timer--idle-delay timer))) (setf (timer--time timer) (timer-next-integral-multiple-of-time