Watch the timer-list work in realtime


You know the list-timers command? It shows you all the active timers, but it's a snapshot frozen in time, at the moment you ran the command.

I was curious to watch the timers count down, so I made this command.

(let ((this-timer (timer-create)))
  (defun my-timer-list-animate ()
    "Start auto-refreshing the \\[list-timers] buffer.
Stop once the buffer is no longer visible."
    (cancel-timer this-timer)
    (let ((buf (get-buffer "*timer-list*")))
      (when (and buf (get-buffer-window buf 'visible))
        (run-with-timer .2 nil #'my-timer-list-animate)
            (with-current-buffer buf
(keymap-set timer-list-mode-map "a" #'my-timer-list-animate)

Interestingly, the idle timers still aren't shown to count down, even though idle-time is going up! I'm guessing list-timers never was meant for that, so it takes a shortcut by just showing the max time regardless.

Created (2 months ago)