Cancel proced auto update timer if no proced buffers are open
* lisp/proced.el (proced-auto-update-timer): Cancel timer if no proced buffers are open.
This commit is contained in:
parent
7b09ed28ba
commit
07705f5ddc
1 changed files with 12 additions and 6 deletions
|
@ -740,12 +740,18 @@ Proced buffers."
|
|||
"Type \\<proced-mode-map>\\[quit-window] to quit, \\[proced-help] for help")))))
|
||||
|
||||
(defun proced-auto-update-timer ()
|
||||
"Auto-update Proced buffers using `run-at-time'."
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(if (and (eq major-mode 'proced-mode)
|
||||
proced-auto-update-flag)
|
||||
(proced-update t t)))))
|
||||
"Auto-update Proced buffers using `run-at-time'.
|
||||
|
||||
If there are no proced buffers, cancel the timer."
|
||||
(unless (seq-filter (lambda (buf)
|
||||
(with-current-buffer buf
|
||||
(when (eq major-mode 'proced-mode)
|
||||
(when proced-auto-update-flag
|
||||
(proced-update t t))
|
||||
t)))
|
||||
(buffer-list))
|
||||
(cancel-timer proced-auto-update-timer)
|
||||
(setq proced-auto-update-timer nil)))
|
||||
|
||||
(defun proced-toggle-auto-update (arg)
|
||||
"Change whether this Proced buffer is updated automatically.
|
||||
|
|
Loading…
Add table
Reference in a new issue