diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-08-17 15:39:18 -0700 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2019-08-18 17:36:13 -0400 |
commit | a3fcf6dff4cc9efd21ec087e14424f1a3f7b14d5 (patch) | |
tree | c7dd6d87d2983076b6987324b9192e8253278895 | |
parent | bdc5861cf726d23cfa6f7f7b0ec2b32219fab99a (diff) | |
download | org-mode-a3fcf6dff4cc9efd21ec087e14424f1a3f7b14d5.tar.gz |
Backport commit 3d1c9a77c from Emacs
* lisp/org-timer.el (org-timer-show-remaining-time):
Don’t assume the remaining time is less than one hour.
Simplify. The simplification removes the need for a
decode-time, and fixes a typo I introduced recently.
Fix org-timer-show-remaining-time > 1 hour
3d1c9a77c52664c8c3e4fa1ae25e1d13aab9b2f9
Paul Eggert
Sat Aug 17 17:22:25 2019 -0700
Note(km): This replaces porting of Emacs's c90a420779 (Add FIXMEs for
subsecond support, 2019-08-17). It's modified to use
org-time-subtract and org-time-convert-to-integer for backward
compatibility.
-rw-r--r-- | lisp/org-timer.el | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lisp/org-timer.el b/lisp/org-timer.el index aff2853..c740e94 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -386,16 +386,15 @@ VALUE can be `on', `off', or `paused'." (defun org-timer-show-remaining-time () "Display the remaining time before the timer ends." (interactive) - (require 'time) - (if (not org-timer-countdown-timer) - (message "No timer set") - (let* ((rtime (decode-time - (time-subtract (timer--time org-timer-countdown-timer) - (current-time)))) - (rsecs (nth 0 rtime)) - (rmins (nth 1 rtime))) - (message "%d minute(s) %d seconds left before next time out" - rmins rsecs)))) + (message + (if (not org-timer-countdown-timer) + "No timer set" + (format-seconds + "%m minute(s) %s seconds left before next time out" + ;; Note: Once our minimal require is Emacs 27, we can drop this + ;; org-time-convert-to-integer call. + (org-time-convert-to-integer + (org-time-subtract (timer--time org-timer-countdown-timer) nil)))))) ;;;###autoload (defun org-timer-set-timer (&optional opt) |