From d1f324766631ad15b1e893463e93000298f44480 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 3 Sep 2021 10:40:21 +0200 Subject: [PATCH] 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. --- lisp/emacs-lisp/timer.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 -- 2.39.2