Explicitly define setter functions for timeline tooling

This is more explicitly and allows for more flexiblity.  Let's hope the
performance impact is not prohibitive, though.
This commit is contained in:
Daniel - 2020-06-27 10:38:13 +02:00
parent dd27018420
commit 2e229c5af9
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 14 additions and 6 deletions

View File

@ -119,14 +119,22 @@ end date of the timeline."
;; Model
(defalias 'timeline-tools-entry-start-time 'car
"Start time of ENTRY.")
(defun timeline-tools-entry-start-time (entry)
"Start time of ENTRY."
(car entry))
(defalias 'timeline-tools-entry-end-time 'cadr
"End time of ENTRY.")
(defun timeline-tools-entry-end-time (entry)
"End time of ENTRY."
(cadr entry))
(defalias 'timeline-tools-entry-marker 'caddr
"Marker to org task of ENTRY.")
(defun timeline-tools-entry-marker (entry)
"Marker to org task of ENTRY."
(caddr entry))
(gv-define-setter timeline-tools-entry-start-time
(time entry) `(setcar ,entry ,time))
(gv-define-setter timeline-tools-entry-end-time
(time entry) `(setcar (cdr ,entry) ,time))
(defun timeline-tools-make-entry (start-time end-time marker)
"Return a timeline entry made up of START-TIME, END-TIME, and MARKER.