diff options
| -rw-r--r-- | lisp/emacs-lisp/timer-list.el | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el index 17e5eb05928..00d09696d2a 100644 --- a/lisp/emacs-lisp/timer-list.el +++ b/lisp/emacs-lisp/timer-list.el | |||
| @@ -92,10 +92,37 @@ | |||
| 92 | (buffer-disable-undo) | 92 | (buffer-disable-undo) |
| 93 | (setq-local revert-buffer-function #'list-timers) | 93 | (setq-local revert-buffer-function #'list-timers) |
| 94 | (setq tabulated-list-format | 94 | (setq tabulated-list-format |
| 95 | '[("Idle" 4) | 95 | '[("Idle" 6 timer-list--idle-predicate) |
| 96 | (" Next" 10) | 96 | (" Next" 12 timer-list--next-predicate) |
| 97 | (" Repeat" 8) | 97 | (" Repeat" 11 timer-list--repeat-predicate) |
| 98 | ("Function" 0)])) | 98 | ("Function" 10 timer-list--function-predicate)])) |
| 99 | |||
| 100 | (defun timer-list--idle-predicate (A B) | ||
| 101 | "Predicate to sort Timer-List by the Idle column." | ||
| 102 | (let ((iA (aref (cadr A) 0)) | ||
| 103 | (iB (aref (cadr B) 0))) | ||
| 104 | (cond ((string= iA iB) | ||
| 105 | (timer-list--next-predicate A B)) | ||
| 106 | ((string= iA " *") nil) | ||
| 107 | (t t)))) | ||
| 108 | |||
| 109 | (defun timer-list--next-predicate (A B) | ||
| 110 | "Predicate to sort Timer-List by the Next column." | ||
| 111 | (let ((nA (string-to-number (aref (cadr A) 1))) | ||
| 112 | (nB (string-to-number (aref (cadr B) 1)))) | ||
| 113 | (< nA nB))) | ||
| 114 | |||
| 115 | (defun timer-list--repeat-predicate (A B) | ||
| 116 | "Predicate to sort Timer-List by the Repeat column." | ||
| 117 | (let ((rA (aref (cadr A) 2)) | ||
| 118 | (rB (aref (cadr B) 2))) | ||
| 119 | (string< rA rB))) | ||
| 120 | |||
| 121 | (defun timer-list--function-predicate (A B) | ||
| 122 | "Predicate to sort Timer-List by the Next column." | ||
| 123 | (let ((fA (aref (cadr A) 3)) | ||
| 124 | (fB (aref (cadr B) 3))) | ||
| 125 | (string< fA fB))) | ||
| 99 | 126 | ||
| 100 | (defun timer-list-cancel () | 127 | (defun timer-list-cancel () |
| 101 | "Cancel the timer on the line under point." | 128 | "Cancel the timer on the line under point." |