Function: org-clock-save
org-clock-save is a byte-compiled function defined in org-clock.el.gz.
Signature
(org-clock-save)
Documentation
Persist various clock-related data to disk.
The details of what will be saved are regulated by the variable
org-clock-persist.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-clock.el.gz
(defun org-clock-save ()
"Persist various clock-related data to disk.
The details of what will be saved are regulated by the variable
`org-clock-persist'."
(when (and org-clock-persist
(or org-clock-loaded
org-clock-has-been-used
(not (file-exists-p org-clock-persist-file))))
(with-temp-file org-clock-persist-file
(insert (format ";; %s - %s at %s\n"
(file-name-nondirectory org-clock-persist-file)
(system-name)
(format-time-string (org-time-stamp-format t))))
;; Store clock to be resumed.
(when (and (memq org-clock-persist '(t clock))
(let ((b (org-base-buffer (org-clocking-buffer))))
(and (buffer-live-p b)
(buffer-file-name b)
(or (not org-clock-persist-query-save)
(y-or-n-p (format "Save current clock (%s)?"
org-clock-heading))))))
(insert
(format "(setq org-clock-stored-resume-clock '(%S . %d))\n"
(buffer-file-name (org-base-buffer (org-clocking-buffer)))
(marker-position org-clock-marker))))
;; Store clocked task history. Tasks are stored reversed to
;; make reading simpler.
(when (and (memq org-clock-persist '(t history))
org-clock-history)
(insert
(format "(setq org-clock-stored-history '(%s))\n"
(mapconcat
(lambda (m)
(let ((b (org-base-buffer (marker-buffer m))))
(when (and (buffer-live-p b)
(buffer-file-name b))
(format "(%S . %d)"
(buffer-file-name b)
(marker-position m)))))
(reverse org-clock-history)
" ")))))))