[Timeline] Make format of inactive timestamps into global variables

This commit is contained in:
Daniel - 2018-01-21 19:00:14 +01:00
parent a21bc3bc70
commit f59d687620
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 15 additions and 9 deletions

View File

@ -68,21 +68,27 @@ region will be traversed."
heading) heading)
(match-string 4 heading)))) (match-string 4 heading))))
(defvar timeline-tools-org-inactive-timestamp-format
(concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")
"Format of inactive `org-mode timestamps.
Can be used as format string for `format-time,")
(defun timeline-tools-insert-clockline (time-1 time-2) (defun timeline-tools-insert-clockline (time-1 time-2)
"Insert new clock line from TIME-1 to TIME-2. "Insert new clock line from TIME-1 to TIME-2.
Insertion will be done at the beginning of the current line. Insertion will be done at the beginning of the current line.
TIME-1 and TIME-2 must be given in a format understandable by TIME-1 and TIME-2 must be given in a format understandable by
`format-time-string, which see. Saves mark and point." `format-time-string, which see. Saves mark and point."
(let ((timestamp-format (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]"))) (save-mark-and-excursion
(save-mark-and-excursion (beginning-of-line)
(beginning-of-line) (indent-according-to-mode)
(indent-according-to-mode) (insert "CLOCK: ")
(insert "CLOCK: ") (insert (format-time-string timeline-tools-org-inactive-timestamp-format
(insert (format-time-string timestamp-format time-1)) time-1))
(insert "--") (insert "--")
(insert (format-time-string timestamp-format time-2)) (insert (format-time-string timeline-tools-org-inactive-timestamp-format
(org-clock-update-time-maybe)))) time-2))
(org-clock-update-time-maybe)))
(defun timeline-tools-clocklines-of-task (marker) (defun timeline-tools-clocklines-of-task (marker)
"Return list of all clock lines of task under MARKER. "Return list of all clock lines of task under MARKER.