From d1e3409e804d8d84c6fddbb50d7181a9def78d03 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Fri, 8 Dec 2023 17:45:10 +0100 Subject: [PATCH] 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 --- site-lisp/db-org.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index f003480..1102a80 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -431,7 +431,7 @@ 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) (not org-clock-resolving-clocks-due-to-idleness)) - (let ((parent-task (db/find-parent-task))) + (let (parent-task) (save-mark-and-excursion (cond ((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 (not (member (nth 2 (org-heading-components)) 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-clock-in))) - (parent-task + ((setq parent-task (db/find-parent-task)) ;; found parent task (org-with-point-at parent-task (org-clock-in)))