Only search for parent task for clock continuation when necessary

Avoid unnessary work by leveraging the fact that `setq` returns the new
value of the variable being set :D
This commit is contained in:
Daniel - 2023-12-08 17:45:10 +01:00
parent 498f4b78c4
commit d1e3409e80
Signed by: dbo
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 4 additions and 3 deletions

View File

@ -431,7 +431,7 @@ If none of the listed tasks is available, interactively query the
user for the next task to clock into." 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)
(save-mark-and-excursion (save-mark-and-excursion
(cond (cond
((and (markerp org-clock-interrupted-task) ((and (markerp org-clock-interrupted-task)
@ -439,10 +439,11 @@ user for the next task to clock into."
(org-with-point-at org-clock-interrupted-task (org-with-point-at org-clock-interrupted-task
(not (member (nth 2 (org-heading-components)) (not (member (nth 2 (org-heading-components))
org-done-keywords)))) org-done-keywords))))
;; interrupted task is set ;; interrupted task is set and not closed yet, so let's clock in
;; there
(org-with-point-at org-clock-interrupted-task (org-with-point-at org-clock-interrupted-task
(org-clock-in))) (org-clock-in)))
(parent-task ((setq parent-task (db/find-parent-task))
;; found parent task ;; found parent task
(org-with-point-at parent-task (org-with-point-at parent-task
(org-clock-in))) (org-clock-in)))