Greetings, Several weeks ago I reached out regarding cache errors I was experiencing using org-publish-find-title and org-publish-find-date. I did some testing and was able to consistently reproduce the error '(wrong-type-argument hash-table-p nil)' in 'emacs -Q'. See steps below.
I have attached a small patch that corrects this issue. I added the PROJECT-NAME argument to the calls to `org-publish-cache-get-file-property'. That ensures the cache is always initialized for the project. * Recreate the Error 1. Create an Org file in /tmp/test-project/file.org 2. Evaluate the below code. 3. Each sexp will result in a hash-table error because there is no org-publish-transient-cache set when called. #+begin_src emacs-lisp (require 'org) (require 'ox-publish) (let ((debug-on-error t) (org-publish-transient-cache nil) (project-alist '("test-project" :base-directory "/tmp/test-project/" :base-extension "org"))) (org-publish-find-title "/tmp/test-project/file.org" project-alist)) (let ((debug-on-error t) (org-publish-transient-cache nil) (project-alist '("test-project" :base-directory "/tmp/test-project/" :base-extension "org"))) (org-publish-find-date "/tmp/test-project/file.org" project-alist)) #+end_src -- Thomas Ingram https://taingram.org/
>From 9121b0507e0ae1a1df5dae8717f02483610a81fc Mon Sep 17 00:00:00 2001 From: Thomas Ingram <tho...@taingram.org> Date: Wed, 23 Apr 2025 17:59:53 -0400 Subject: [PATCH] Prevent 'hash-table-p nil' error in org-publish-find-(title|date) Add the PROJECT-NAME in calls to `org-publish-cache-get-file-property' to ensure the cache is always initialized for the given project. --- lisp/ox-publish.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 3532bdbb4..1a5f9d822 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 @@ -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) -- 2.39.5