mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-30 00:27:52 +00:00
org-clock.el: Allow to tell time you got back when resolving
* lisp/org-clock.el (org-clock-resolve): Allow to tell at what time (i.e. a HH:MM string) you "got back". Thanks to Dan Drake for suggesting this.
This commit is contained in:
parent
63fd0c09ca
commit
57841b5264
|
@ -1061,6 +1061,8 @@ g/G Indicate that you \"got back\" X minutes ago. This is quite
|
||||||
different from `k': it clocks you out from the beginning of
|
different from `k': it clocks you out from the beginning of
|
||||||
the idle period and clock you back in X minutes ago.
|
the idle period and clock you back in X minutes ago.
|
||||||
|
|
||||||
|
t/T Indicate that you \"got back\" at time HH:MM.
|
||||||
|
|
||||||
s/S Subtract the idle time from the current clock. This is the
|
s/S Subtract the idle time from the current clock. This is the
|
||||||
same as keeping 0 minutes.
|
same as keeping 0 minutes.
|
||||||
|
|
||||||
|
@ -1076,11 +1078,11 @@ to be CLOCKED OUT."))))
|
||||||
(while (or (null char-pressed)
|
(while (or (null char-pressed)
|
||||||
(and (not (memq char-pressed
|
(and (not (memq char-pressed
|
||||||
'(?k ?K ?g ?G ?s ?S ?C
|
'(?k ?K ?g ?G ?s ?S ?C
|
||||||
?j ?J ?i ?q)))
|
?j ?J ?i ?q ?t ?T)))
|
||||||
(or (ding) t)))
|
(or (ding) t)))
|
||||||
(setq char-pressed
|
(setq char-pressed
|
||||||
(read-char (concat (funcall prompt-fn clock)
|
(read-char (concat (funcall prompt-fn clock)
|
||||||
" [jkKgGSscCiq]? ")
|
" [jkKgGSscCiqtT]? ")
|
||||||
nil 45)))
|
nil 45)))
|
||||||
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
|
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
|
||||||
(default
|
(default
|
||||||
|
@ -1090,8 +1092,19 @@ to be CLOCKED OUT."))))
|
||||||
(and (memq ch '(?k ?K))
|
(and (memq ch '(?k ?K))
|
||||||
(read-number "Keep how many minutes? " default)))
|
(read-number "Keep how many minutes? " default)))
|
||||||
(gotback
|
(gotback
|
||||||
(and (memq ch '(?g ?G))
|
(or (and (memq ch '(?g ?G))
|
||||||
(read-number "Got back how many minutes ago? " default)))
|
(read-number "Got back how many minutes ago? " default))
|
||||||
|
(and (memq ch '(?t ?T))
|
||||||
|
(let* ((time (read-string "At what HH:MM time did you get back? "))
|
||||||
|
(mins (floor (float-time
|
||||||
|
(org-time-subtract
|
||||||
|
nil (encode-time
|
||||||
|
(org-parse-time-string
|
||||||
|
(concat (format-time-string "%F " last-valid)
|
||||||
|
time)))))
|
||||||
|
60)))
|
||||||
|
(if (wholenump mins) mins
|
||||||
|
(user-error "Enter a time in the past"))))))
|
||||||
(subtractp (memq ch '(?s ?S)))
|
(subtractp (memq ch '(?s ?S)))
|
||||||
(barely-started-p (org-time-less-p
|
(barely-started-p (org-time-less-p
|
||||||
(org-time-subtract last-valid (cdr clock))
|
(org-time-subtract last-valid (cdr clock))
|
||||||
|
@ -1127,9 +1140,9 @@ to be CLOCKED OUT."))))
|
||||||
(t
|
(t
|
||||||
(error "Unexpected, please report this as a bug")))
|
(error "Unexpected, please report this as a bug")))
|
||||||
(and gotback last-valid)
|
(and gotback last-valid)
|
||||||
(memq ch '(?K ?G ?S))
|
(memq ch '(?K ?G ?S ?T))
|
||||||
(and start-over
|
(and start-over
|
||||||
(not (memq ch '(?K ?G ?S ?C))))
|
(not (memq ch '(?K ?G ?S ?C ?T))))
|
||||||
fail-quietly)))))
|
fail-quietly)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Reference in a new issue