From 8ca95943e6b3871c38a87de92c1c86e2e951fae6 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 7 Jun 2025 10:25:20 +0200 Subject: [PATCH] Allow display of additional properties in timeline entries --- site-lisp/timeline-tools.el | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/site-lisp/timeline-tools.el b/site-lisp/timeline-tools.el index f3b7a28..e3f5390 100644 --- a/site-lisp/timeline-tools.el +++ b/site-lisp/timeline-tools.el @@ -80,6 +80,15 @@ end date of the timeline." :group 'timeline-tools :type 'function) +(defcustom timeline-tools-extra-properties nil + "Extra properties to display with the headline. + +This must be a list of Org properties (given as strings) that are +extracted from the each heading to be displayed after the headline. +Properties are extracted with inheritance enabled." + :group 'timeline-tools + :type '(repeat string)) + ;; Mode definition @@ -132,7 +141,12 @@ end date of the timeline." (defun timeline-tools-entry-marker (entry) "Marker to org task of ENTRY." - (caddr entry)) + (let ((mrk (caddr entry))) + (unless (markerp mrk) + (error "Not an entry marker for a timeline: %s" mrk)) + (unless (marker-buffer mrk) + (error "Buffer of marker does not exist anymore: %s" mrk)) + mrk)) (gv-define-setter timeline-tools-entry-start-time (time entry) `(setcar ,entry ,time)) @@ -161,7 +175,14 @@ Return whatever is found first." (defun timeline-tools-entry-headline (entry) "Return the headline associated with ENTRY." - (org-entry-get (timeline-tools-entry-marker entry) "ITEM")) + (let ((mrk (timeline-tools-entry-marker entry))) + (concat (org-entry-get mrk "ITEM") + (--when-let (->> (-map #'(lambda (property) + (--when-let (org-entry-get mrk property :inherit) + (format "%s: %s" property it))) + timeline-tools-extra-properties) + (-remove #'null)) + (format " (%s)" (apply #'concat (-interpose ", " it))))))) ;; Utilities