mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Display times in a more human-readable way in list-timers
* lisp/emacs-lisp/timer-list.el (list-timers): Format the intervals in a more human-readable way (bug#39956).
This commit is contained in:
parent
e6f8f68e37
commit
0cb44eed6c
1 changed files with 19 additions and 18 deletions
|
|
@ -49,23 +49,24 @@
|
||||||
(let ((time (list (aref timer 1)
|
(let ((time (list (aref timer 1)
|
||||||
(aref timer 2)
|
(aref timer 2)
|
||||||
(aref timer 3))))
|
(aref timer 3))))
|
||||||
(format "%10.2f"
|
(format "%12s"
|
||||||
(float-time
|
(format-seconds "%dd %hh %mm %z%ss"
|
||||||
(if (aref timer 7)
|
(float-time
|
||||||
time
|
(if (aref timer 7)
|
||||||
(time-subtract time nil)))))
|
time
|
||||||
'help-echo "Time in sec till next invocation")
|
(time-subtract time nil))))))
|
||||||
|
'help-echo "Time until next invocation")
|
||||||
;; Repeat.
|
;; Repeat.
|
||||||
,(propertize
|
,(let ((repeat (aref timer 4)))
|
||||||
(let ((repeat (aref timer 4)))
|
(cond
|
||||||
(cond
|
((numberp repeat)
|
||||||
((numberp repeat)
|
(propertize
|
||||||
(format "%8.1f" repeat))
|
(format "%12s" (format-seconds "%dd %hh %mm %z%ss" repeat))
|
||||||
((null repeat)
|
'help-echo "Repeat interval"))
|
||||||
" -")
|
((null repeat)
|
||||||
(t
|
(propertize " -" 'help-echo "Runs once"))
|
||||||
(format "%8s" repeat))))
|
(t
|
||||||
'help-echo "Symbol: repeat; number: repeat interval in sec")
|
(format "%12s" repeat))))
|
||||||
;; Function.
|
;; Function.
|
||||||
,(propertize
|
,(propertize
|
||||||
(let ((cl-print-compiled 'static)
|
(let ((cl-print-compiled 'static)
|
||||||
|
|
@ -93,8 +94,8 @@
|
||||||
(setq-local revert-buffer-function #'list-timers)
|
(setq-local revert-buffer-function #'list-timers)
|
||||||
(setq tabulated-list-format
|
(setq tabulated-list-format
|
||||||
'[("Idle" 6 timer-list--idle-predicate)
|
'[("Idle" 6 timer-list--idle-predicate)
|
||||||
(" Next" 12 timer-list--next-predicate)
|
(" Next" 12 timer-list--next-predicate)
|
||||||
(" Repeat" 11 timer-list--repeat-predicate)
|
(" Repeat" 12 timer-list--repeat-predicate)
|
||||||
("Function" 10 timer-list--function-predicate)]))
|
("Function" 10 timer-list--function-predicate)]))
|
||||||
|
|
||||||
(defun timer-list--idle-predicate (A B)
|
(defun timer-list--idle-predicate (A B)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue