From 0d2e773d9d3c5691ec8ee612402bbac4e117169b Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Mon, 1 Jan 2018 15:35:34 +0100 Subject: [PATCH] [Org] Function stub for merging clock lines into existing file unfinished. --- site-lisp/db-org.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 3b12428..eec45d1 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1088,6 +1088,25 @@ ending at 23:61. When not given, FILES defaults to (concat date " 23:61") files)) +(defun db/org-add-clock-line-to-file (id start end) + "Add clock line with START and END time to task identified by ID." + (warn "This function is untested, don’t use it for anything serious.") + ;; First insert clock line at task + (let ((location (org-id-find id))) + (when (null location) + (user-error "ID %s cannot be found" id)) + (org-with-point-at location + (db/org-add-clocking-time start end))) + ;; Now find other clocklines and update them: change starting and ending time + ;; accordingly, and if the time is completely within the given bounds, delete + ;; it. + (let ((start-sec (org-time-string-to-seconds start)) + (end-sec (org-time-string-to-seconds end))) + (db/org-map-clock-lines-and-entries + (lambda (line-start line-end) + (error "Not yet implemented.")) + (lambda ())))) + ;;; End