       (display-buffer target-buffer)
       t)))
 
-(defun timeline-tools-timeline-of-day (date &optional files)
+;;;###autoload
+(defun timeline-tools-format-timeline-of-day (date &optional files)
   "Format timeline of given DATE.
 
 DATE should be a string of the form %Y-%m-%d.  When called

            (setf (first entry-2) middle)))))
    new-timeline))

(defun timeline-tools-get-headline (marker)
  "Get headline of task at MARKER."
  (assert (markerp marker))
  (save-match-data
    (let* ((heading (save-mark-and-excursion
                     (with-current-buffer (marker-buffer marker)
                       (goto-char (marker-position marker))
                       (thing-at-point 'line t)))))
      (string-match (format "^\\(\\*+\\)\\(?: +%s\\)?\\(?: %s\\)? +\\(.*?\\)[ \t]*\\(?::\\(?:[A-Za-z_]+:\\)+\\)?$"
                            (regexp-opt org-todo-keywords-1)
                            org-priority-regexp)
                    heading)
      (match-string 4 heading))))

(defun timeline-tools-format-timeline (tstart tend &optional files)
  "Display timeline of tasks between TSTART and TEND from FILES.


            (save-mark-and-excursion
             (funcall headline-fn)))))))))

(defun timeline-tools-get-headline (marker)
  "Get headline of task at MARKER."
  (assert (markerp marker))
  (save-match-data
    (let* ((heading (save-mark-and-excursion
                     (with-current-buffer (marker-buffer marker)
                       (goto-char (marker-position marker))
                       (thing-at-point 'line t)))))
      (string-match (format "^\\(\\*+\\)\\(?: +%s\\)?\\(?: %s\\)? +\\(.*?\\)[ \t]*\\(?::\\(?:[A-Za-z_]+:\\)+\\)?$"
                            (regexp-opt org-todo-keywords-1)
                            org-priority-regexp)
                    heading)
      (match-string 4 heading))))

(defun timeline-tools-insert-clockline (time-1 time-2)
  "Insert new clock line from TIME-1 to TIME-2.

Insertion will be done at the beginning of the current line.
TIME-1 and TIME-2 must be given in a format understandable by
`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
     (beginning-of-line)
     (indent-according-to-mode)
     (insert "CLOCK: ")
     (insert (format-time-string timestamp-format time-1))
     (insert "--")
     (insert (format-time-string timestamp-format time-2))
     (org-clock-update-time-maybe))))


;; Reporting

;; XXX: Find actual org-mode functions that do the stuff we are doing here

(defun timeline-tools-clocklines-in-range (tstart tend)
