[Org] Change API of function to add clock lines to task
Instead of resolving an ID, this function now gets a marker designating the task where the provided clock line should go to.
This commit is contained in:
parent
fa0fb98291
commit
74a26b4d5a
|
@ -1104,18 +1104,17 @@ ending at 23:61. When not given, FILES defaults to
|
|||
|
||||
(bind-key "C-c C-x C-a" #'db/org-add-clocking-time org-mode-map)
|
||||
|
||||
(defun db/org-add-clock-line-to-file (id start end)
|
||||
"Add clock line with START and END time to task identified by ID.
|
||||
(defun db/org-add-clock-line-to-marker (target-marker start end)
|
||||
"Add clock line with START and END time to task identified by TARGET-MARKER.
|
||||
START and END must be given as time objects as returned by
|
||||
`encode-time’, or as an integer or float denoting seconds since
|
||||
1970-01-01."
|
||||
(let ((location (org-id-find id t)))
|
||||
(when (null location)
|
||||
(user-error "ID %s cannot be found" id))
|
||||
;; Update existing clock lines
|
||||
1970-01-01. TARGET-MARKER must be positioned on the task where
|
||||
the clock line is to be added to."
|
||||
(when (not (markerp target-marker))
|
||||
(user-error "Marker not valid."))
|
||||
(let ((new-start (float-time start))
|
||||
(new-end (float-time end)))
|
||||
(with-current-buffer (marker-buffer location)
|
||||
(with-current-buffer (marker-buffer target-marker)
|
||||
(db/org-map-clock-lines-and-entries
|
||||
(lambda (timestamp-1 timestamp-2)
|
||||
(let ((current-start (float-time
|
||||
|
@ -1154,8 +1153,8 @@ START and END must be given as time objects as returned by
|
|||
(lambda ())))
|
||||
|
||||
;; Finally add the new clock line
|
||||
(org-with-point-at location
|
||||
(db/org-add-clocking-time new-start new-end)))))
|
||||
(org-with-point-at target-marker
|
||||
(db/org-add-clocking-time new-start new-end))))
|
||||
|
||||
|
||||
;;; End
|
||||
|
|
Loading…
Reference in New Issue