Function: org-clock-load

org-clock-load is a byte-compiled function defined in org-clock.el.gz.

Signature

(org-clock-load)

Documentation

Load clock-related data from disk, maybe resuming a stored clock.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-clock.el.gz
(defun org-clock-load ()
  "Load clock-related data from disk, maybe resuming a stored clock."
  (when (and org-clock-persist (not org-clock-loaded))
    (if (not (file-readable-p org-clock-persist-file))
	(message "Not restoring clock data; %S not found" org-clock-persist-file)
      (message "Restoring clock data")
      ;; Load history.
      (load-file org-clock-persist-file)
      (setq org-clock-loaded t)
      (pcase-dolist (`(,(and file (pred file-exists-p)) . ,position)
		     org-clock-stored-history)
	(org-clock-history-push position (find-file-noselect file)))
      ;; Resume clock.
      (pcase org-clock-stored-resume-clock
	(`(,(and file (pred file-exists-p)) . ,position)
	 (with-current-buffer (find-file-noselect file)
	   (when (or (not org-clock-persist-query-resume)
                     (y-or-n-p (format "Resume clock (%s)?"
				       (save-excursion
					 (goto-char position)
					 (org-get-heading t t)))))
	     (goto-char position)
	     (let ((org-clock-in-resume 'auto-restart)
		   (org-clock-auto-clock-resolution nil))
	       (org-clock-in)
	       (when (org-invisible-p) (org-fold-show-context))))))
	(_ nil)))))