Show total clocked time in mode line.

(Instead time since last start)
This commit is contained in:
krick 2009-05-26 23:30:38 +02:00
parent 7c2930e96b
commit 3c2099c29b
1 changed files with 23 additions and 13 deletions

View File

@ -170,6 +170,9 @@ If you don't have alsa, it is better to be .wav file"
(defvar org-clock-effort ""
"Effort estimate of the currently clocking task")
(defvar org-clock-total-time ""
"Holds total time, spent on currently clocked item before start of current clock.")
(defvar org-clock-history nil
"List of marker pointing to recent clocked tasks.")
@ -279,6 +282,14 @@ pointing to it."
(cons i marker)))))
(defun org-clock-sum-current-item ()
"Returns time, clocked on current item in total"
(save-restriction
(org-narrow-to-subtree)
(org-clock-sum)
org-clock-file-total-minutes)
)
(defun org-clock-get-clock-string ()
"Form a clock-string, that will be show in the mode line.
If effort estimate was defined for current item, then use 01:30/01:50 format (clocked/estimated).
@ -315,6 +326,17 @@ If not, then 01:50 format (clocked).
(if org-clock-effort (org-clock-notify-once-if-expired))
(force-mode-line-update))
(defun org-clock-get-clocked-time ()
"In minutes."
(let ((currently-clocked-time (floor (- (time-to-seconds (current-time))
(time-to-seconds org-clock-start-time)) 60)))
;; (if org-clock-effort
(+ currently-clocked-time org-clock-total-time)
;; currently-clocked-time
;; )
))
(defvar org-clock-notification-was-shown nil
"Shows if we have shown notification already.")
@ -360,19 +382,6 @@ Use alsa's aplay tool if available."
))
(defun org-clock-get-clocked-time ()
"In minutes."
(let ((currently-clocked-time (floor (- (time-to-seconds (current-time))
(time-to-seconds org-clock-start-time)) 60)))
;; (if org-clock-show-total-time
;; ;; TODO: make total-clocked-time TOTAL, and not current clocked time :)
;; currently-clocked-time
currently-clocked-time
;; )
))
(defvar org-clock-mode-line-entry nil
"Information for the modeline about the running clock.")
@ -476,6 +485,7 @@ the clocking selection, associated with the letter `d'."
(org-indent-line-to (- (org-get-indentation) 2)))
(insert org-clock-string " ")
(setq org-clock-effort (org-get-effort))
(setq org-clock-total-time (org-clock-sum-current-item))
(setq org-clock-start-time (current-time))
(setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive))))
(move-marker org-clock-marker (point) (buffer-base-buffer))