Automatically clock into interrupted task only when not closed yet
This is to avoid jumping back to old task that are still pointed at by `org-clock-interrupted-task` that have long been closed. Let's see whether this is enough to handle this case.
This commit is contained in:
parent
7128144ee0
commit
498f4b78c4
|
@ -424,15 +424,21 @@ should not be clocked."
|
||||||
|
|
||||||
This functions tries to clock into the interrupted task, the
|
This functions tries to clock into the interrupted task, the
|
||||||
parent task, or the default task, in that order and only when
|
parent task, or the default task, in that order and only when
|
||||||
available, respectively. If none of these tasks is available,
|
available, respectively. Clock in to the interrupted task only
|
||||||
interactively query the user for the next task to clock into."
|
if it is not closed yet.
|
||||||
|
|
||||||
|
If none of the listed tasks is available, interactively query the
|
||||||
|
user for the next task to clock into."
|
||||||
(when (and (not org-clock-clocking-in)
|
(when (and (not org-clock-clocking-in)
|
||||||
(not org-clock-resolving-clocks-due-to-idleness))
|
(not org-clock-resolving-clocks-due-to-idleness))
|
||||||
(let ((parent-task (db/find-parent-task)))
|
(let ((parent-task (db/find-parent-task)))
|
||||||
(save-mark-and-excursion
|
(save-mark-and-excursion
|
||||||
(cond
|
(cond
|
||||||
((and (markerp org-clock-interrupted-task)
|
((and (markerp org-clock-interrupted-task)
|
||||||
(marker-buffer org-clock-interrupted-task))
|
(marker-buffer org-clock-interrupted-task)
|
||||||
|
(org-with-point-at org-clock-interrupted-task
|
||||||
|
(not (member (nth 2 (org-heading-components))
|
||||||
|
org-done-keywords))))
|
||||||
;; interrupted task is set
|
;; interrupted task is set
|
||||||
(org-with-point-at org-clock-interrupted-task
|
(org-with-point-at org-clock-interrupted-task
|
||||||
(org-clock-in)))
|
(org-clock-in)))
|
||||||
|
|
Loading…
Reference in New Issue