[Org] Move functional style for reporting function

Doesn’t mean it’s more comprehensible now, though …
This commit is contained in:
Daniel - 2017-12-02 21:11:41 +01:00
parent e95ca2da9a
commit 1192dc2cb8
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 14 additions and 14 deletions

View File

@ -1037,21 +1037,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 (setq files org-agenda-files)) (->> (or files org-agenda-files)
(let ((task-clock-times (cl-loop for file in files (cl-remove-if-not #'file-exists-p)
when (file-exists-p file) (cl-mapcan #'(lambda (file)
append (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))))
timeline) (cl-mapcan #'(lambda (task)
(dolist (headline task-clock-times) (mapcar #'(lambda (clock-time)
(dolist (clock-time (cdr headline)) (list (car clock-time)
(push (list (car clock-time) (cdr clock-time) (car headline)) (cdr clock-time)
timeline))) (car task)))
(setq timeline (cdr task))))
((lambda (timeline) ; narf
(cl-sort timeline (lambda (entry-1 entry-2) (cl-sort timeline (lambda (entry-1 entry-2)
(< (car entry-1) (car entry-2))))) (< (car entry-1) (car entry-2))))))))
timeline))
(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.