[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."
(->> (or files org-agenda-files) (let (timeline-of-files turned-around-timeline)
(cl-remove-if-not #'file-exists-p) (setq timeline
(cl-mapcan #'(lambda (file) (->> (or files org-agenda-files)
(with-current-buffer (or (get-file-buffer file) (cl-remove-if-not #'file-exists-p)
(find-file-noselect file)) (cl-mapcan #'(lambda (file)
(db/org-clocking-time-in-range tstart tend)))) (with-current-buffer (or (get-file-buffer file)
(cl-mapcan #'(lambda (task) (find-file-noselect file))
(mapcar #'(lambda (clock-time) (db/org-clocking-time-in-range tstart tend))))))
(list (car clock-time) (dolist (entry timeline)
(cdr clock-time) (dolist (clock-time (cdr entry))
(car task))) (push (list (car clock-time) (cdr clock-time) (car entry))
(cdr task)))) turned-around-timeline)))
((lambda (timeline) ; narf (cl-sort turned-around-timeline
(cl-sort timeline (lambda (entry-1 entry-2) (lambda (entry-1 entry-2)
(< (car entry-1) (car 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.