emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0cb44ee: Display times in a more human-readable way in list-timer


From: Lars Ingebrigtsen
Subject: master 0cb44ee: Display times in a more human-readable way in list-timers
Date: Wed, 28 Oct 2020 05:08:19 -0400 (EDT)

branch: master
commit 0cb44eed6c67b3db3991963d90a6573828285074
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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).
---
 lisp/emacs-lisp/timer-list.el | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index 00d0969..725ca31 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -49,23 +49,24 @@
                 (let ((time (list (aref timer 1)
                                  (aref timer 2)
                                  (aref timer 3))))
-                  (format "%10.2f"
-                         (float-time
-                          (if (aref timer 7)
-                              time
-                            (time-subtract time nil)))))
-                'help-echo "Time in sec till next invocation")
+                  (format "%12s"
+                          (format-seconds "%dd %hh %mm %z%ss"
+                                         (float-time
+                                          (if (aref timer 7)
+                                              time
+                                            (time-subtract time nil))))))
+                'help-echo "Time until next invocation")
               ;; Repeat.
-              ,(propertize
-                (let ((repeat (aref timer 4)))
-                  (cond
-                   ((numberp repeat)
-                    (format "%8.1f" repeat))
-                   ((null repeat)
-                    "       -")
-                   (t
-                    (format "%8s" repeat))))
-                'help-echo "Symbol: repeat; number: repeat interval in sec")
+              ,(let ((repeat (aref timer 4)))
+                 (cond
+                  ((numberp repeat)
+                   (propertize
+                    (format "%12s" (format-seconds "%dd %hh %mm %z%ss" repeat))
+                    'help-echo "Repeat interval"))
+                  ((null repeat)
+                   (propertize "           -" 'help-echo "Runs once"))
+                  (t
+                   (format "%12s" repeat))))
               ;; Function.
               ,(propertize
                 (let ((cl-print-compiled 'static)
@@ -93,8 +94,8 @@
   (setq-local revert-buffer-function #'list-timers)
   (setq tabulated-list-format
         '[("Idle" 6 timer-list--idle-predicate)
-          ("      Next" 12 timer-list--next-predicate)
-          ("  Repeat" 11 timer-list--repeat-predicate)
+          ("        Next" 12 timer-list--next-predicate)
+          ("      Repeat" 12 timer-list--repeat-predicate)
           ("Function" 10 timer-list--function-predicate)]))
 
 (defun timer-list--idle-predicate (A B)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]