From dbda1928cecb22d6228e9d87f16e067b1c850c37 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 15 Sep 2024 13:09:12 +0200 Subject: [PATCH] Catch errors on user clock choice to ensure continuous clocking --- site-lisp/db-org.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 1fbff47..7c66f49 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -454,7 +454,13 @@ user for the next task to clock into." (org-with-point-at org-clock-default-task (org-clock-in))) (t - (org-clock-in '(4)))))))) + ;; We cannot determine what task to clock in next, so let the user choose a task to clock + ;; in to; catch errors in case of typos and try again until a valid clock is running + (while (not (org-clocking-p)) + (condition-case err + (org-clock-in '(4)) + (user-error ; only handle user errors, to allow other errors to escape + (message "Error: %s" (error-message-string err)) nil))))))))) (defun db/save-current-org-task-to-file () "Format currently clocked task and write it to`db/org-clock-current-task-file'."