[Org] Add simple check for ‘db/clock-in-by-task-id’

This commit is contained in:
Daniel - 2018-11-18 16:00:13 +01:00
parent b11c63c49e
commit 3459213765
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 6 additions and 3 deletions

View File

@ -318,9 +318,12 @@ In ~%s~:
(defun db/clock-in-task-by-id (task-id)
"Clock in org mode task as given by TASK-ID."
(org-with-point-at (org-id-find task-id 'marker)
(org-clock-in))
(org-save-all-org-buffers))
(let ((location (org-id-find task-id 'marker)))
(if (null location)
(user-error "Invalid location «%s» given." task-id)
(org-with-point-at location
(org-clock-in))
(org-save-all-org-buffers))))
(defun db/clock-out-task-by-id (task-id)
"Clock out org mode task as given by TASK-ID."