[Timeline] Make transformer for timelines into separate function
This commit is contained in:
parent
fc53fd8943
commit
fd3b2135ca
|
@ -340,14 +340,13 @@ THRESHOLD defaults to the value of
|
||||||
|
|
||||||
new-timeline))
|
new-timeline))
|
||||||
|
|
||||||
(defun timeline-tools-get-transformed-timeline (tstart tend files)
|
(defun timeline-tools-transform-timeline (timeline)
|
||||||
"Return timeline from files, after application of `timeline-tools-filter-functions’."
|
"Return timeline from files, after application of
|
||||||
(let ((plain-timeline (timeline-tools-timeline tstart tend files)))
|
`timeline-tools-filter-functions’."
|
||||||
(and plain-timeline
|
(-reduce-from (lambda (tl f)
|
||||||
(-reduce-from (lambda (tl f)
|
(funcall f tl))
|
||||||
(funcall f tl))
|
timeline
|
||||||
plain-timeline
|
timeline-tools-filter-functions))
|
||||||
timeline-tools-filter-functions))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun timeline-tools-format-timeline (tstart tend &optional files)
|
(defun timeline-tools-format-timeline (tstart tend &optional files)
|
||||||
|
@ -359,7 +358,8 @@ value of `timeline-tools-filter-functions’. When called
|
||||||
interactively, START and END are queried with `org-read-date’."
|
interactively, START and END are queried with `org-read-date’."
|
||||||
(interactive (list (org-read-date nil nil nil "Start time: ")
|
(interactive (list (org-read-date nil nil nil "Start time: ")
|
||||||
(org-read-date nil nil nil "End time: ")))
|
(org-read-date nil nil nil "End time: ")))
|
||||||
(let* ((timeline (timeline-tools-get-transformed-timeline tstart tend files)))
|
(let* ((timeline (timeline-tools-transform-timeline
|
||||||
|
(timeline-tools-timeline tstart tend files))))
|
||||||
(let ((target-buffer (get-buffer-create " *Org Timeline*")))
|
(let ((target-buffer (get-buffer-create " *Org Timeline*")))
|
||||||
(with-current-buffer target-buffer
|
(with-current-buffer target-buffer
|
||||||
(timeline-tools-mode)
|
(timeline-tools-mode)
|
||||||
|
@ -433,10 +433,11 @@ Updates category properties before constructing the new timeline."
|
||||||
(with-current-buffer (get-file-buffer file)
|
(with-current-buffer (get-file-buffer file)
|
||||||
(org-refresh-category-properties)))
|
(org-refresh-category-properties)))
|
||||||
(setq-local timeline-tools--current-timeline
|
(setq-local timeline-tools--current-timeline
|
||||||
(timeline-tools-get-transformed-timeline
|
(timeline-tools-transform-timeline
|
||||||
timeline-tools--current-time-start
|
(timeline-tools-timeline
|
||||||
timeline-tools--current-time-end
|
timeline-tools--current-time-start
|
||||||
timeline-tools--current-files))
|
timeline-tools--current-time-end
|
||||||
|
timeline-tools--current-files)))
|
||||||
(timeline-tools-redraw-timeline))
|
(timeline-tools-redraw-timeline))
|
||||||
|
|
||||||
(defun timeline-tools-forward-day ()
|
(defun timeline-tools-forward-day ()
|
||||||
|
@ -447,10 +448,11 @@ Updates category properties before constructing the new timeline."
|
||||||
(setq-local timeline-tools--current-time-start (+ 86400 timeline-tools--current-time-start))
|
(setq-local timeline-tools--current-time-start (+ 86400 timeline-tools--current-time-start))
|
||||||
(setq-local timeline-tools--current-time-end (+ 86400 timeline-tools--current-time-end))
|
(setq-local timeline-tools--current-time-end (+ 86400 timeline-tools--current-time-end))
|
||||||
(setq-local timeline-tools--current-timeline
|
(setq-local timeline-tools--current-timeline
|
||||||
(timeline-tools-get-transformed-timeline
|
(timeline-tools-transform-timeline
|
||||||
timeline-tools--current-time-start
|
(timeline-tools-timeline
|
||||||
timeline-tools--current-time-end
|
timeline-tools--current-time-start
|
||||||
timeline-tools--current-files))
|
timeline-tools--current-time-end
|
||||||
|
timeline-tools--current-files)))
|
||||||
(timeline-tools-redraw-timeline)))
|
(timeline-tools-redraw-timeline)))
|
||||||
|
|
||||||
(defun timeline-tools-backward-day ()
|
(defun timeline-tools-backward-day ()
|
||||||
|
@ -463,10 +465,11 @@ Updates category properties before constructing the new timeline."
|
||||||
(setq-local timeline-tools--current-time-end
|
(setq-local timeline-tools--current-time-end
|
||||||
(- timeline-tools--current-time-end 86400))
|
(- timeline-tools--current-time-end 86400))
|
||||||
(setq-local timeline-tools--current-timeline
|
(setq-local timeline-tools--current-timeline
|
||||||
(timeline-tools-get-transformed-timeline
|
(timeline-tools-transform-timeline
|
||||||
timeline-tools--current-time-start
|
(timeline-tools-timeline
|
||||||
timeline-tools--current-time-end
|
timeline-tools--current-time-start
|
||||||
timeline-tools--current-files))
|
timeline-tools--current-time-end
|
||||||
|
timeline-tools--current-files)))
|
||||||
(timeline-tools-redraw-timeline)))
|
(timeline-tools-redraw-timeline)))
|
||||||
|
|
||||||
(defun timeline-tools-skip-short-entries ()
|
(defun timeline-tools-skip-short-entries ()
|
||||||
|
|
Loading…
Reference in New Issue