Function: org-publish-initialize-cache
org-publish-initialize-cache is a byte-compiled function defined in
ox-publish.el.gz.
Signature
(org-publish-initialize-cache PROJECT-NAME)
Documentation
Initialize the projects cache if not initialized yet and return it.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-publish.el.gz
(defun org-publish-initialize-cache (project-name)
"Initialize the projects cache if not initialized yet and return it."
(unless project-name
(error "Cannot initialize `org-publish-cache' without projects name in \
`org-publish-initialize-cache'"))
(unless (file-exists-p org-publish-timestamp-directory)
(make-directory org-publish-timestamp-directory t))
(unless (file-directory-p org-publish-timestamp-directory)
(error "Org publish timestamp: %s is not a directory"
org-publish-timestamp-directory))
(unless org-publish-transient-cache
(setq org-publish-transient-cache (make-hash-table :test #'equal)))
(unless (and org-publish-cache
(string= (org-publish-cache-get ":project:") project-name))
(let* ((cache-file
(concat
(expand-file-name org-publish-timestamp-directory)
project-name ".cache"))
(cexists (file-exists-p cache-file)))
(when org-publish-cache (org-publish-reset-cache))
(if cexists (load-file cache-file)
(setq org-publish-cache
(make-hash-table :test 'equal :weakness nil :size 100))
(org-publish-cache-set ":project:" project-name)
(org-publish-cache-set ":cache-file:" cache-file))
(unless cexists (org-publish-write-cache-file nil))))
org-publish-cache)