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