> What about the call to `org-publish-cache-get-file-property' in > `org-publish-index-generate-theindex'?
I was not familiar with the usage of theindex, but I confirmed the same cache error can occur if called when `org-publish-transient-cache' is nil. I've added that to my patch as well. >> I considered adding PROJECT to the `org-publish-cache-set-file-property' >> call in `org-publish-find-title.'/`org-publish-find-date'. However, >> since `org-publish-cache-get-file-property' is always called first that >> should initialized the cache. > > Such implicit assumptions are something to avoid, especially when we are > trying to be explicit about the project being queried with your patch. Fair logic, I was trying to be efficient since it results in an unnecessary call to `org-publish-initialize-cache'. I agree including the project-name is more robust in case this code gets refactored. I've updated the patch. Thanks, -- Thomas Ingram https://taingram.org/
>From 074dbbe67a23564c26b878592c592701bf3e2dc7 Mon Sep 17 00:00:00 2001 From: Thomas Ingram <tho...@taingram.org> Date: Wed, 23 Apr 2025 17:59:53 -0400 Subject: [PATCH] ox-publish.el: fix hash-table nil error in find title/date * lisp/ox-publish.el (org-publish-find-title, org-publish-find-date) (org-publish-index-generate-theindex): Ensure cache is initiated by providing project-name to `org-publish-cache-get-file-property' or `org-publish-cache-set-file-property' TINYCHANGE --- lisp/ox-publish.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 3532bdbb4..b0687085a 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -856,7 +856,7 @@ PROPERTY, i.e. \"behavior\" parameter from `org-export-options-alist'." (defun org-publish-find-title (file project) "Find the title of FILE in PROJECT." (let ((file (org-publish--expand-file-name file project))) - (or (org-publish-cache-get-file-property file :title nil t) + (or (org-publish-cache-get-file-property file :title nil t (car project)) (let* ((parsed-title (org-publish-find-property file :title project)) (title (if parsed-title @@ -865,7 +865,7 @@ PROPERTY, i.e. \"behavior\" parameter from `org-export-options-alist'." (org-no-properties (org-element-interpret-data parsed-title)) (file-name-nondirectory (file-name-sans-extension file))))) - (org-publish-cache-set-file-property file :title title))))) + (org-publish-cache-set-file-property file :title title (car project)))))) (defun org-publish-find-date (file project) "Find the date of FILE in PROJECT. @@ -874,7 +874,7 @@ If FILE is an Org file and provides a DATE keyword use it. In any other case use the file system's modification time. Return time in `current-time' format." (let ((file (org-publish--expand-file-name file project))) - (or (org-publish-cache-get-file-property file :date nil t) + (or (org-publish-cache-get-file-property file :date nil t (car project)) (org-publish-cache-set-file-property file :date (if (file-directory-p file) @@ -890,7 +890,8 @@ time in `current-time' format." (org-time-string-to-time value)))))) ((file-exists-p file) (file-attribute-modification-time (file-attributes file))) - (t (error "No such file: \"%s\"" file))))))))) + (t (error "No such file: \"%s\"" file))))) + (car project))))) (defun org-publish-sitemap-default-entry (entry style project) "Default format for site map ENTRY, as a string. @@ -1062,7 +1063,8 @@ publishing directory." (sort (nreverse full-index) (lambda (a b) (string< (downcase (car a)) (downcase (car b))))))) - (let ((index (org-publish-cache-get-file-property file :index))) + (let ((index (org-publish-cache-get-file-property file :index t + (car project)))) (dolist (term index) (unless (member term full-index) (push term full-index))))) ;; Write "theindex.inc" in DIRECTORY. -- 2.39.5