                                         (org-parse-time-string timestamp-1))))
                  (current-end   (float-time
                                  (apply #'encode-time
-                                        (org-parse-time-string timestamp-2)))))
+                                        (org-parse-time-string timestamp-2))))
+                 (kill-whole-line nil)  ; don’t delete newlines if not asked to
+                 )
              (cond
               ;; if the current clock line is completely contained within the
               ;; given period, delete it

               (kill-whole-line))
              ;; if the current clock line completely contains the given one,
              ;; split it
              ((and (<= current-start new-start)
                    (<= new-end current-end))
               (beginning-of-line)
               (let ((kill-whole-line nil))
                 (kill-line))
               (indent-according-to-mode)
               (insert "CLOCK: ")
               (insert (format-time-string timestamp-format current-start))
               (insert "--")
               (insert (format-time-string timestamp-format new-start))
               (org-clock-update-time-maybe)
               (beginning-of-line)
               (open-line 1)
               (indent-according-to-mode)
               (insert "CLOCK: ")
               (insert (format-time-string timestamp-format new-end))
               (insert "--")
               (insert (format-time-string timestamp-format current-end))
               (org-clock-update-time-maybe))
              ;; New interval overlaps beginning of current line
              ((<= new-start current-start new-end current-end)
               (beginning-of-line)
               (let ((kill-whole-line nil))
                 (kill-line))
               (indent-according-to-mode)
               (insert "CLOCK: ")
               (insert (format-time-string timestamp-format new-end))
               (insert "--")
               (insert (format-time-string timestamp-format current-end))
               (org-clock-update-time-maybe))
              ;; New interval overlaps at end of current line
              ((<= current-start new-start current-end new-end)
               (beginning-of-line)
               (let ((kill-whole-line nil))
                 (kill-line))
               (indent-according-to-mode)
               (insert "CLOCK: ")
               (insert (format-time-string timestamp-format current-start))
               (insert "--")
               (insert (format-time-string timestamp-format new-start))
               (org-clock-update-time-maybe)))))
         (lambda ()
           ;; keep headline as they are, i.e., do nothing
           ))))
    ;; Finally add the new clock line
    (org-with-point-at location
      (db/org-add-clocking-time (apply #'encode-time (org-parse-time-string start))

                          (concat date " 23:61")
                          files))


;;; Manipulating Clock Lines

(defun db/org-insert-clockline (time-1 time-2)
  "Insert new clock line from TIME-1 to TIME-2 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."
  (let ((timestamp-format (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")))
    (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)))

(defun db/org-add-clocking-time (starting-time ending-time)
  "Add \"CLOCK:\" line to the task under point in the current org-mode file."
  (interactive
