Make actual timeline appear first in main display

When I copy over the timeline into the actual time sheet application, I
like to focus on the first line of the remaining report, moving it to
the top of the window.  Having the clocktime summary on top this hard,
because after redrawing, the summary will be on top and not the actual
timeline.  Changing the positions may help here.
This commit is contained in:
Daniel Borchmann 2024-11-08 21:15:23 +01:00
parent fe5d236b77
commit aabcfcad06
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625

View File

@ -475,6 +475,32 @@ current values of the relevant buffer local variables."
(format-time-string timeline-tools-headline-time-format (format-time-string timeline-tools-headline-time-format
timeline-tools--current-time-end))) timeline-tools--current-time-end)))
;; Actual timeline
(insert "|--|\n")
(insert "| Category | Start | End | Duration | Task |\n")
(let ((last-category nil)
(current-category nil))
(dolist (line timeline)
(setq current-category (funcall timeline-tools-category-function
line
timeline-tools--current-time-start
timeline-tools--current-time-end))
(when (not (equal last-category current-category))
(insert "|--|\n")
(setq last-category current-category))
(insert
(propertize (format "| %s | %s | %s | %s min | %s | \n"
current-category
(timeline-tools-format-entry-time line 'start)
(timeline-tools-format-entry-time line 'end)
(timeline-tools-entry-duration line)
(timeline-tools-entry-headline line))
'entry line))))
(insert "|--|\n")
(org-table-align)
(insert "\n")
;; Clocktime summary: booked categories, their total times, and their relative amount ;; Clocktime summary: booked categories, their total times, and their relative amount
(let* ((data (->> timeline (let* ((data (->> timeline
(-group-by #'(lambda (entry) ; group by category (-group-by #'(lambda (entry) ; group by category
@ -501,29 +527,6 @@ current values of the relevant buffer local variables."
(org-table-align) (org-table-align)
(insert "\n")) (insert "\n"))
;; Actual timeline
(insert "|--|\n")
(insert "| Category | Start | End | Duration | Task |\n")
(let ((last-category nil)
(current-category nil))
(dolist (line timeline)
(setq current-category (funcall timeline-tools-category-function
line
timeline-tools--current-time-start
timeline-tools--current-time-end))
(when (not (equal last-category current-category))
(insert "|--|\n")
(setq last-category current-category))
(insert
(propertize (format "| %s | %s | %s | %s min | %s | \n"
current-category
(timeline-tools-format-entry-time line 'start)
(timeline-tools-format-entry-time line 'end)
(timeline-tools-entry-duration line)
(timeline-tools-entry-headline line))
'entry line))))
(insert "|--|\n")
(org-table-align)
(goto-char (point-min)) (goto-char (point-min))
(timeline-tools-next-line)))) (timeline-tools-next-line))))