From 4273dfeb41de7a785f30b257377991387021cf11 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 3 Dec 2017 10:06:03 +0100 Subject: [PATCH] =?UTF-8?q?[Org]=20Revert=20=E2=80=98db/org-timeline-in-ra?= =?UTF-8?q?nge=E2=80=99=20to=20mostly=20imperative=20style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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!) --- site-lisp/db-org.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 298ed66..8bd031e 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -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.