diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-01-08 15:22:33 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-01-08 15:22:33 +0100 |
commit | 3566a3eeeec847ba46a89cc1ba6a2195cf423e81 (patch) | |
tree | ffa01310d7be5c7c96d98a393b32b0c174c0981d | |
parent | 9c675b072758684f8485279a087f504c3edb793a (diff) | |
download | org-mode-3566a3eeeec847ba46a89cc1ba6a2195cf423e81.tar.gz |
org-clock: Fix `org-clock-display' called with `C-u C-u C-u'
* lisp/org-clock.el (org-clock-display): Compute H and M when
necessary.
-rw-r--r-- | lisp/org-clock.el | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 3704730..8352f5a 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1932,8 +1932,7 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times." (prop (cond ((not arg) :org-clock-minutes-default) (todayp :org-clock-minutes-today) (customp :org-clock-minutes-custom) - (t :org-clock-minutes))) - time h m p) + (t :org-clock-minutes)))) (cond ((not arg) (org-clock-sum-custom nil org-clock-display-default-range prop)) (todayp (org-clock-sum-today)) @@ -1942,27 +1941,27 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times." (unless (equal arg '(64)) (save-excursion (goto-char (point-min)) - (while (or (and (equal (setq p (point)) (point-min)) - (get-text-property p prop)) - (setq p (next-single-property-change - (point) prop))) - (goto-char p) - (when (setq time (get-text-property p prop)) - (org-clock-put-overlay time))) - (setq h (/ org-clock-file-total-minutes 60) - m (- org-clock-file-total-minutes (* 60 h))) + (let ((p nil)) + (while (or (and (equal (setq p (point)) (point-min)) + (get-text-property p prop)) + (setq p (next-single-property-change (point) prop))) + (goto-char p) + (let ((time (get-text-property p prop))) + (when time (org-clock-put-overlay time))))) ;; Arrange to remove the overlays upon next change. (when org-remove-highlights-with-change (add-hook 'before-change-functions 'org-clock-remove-overlays - nil 'local)))) - (message (concat (format "Total file time%s: " - (cond (todayp " for today") - (customp " (custom)") - (t ""))) - (org-duration-from-minutes - org-clock-file-total-minutes) - " (%d hours and %d minutes)") - h m))) + nil 'local)))) + (let* ((h (/ org-clock-file-total-minutes 60)) + (m (- org-clock-file-total-minutes (* 60 h)))) + (message (concat (format "Total file time%s: " + (cond (todayp " for today") + (customp " (custom)") + (t ""))) + (org-duration-from-minutes + org-clock-file-total-minutes) + " (%d hours and %d minutes)") + h m)))) (defvar-local org-clock-overlays nil) |