[Org] Revert ‘db/org-timeline-in-range’ to mostly imperative style

This mostly reverts 1192dc21, as it’s much clearer now what is going on, imho.

(btw: the commit message of 1192dc21 should have started with "More"
instead of "Move", duh!)
This commit is contained in:
Daniel - 2017-12-03 10:06:03 +01:00
parent 096989ee33
commit 4273dfeb41
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 15 additions and 15 deletions

View File

@ -1041,21 +1041,21 @@ TEND. Each element in this list is of the form
where START, END, MARKER are as return from
`db/org-clocking-time-in-range, which see. Entries in the
resulting list are sorted by START, ascending."
(->> (or files org-agenda-files)
(cl-remove-if-not #'file-exists-p)
(cl-mapcan #'(lambda (file)
(with-current-buffer (or (get-file-buffer file)
(find-file-noselect file))
(db/org-clocking-time-in-range tstart tend))))
(cl-mapcan #'(lambda (task)
(mapcar #'(lambda (clock-time)
(list (car clock-time)
(cdr clock-time)
(car task)))
(cdr task))))
((lambda (timeline) ; narf
(cl-sort timeline (lambda (entry-1 entry-2)
(< (car entry-1) (car entry-2))))))))
(let (timeline-of-files turned-around-timeline)
(setq timeline
(->> (or files org-agenda-files)
(cl-remove-if-not #'file-exists-p)
(cl-mapcan #'(lambda (file)
(with-current-buffer (or (get-file-buffer file)
(find-file-noselect file))
(db/org-clocking-time-in-range tstart tend))))))
(dolist (entry timeline)
(dolist (clock-time (cdr entry))
(push (list (car clock-time) (cdr clock-time) (car entry))
turned-around-timeline)))
(cl-sort turned-around-timeline
(lambda (entry-1 entry-2)
(< (car entry-1) (car entry-2))))))
(defun db/org-format-timeline (tstart tend &optional files)
"Display timeline of tasks in FILES between TSTART and TEND.