From 023a14f8e7800a47b07781815c5f82571ca3c081 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Tue, 31 Jul 2018 14:09:56 +0200 Subject: [PATCH] =?UTF-8?q?[Timeline]=20Don=E2=80=99t=20do=20filtering=20a?= =?UTF-8?q?nymore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead draw lines when the category changes. --- site-lisp/timeline-tools.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/site-lisp/timeline-tools.el b/site-lisp/timeline-tools.el index 72aaa4e..e9b7751 100644 --- a/site-lisp/timeline-tools.el +++ b/site-lisp/timeline-tools.el @@ -26,10 +26,7 @@ :group 'timeline-tools :type 'integer) -(defcustom timeline-tools-filter-functions - '(timeline-tools-cluster-same-category - timeline-tools-skip-short-entries - timeline-tools-cluster-same-category) +(defcustom timeline-tools-filter-functions nil "List of functions to apply when formatting timelines. Filter are applied in the order they are given in this list." :group 'timeline-tools @@ -406,18 +403,21 @@ ending at 23:61. When not given, FILES defaults to timeline-tools--current-time-end))) (insert "|--|\n") (insert "| Category | Start | End | Duration | Task |\n") - (insert "|--|\n") - (dolist (cluster timeline) - (insert (format "| %s | %s | %s | %s min | " - (timeline-tools-entry-category cluster) - (timeline-tools-format-entry-time cluster 'start) - (timeline-tools-format-entry-time cluster 'end) - (timeline-tools-entry-duration cluster))) - ;; insert headline line by line - (dolist (headline (-interpose "|\n |||||" - (timeline-tools-entry-headlines cluster))) - (insert headline)) - (insert "\n")) + (let ((last-category nil)) + (dolist (cluster timeline) + (when (not (equal last-category (timeline-tools-entry-category cluster))) + (insert "|--|\n") + (setq last-category (timeline-tools-entry-category cluster))) + (insert (format "| %s | %s | %s | %s min | " + (timeline-tools-entry-category cluster) + (timeline-tools-format-entry-time cluster 'start) + (timeline-tools-format-entry-time cluster 'end) + (timeline-tools-entry-duration cluster))) + ;; insert headline line by line + (dolist (headline (-interpose "|\n |||||" + (timeline-tools-entry-headlines cluster))) + (insert headline)) + (insert "\n"))) (insert "|--|\n") (org-table-align) (goto-char (point-min)))))