mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
Use timer accessors instead of aref/aset
* lisp/emacs-lisp/timer-list.el (list-timers): * lisp/gnus/mail-source.el (mail-source-start-idle-timer): * lisp/play/gamegrid.el (gamegrid-set-timer): * lisp/progmodes/vhdl-mode.el (vhdl-run-when-idle): * lisp/simple.el (analyze-text-conversion): * lisp/time.el (display-time-event-handler): Use timer accessors.
This commit is contained in:
parent
d2cb9f2bf6
commit
e56e4b345a
@ -41,23 +41,21 @@
|
||||
nil
|
||||
`[ ;; Idle.
|
||||
,(propertize
|
||||
(if (aref timer 7) " *" " ")
|
||||
(if (timer--idle-delay timer) " *" " ")
|
||||
'help-echo "* marks idle timers"
|
||||
'timer timer)
|
||||
;; Next time.
|
||||
,(propertize
|
||||
(let ((time (list (aref timer 1)
|
||||
(aref timer 2)
|
||||
(aref timer 3))))
|
||||
(let ((time (timer--time timer)))
|
||||
(format "%12s"
|
||||
(format-seconds "%dd %hh %mm %z%,1ss"
|
||||
(float-time
|
||||
(if (aref timer 7)
|
||||
(if (timer--idle-delay timer)
|
||||
time
|
||||
(time-subtract time nil))))))
|
||||
'help-echo "Time until next invocation")
|
||||
;; Repeat.
|
||||
,(let ((repeat (aref timer 4)))
|
||||
,(let ((repeat (timer--repeat-delay timer)))
|
||||
(cond
|
||||
((numberp repeat)
|
||||
(propertize
|
||||
@ -73,7 +71,7 @@
|
||||
(let ((cl-print-compiled 'static)
|
||||
(cl-print-compiled-button nil)
|
||||
(print-escape-newlines t))
|
||||
(cl-prin1-to-string (aref timer 5)))
|
||||
(cl-prin1-to-string (timer--function timer)))
|
||||
'help-echo "Function called by timer")]))
|
||||
(append timer-list timer-idle-list)))
|
||||
(tabulated-list-print))
|
||||
|
@ -954,9 +954,8 @@ See the Gnus manual for details."
|
||||
;; Since idle timers created when Emacs is already in the idle
|
||||
;; state don't get activated until Emacs _next_ becomes idle, we
|
||||
;; need to force our timer to be considered active now. We do
|
||||
;; this by being naughty and poking the timer internals directly
|
||||
;; (element 0 of the vector is nil if the timer is active).
|
||||
(aset mail-source-report-new-mail-idle-timer 0 nil)))
|
||||
;; this by being naughty and poking the timer internals directly.
|
||||
(setf (timer--triggered mail-source-report-new-mail-idle-timer) nil)))
|
||||
|
||||
(declare-function display-time-event-handler "time" ())
|
||||
|
||||
|
@ -493,11 +493,7 @@ convert to an Emacs image-spec instead")
|
||||
|
||||
(defun gamegrid-set-timer (delay)
|
||||
(if gamegrid-timer
|
||||
(timer-set-time gamegrid-timer
|
||||
(list (aref gamegrid-timer 1)
|
||||
(aref gamegrid-timer 2)
|
||||
(aref gamegrid-timer 3))
|
||||
delay)))
|
||||
(timer-set-time gamegrid-timer (timer--time gamegrid-timer) delay)))
|
||||
|
||||
(defun gamegrid-kill-timer ()
|
||||
(if gamegrid-timer
|
||||
|
@ -2341,7 +2341,7 @@ Ignore byte-compiler warnings you might see."
|
||||
(if (fboundp 'start-itimer)
|
||||
(start-itimer "vhdl-mode" function secs repeat t)
|
||||
;; explicitly activate timer (necessary when Emacs is already idle)
|
||||
(aset (run-with-idle-timer secs repeat function) 0 nil)))
|
||||
(setf (timer--triggered (run-with-idle-timer secs repeat function)) nil)))
|
||||
|
||||
(defun vhdl-warning-when-idle (&rest args)
|
||||
"Wait until idle, then print out warning STRING and beep."
|
||||
|
@ -11354,8 +11354,7 @@ seconds."
|
||||
(if timer
|
||||
;; The timer is already running. See if it's due to expire
|
||||
;; within the next five seconds.
|
||||
(let ((time (list (aref timer 1) (aref timer 2)
|
||||
(aref timer 3))))
|
||||
(let ((time (timer--time timer)))
|
||||
(unless (<= (time-convert (time-subtract time nil)
|
||||
'integer)
|
||||
5)
|
||||
|
@ -239,8 +239,8 @@ would give mode line times like `94/12/30 21:07:48 (UTC)'."
|
||||
(timer display-time-timer)
|
||||
;; Compute the time when this timer will run again, next.
|
||||
(next-time (timer-relative-time
|
||||
(list (aref timer 1) (aref timer 2) (aref timer 3))
|
||||
(* 5 (aref timer 4)) 0)))
|
||||
(timer--time timer)
|
||||
(* 5 (timer--repeat-delay timer)) 0)))
|
||||
;; If the activation time is not in the future,
|
||||
;; skip executions until we reach a time in the future.
|
||||
;; This avoids a long pause if Emacs has been suspended for hours.
|
||||
|
Loading…
Reference in New Issue
Block a user