From ddded41c7acd7659e234b5a416e1eeb86b984736 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Tue, 31 Jul 2018 14:07:56 +0200 Subject: [PATCH] [Timeline] Change time formats when displaying only one day MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no use in displaying the whole date when it’s clear that we are only looking at one day. Thus, only hours and minutes are shown for start and end times now. To make the headline still useful, a new time format has been introduced. --- site-lisp/timeline-tools.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/site-lisp/timeline-tools.el b/site-lisp/timeline-tools.el index a1542aa..72aaa4e 100644 --- a/site-lisp/timeline-tools.el +++ b/site-lisp/timeline-tools.el @@ -35,9 +35,15 @@ Filter are applied in the order they are given in this list." :group 'timeline-tools :type '(list function)) +(defcustom timeline-tools-headline-time-format + "%Y-%m-%d %H:%M" + "Format of time used in the headline of a timeline." + :group 'timeline-tools + :type 'string) + (defcustom timeline-tools-time-format "%Y-%m-%d %H:%M" - "Format of time as used by the formatting functions." + "Format of time used inside a timeline" :group 'timeline-tools :type 'string) @@ -361,6 +367,8 @@ interactively, START and END are queried with `org-read-date’." (setq-local timeline-tools--current-time-end (org-time-string-to-seconds tend)) (setq-local timeline-tools--current-files files) (setq-local timeline-tools--current-timeline timeline) + (setq-local timeline-tools-time-format timeline-tools-time-format) + (setq-local timeline-tools-headline-time-format timeline-tools-headline-time-format) (hl-line-mode) (buffer-enable-undo) (timeline-tools-redraw-timeline)) @@ -392,9 +400,9 @@ ending at 23:61. When not given, FILES defaults to (let ((timeline timeline-tools--current-timeline)) (erase-buffer) (insert (format "* Timeline from [%s] to [%s]\n\n" - (format-time-string timeline-tools-time-format + (format-time-string timeline-tools-headline-time-format timeline-tools--current-time-start) - (format-time-string timeline-tools-time-format + (format-time-string timeline-tools-headline-time-format timeline-tools--current-time-end))) (insert "|--|\n") (insert "| Category | Start | End | Duration | Task |\n")