Compare commits

..

3 Commits

Author SHA1 Message Date
5d28ab04a6
Fix some warnings in timeline-tools 2024-06-11 18:19:37 +02:00
051b578ba0
Do not include archives in timeline-tools by default
They are usually not needed, and can be included explicitly when
necessary.
2024-06-11 18:17:08 +02:00
2144c7e110
Fix headline display in timeline tools
Why did I do this that complicated to begin with?
2024-06-11 18:12:51 +02:00

View File

@ -115,7 +115,7 @@ end date of the timeline."
(define-derived-mode timeline-tools-mode (define-derived-mode timeline-tools-mode
org-mode "Timeline" org-mode "Timeline"
"Major mode to display org-mode timelines." "Major mode to display `org-mode' timelines."
(hl-line-mode) (hl-line-mode)
(buffer-enable-undo)) (buffer-enable-undo))
@ -161,10 +161,7 @@ Return whatever is found first."
(defun timeline-tools-entry-headline (entry) (defun timeline-tools-entry-headline (entry)
"Return the headline associated with ENTRY." "Return the headline associated with ENTRY."
(let* ((marker (timeline-tools-entry-marker entry))) (org-entry-get (timeline-tools-entry-marker entry) "ITEM"))
(plist-get (cadr (org-with-point-at marker
(org-element-headline-parser (point-max))))
:raw-value)))
;; Utilities ;; Utilities
@ -297,11 +294,10 @@ returned by `timeline-tools-clocklines-in-range, which see.
Entries in the resulting list are sorted by START, ascending. Entries in the resulting list are sorted by START, ascending.
TSTART and TEND must be valid time specifiers for TSTART and TEND must be valid time specifiers for
`timeline-tools-clocklines-in-range. If not given, `timeline-tools-clocklines-in-range. If not given,
FILES-OR-BUFFERS defaults to `org-agenda-files including all FILES-OR-BUFFERS defaults to `org-agenda-files without archives."
archives."
(let (timeline-of-files turned-around-timeline) (let (timeline-of-files turned-around-timeline)
(setq timeline-of-files (setq timeline-of-files
(->> (or files-or-buffers (org-agenda-files t t)) (->> (or files-or-buffers (org-agenda-files t nil))
(cl-mapcan #'(lambda (file-or-buffer) (cl-mapcan #'(lambda (file-or-buffer)
(let ((buffer (cond (let ((buffer (cond
((bufferp file-or-buffer) ((bufferp file-or-buffer)
@ -410,7 +406,7 @@ Filtering is done by applying all functions from
(defun timeline-tools-format-timeline (tstart tend &optional files) (defun timeline-tools-format-timeline (tstart tend &optional files)
"Display timeline of tasks between TSTART and TEND from FILES. "Display timeline of tasks between TSTART and TEND from FILES.
When not given, FILES defaults to `org-agenda-files including When not given, FILES defaults to `org-agenda-files without
archives. The timeline is transformed as given by the current archives. The timeline is transformed as given by the current
value of `timeline-tools-filter-functions. When called value of `timeline-tools-filter-functions. When called
interactively, START and END are queried with `org-read-date." interactively, START and END are queried with `org-read-date."
@ -434,7 +430,7 @@ interactively, START and END are queried with `org-read-date."
DATE should be a string of the form %Y-%m-%d. When called DATE should be a string of the form %Y-%m-%d. When called
interactively, this date will be queried with `org-read-date. interactively, this date will be queried with `org-read-date.
When not given, FILES defaults to `org-agenda-files including When not given, FILES defaults to `org-agenda-files without
archives." archives."
(interactive (list (org-read-date nil nil))) (interactive (list (org-read-date nil nil)))
(let ((timeline-tools-time-format "%H:%M") (let ((timeline-tools-time-format "%H:%M")
@ -744,7 +740,7 @@ clock line."
(with-current-buffer buffer (with-current-buffer buffer
;; Make sure everything is visible, as otherwise editing may produce odd ;; Make sure everything is visible, as otherwise editing may produce odd
;; results ;; results
(org-show-all) (org-fold-show-all)
(timeline-tools-map-clocklines (timeline-tools-map-clocklines
(lambda (timestamp-1 timestamp-2) (lambda (timestamp-1 timestamp-2)